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

View File

@@ -674,7 +674,8 @@ public class GameScene extends PixelScene {
public static boolean updateItemDisplays = false;
public static boolean tagsNeedLayout = false;
public static boolean tagDisappeared = false;
public static boolean updateTags = false;
@Override
public synchronized void update() {
@@ -726,7 +727,15 @@ public class GameScene extends PixelScene {
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 ||
tagAction != action.visible ||
tagResume != resume.visible) {
@@ -744,7 +753,7 @@ public class GameScene extends PixelScene {
//if a new tag appears, re-layout tags immediately
//otherwise, wait until the hero acts, so as to not suddenly change their position
if (tagAppearing) layoutTags();
else tagsNeedLayout = true;
else tagDisappeared = true;
}
@@ -774,6 +783,8 @@ public class GameScene extends PixelScene {
public static void layoutTags() {
updateTags = false;
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
@@ -1417,9 +1428,9 @@ public class GameScene extends PixelScene {
QuickSlotButton.cancel();
InventoryPane.cancelTargeting();
if (scene != null && scene.toolbar != null) scene.toolbar.examining = false;
if (tagsNeedLayout) {
layoutTags();
tagsNeedLayout = false;
if (tagDisappeared) {
tagDisappeared = false;
updateTags = true;
}
}

View File

@@ -59,7 +59,7 @@ public class Tag extends Button {
@Override
protected void onClick() {
GameScene.tagsNeedLayout = false;
GameScene.tagDisappeared = false;
}
@Override