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() { public static void updateQuickslot() {
QuickSlotButton.refresh(); GameScene.updateItemDisplays = true;
InventoryPane.refresh();
} }
private static final String QUANTITY = "quantity"; private static final String QUANTITY = "quantity";

View File

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

View File

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

View File

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