Skip to content

Commit

Permalink
desktop ui fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhael-Danilov committed Jan 8, 2025
1 parent d342a0a commit c2898c2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ public static CharAction actionForCell(@NotNull Char actor, int cell, @NotNull L
Heap heap;
if ((heap = level.getHeap(cell)) != null) {
if (heap.type == Heap.Type.HEAP) {
if (heap.peek() instanceof Carcass) {
if (heap.peek() instanceof Carcass && actor.getPos() != heap.pos) {
return new MapItemAction(cell);
} else {
return new PickUp(cell);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

package com.watabou.pixeldungeon.ui;

import com.watabou.pixeldungeon.Dungeon;
import com.watabou.pixeldungeon.actors.Char;
import com.watabou.pixeldungeon.items.Heap;
import com.watabou.pixeldungeon.items.Item;
Expand Down Expand Up @@ -30,7 +29,7 @@ protected void createChildren() {

slot = new ItemSlot() {
protected void onClick() {
Dungeon.hero.handle( Dungeon.hero.getPos() );
hero.handle( hero.getPos() );
}
};
slot.showParams( false );
Expand All @@ -48,7 +47,7 @@ protected void layout() {
public void update() {

if (hero.isReady()) {
Heap heap = Dungeon.level.getHeap( hero.getPos() );
Heap heap = hero.level().getHeap( hero.getPos() );

if (heap != null) {
Item item =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.nyrds.pixeldungeon.items.necropolis.BlackSkull;
import com.nyrds.pixeldungeon.items.necropolis.BlackSkullOfMastery;
import com.nyrds.pixeldungeon.ml.R;
import com.nyrds.platform.game.RemixedDungeon;
import com.nyrds.platform.util.StringsManager;
import com.watabou.noosa.Text;
import com.watabou.pixeldungeon.Dungeon;
Expand All @@ -23,6 +24,7 @@
public class WndChooseWay extends Window {

private static final int WIDTH = 120;
private static final int L_WIDTH = 160;
private static final int BTN_HEIGHT = 18;

public WndChooseWay(@NotNull Char chr,final Item item, final HeroSubClass way){
Expand All @@ -49,10 +51,13 @@ private String getWayDesc(final HeroSubClass way1, final HeroSubClass way2){
}

private void chooseWay(@NotNull Char chr, final Item item, final HeroSubClass way1, final HeroSubClass way2) {

int width = RemixedDungeon.landscape() ? L_WIDTH : WIDTH;

IconTitle titlebar = new IconTitle();
titlebar.icon( new ItemSprite( item ) );
titlebar.label( item.name() );
titlebar.setRect( 0, 0, WIDTH, 0 );
titlebar.setRect( 0, 0, width, 0 );
add( titlebar );

Text normal = Highlighter.addHilightedText(titlebar.left(), titlebar.bottom() + GAP, width,this, getWayDesc(way1, way2) );
Expand All @@ -64,7 +69,7 @@ protected void onClick() {
MasteryItem.choose(chr, item, way1 );
}
};
btnWay1.setRect( 0, normal.getY() + normal.height() + GAP, (WIDTH - GAP) / 2, BTN_HEIGHT );
btnWay1.setRect( 0, normal.getY() + normal.height() + GAP, (width - GAP) / 2, BTN_HEIGHT );
add( btnWay1 );

if (way1 != HeroSubClass.LICH){
Expand All @@ -87,10 +92,10 @@ protected void onClick() {
hide();
}
};
btnCancel.setRect( 0, btnWay1.bottom() + GAP, WIDTH, BTN_HEIGHT );
btnCancel.setRect( 0, btnWay1.bottom() + GAP, width, BTN_HEIGHT );
add( btnCancel );

resize( WIDTH, (int)btnCancel.bottom() );
resize( width, (int)btnCancel.bottom() );
}

private void btnBreakSpell(RedButton btnWay1){
Expand Down

0 comments on commit c2898c2

Please sign in to comment.