v1.2.0: fixed windows from quickslots not appearing over inventory pane

This commit is contained in:
Evan Debenham
2022-02-23 17:54:29 -05:00
parent 7ae61ffe77
commit f339ee1691
3 changed files with 11 additions and 5 deletions

View File

@@ -753,7 +753,7 @@ public class GameScene extends PixelScene {
toDestroy.clear();
}
public static Point lastOffset = null;
private static Point lastOffset = null;
@Override
public synchronized Gizmo erase (Gizmo g) {
@@ -1137,6 +1137,13 @@ public class GameScene extends PixelScene {
}
}
public static void centerNextWndOnInvPane(){
if (scene != null && scene.inventory != null && scene.inventory.visible){
lastOffset = new Point((int)scene.inventory.centerX() - uiCamera.width/2,
(int)scene.inventory.centerY() - uiCamera.height/2);
}
}
public static void updateFog(){
if (scene != null) {
scene.fog.updateFog();

View File

@@ -126,8 +126,7 @@ public class InventoryPane extends Component {
protected void onClick(PointerEvent event) {
if (selector != null && !bg.overlapsScreenPoint((int)event.current.x, (int)event.current.y)){
//any windows opened as a consequence of this should be centered on the inventory
GameScene.lastOffset = new Point((int)InventoryPane.this.centerX() - camera.width/2,
(int)InventoryPane.this.centerY() - camera.height/2);
GameScene.centerNextWndOnInvPane();
selector.onSelect(null);
selector = null;
updateInventory();
@@ -475,8 +474,7 @@ public class InventoryPane extends Component {
}
//any windows opened as a consequence of this button should be centered on the inventory
GameScene.lastOffset = new Point((int)InventoryPane.this.centerX() - camera.width/2,
(int)InventoryPane.this.centerY() - camera.height/2);
GameScene.centerNextWndOnInvPane();
if (selector != null) {
WndBag.ItemSelector activating = selector;
selector = null;

View File

@@ -95,6 +95,7 @@ public class QuickSlotButton extends Button {
} else {
Item item = select(slotNum);
if (Dungeon.hero.belongings.contains(item)) {
GameScene.centerNextWndOnInvPane();
item.execute(Dungeon.hero);
if (item.usesTargeting) {
useTargeting();