v2.2.0: fixed tag layout being called from the actor thread

This commit is contained in:
Evan Debenham
2023-09-17 11:48:58 -04:00
parent 613ee447d4
commit aafd7f445d
2 changed files with 18 additions and 7 deletions
@@ -674,7 +674,8 @@ public class GameScene extends PixelScene {
public static boolean updateItemDisplays = false; public static boolean updateItemDisplays = false;
public static boolean tagsNeedLayout = false; public static boolean tagDisappeared = false;
public static boolean updateTags = false;
@Override @Override
public synchronized void update() { public synchronized void update() {
@@ -726,7 +727,15 @@ public class GameScene extends PixelScene {
log.newLine(); log.newLine();
} }
if (tagAttack != attack.active || if (updateTags){
tagAttack = attack.active;
tagLoot = loot.visible;
tagAction = action.visible;
tagResume = resume.visible;
layoutTags();
} else if (tagAttack != attack.active ||
tagLoot != loot.visible || tagLoot != loot.visible ||
tagAction != action.visible || tagAction != action.visible ||
tagResume != resume.visible) { tagResume != resume.visible) {
@@ -744,7 +753,7 @@ public class GameScene extends PixelScene {
//if a new tag appears, re-layout tags immediately //if a new tag appears, re-layout tags immediately
//otherwise, wait until the hero acts, so as to not suddenly change their position //otherwise, wait until the hero acts, so as to not suddenly change their position
if (tagAppearing) layoutTags(); if (tagAppearing) layoutTags();
else tagsNeedLayout = true; else tagDisappeared = true;
} }
@@ -774,6 +783,8 @@ public class GameScene extends PixelScene {
public static void layoutTags() { public static void layoutTags() {
updateTags = false;
if (scene == null) return; if (scene == null) return;
//move the camera center up a bit if we're on full UI and it is taking up lots of space //move the camera center up a bit if we're on full UI and it is taking up lots of space
@@ -1417,9 +1428,9 @@ public class GameScene extends PixelScene {
QuickSlotButton.cancel(); QuickSlotButton.cancel();
InventoryPane.cancelTargeting(); InventoryPane.cancelTargeting();
if (scene != null && scene.toolbar != null) scene.toolbar.examining = false; if (scene != null && scene.toolbar != null) scene.toolbar.examining = false;
if (tagsNeedLayout) { if (tagDisappeared) {
layoutTags(); tagDisappeared = false;
tagsNeedLayout = false; updateTags = true;
} }
} }
@@ -59,7 +59,7 @@ public class Tag extends Button {
@Override @Override
protected void onClick() { protected void onClick() {
GameScene.tagsNeedLayout = false; GameScene.tagDisappeared = false;
} }
@Override @Override