v1.2.0: fixed various issues caused by new inventory pane

This commit is contained in:
Evan Debenham 2022-02-04 14:31:08 -05:00
parent 41dc5c90af
commit dfdd0648de
5 changed files with 26 additions and 5 deletions

View File

@ -490,8 +490,7 @@ public class Item implements Bundlable {
}
public static void updateQuickslot() {
QuickSlotButton.refresh();
InventoryPane.refresh();
GameScene.updateItemDisplays = true;
}
private static final String QUANTITY = "quantity";

View File

@ -143,7 +143,7 @@ public class CellSelector extends ScrollArea {
}
public void select( int cell ) {
if (enabled && Dungeon.hero.ready && !GameScene.isShowingWindow()
if (enabled && Dungeon.hero.ready && !GameScene.InterfaceBlockingHero()
&& listener != null && cell != -1) {
listener.onSelect( cell );

View File

@ -664,11 +664,19 @@ public class GameScene extends PixelScene {
//the actor thread processes at a maximum of 60 times a second
//this caps the speed of resting for higher refresh rate displays
private float notifyDelay = 1/60f;
public static boolean updateItemDisplays = false;
@Override
public synchronized void update() {
lastOffset = null;
if (updateItemDisplays){
updateItemDisplays = false;
QuickSlotButton.refresh();
InventoryPane.refresh();
}
if (Dungeon.hero == null || scene == null) {
return;
}
@ -1084,13 +1092,17 @@ public class GameScene extends PixelScene {
}
}
public static boolean isShowingWindow(){
public static boolean InterfaceBlockingHero(){
if (scene == null) return false;
for (Gizmo g : scene.members){
if (g instanceof Window) return true;
}
if (scene.inventory != null && scene.inventory.isSelecting()){
return true;
}
return false;
}

View File

@ -348,6 +348,10 @@ public class InventoryPane extends Component {
updateInventory();
}
public boolean isSelecting(){
return selector != null;
}
@Override
public synchronized void update() {
super.update();

View File

@ -42,11 +42,15 @@ public class WndTradeItem extends WndInfoItem {
private WndBag owner;
private boolean selling = false;
//selling
public WndTradeItem( final Item item, WndBag owner ) {
super(item);
selling = true;
this.owner = owner;
float pos = height;
@ -102,6 +106,8 @@ public class WndTradeItem extends WndInfoItem {
super(heap);
selling = false;
Item item = heap.peek();
float pos = height;
@ -167,7 +173,7 @@ public class WndTradeItem extends WndInfoItem {
if (owner != null) {
owner.hide();
}
Shopkeeper.sell();
if (selling) Shopkeeper.sell();
}
public static void sell( Item item ) {