diff --git a/forge-gui-mobile/src/forge/adventure/scene/UIScene.java b/forge-gui-mobile/src/forge/adventure/scene/UIScene.java index cf6fd2f7799..0c9e8ea4e02 100644 --- a/forge-gui-mobile/src/forge/adventure/scene/UIScene.java +++ b/forge-gui-mobile/src/forge/adventure/scene/UIScene.java @@ -332,6 +332,14 @@ public class UIScene extends Scene { public boolean keyPressed(int keycode) { Selectable selection = getSelected(); + + if (KeyBinding.Use.isPressed(keycode)) { + if (selection != null) { + selection.onPressDown(this); + return true; + } + } + ui.pressDown(keycode); if (stage.getKeyboardFocus() instanceof SelectBox) { SelectBox box = (SelectBox) stage.getKeyboardFocus(); @@ -343,10 +351,11 @@ public class UIScene extends Scene { return false; } } - if (KeyBinding.Use.isPressed(keycode)) { - if (selection != null) - selection.onPressDown(this); + + if (KeyBinding.Back.isPressed(keycode) && selection != null){ + selection.onDeSelect(); + stage.setKeyboardFocus(null); } if (KeyBinding.ScrollUp.isPressed(keycode)) { Actor focus = stage.getScrollFocus(); diff --git a/forge-gui-mobile/src/forge/toolbox/FContainer.java b/forge-gui-mobile/src/forge/toolbox/FContainer.java index b29d38b3916..07d4ef11d21 100644 --- a/forge-gui-mobile/src/forge/toolbox/FContainer.java +++ b/forge-gui-mobile/src/forge/toolbox/FContainer.java @@ -94,8 +94,8 @@ public abstract class FContainer extends FDisplayObject { @Override public void setSize(float width, float height) { - if (getWidth() == width && getHeight() == height) { return; } - + //called with (0,0) when app minimized, if set then causes errors with layouts loaded before restoring focus + if ((getWidth() == width && getHeight() == height) || width == 0.0 || height == 0.0) { return; } super.setSize(width, height); doLayout(width, height); } diff --git a/forge-gui/res/adventure/common/maps/extensions/rename-waypoints-by-ID.js b/forge-gui/res/adventure/common/maps/extensions/rename-waypoints-by-ID.js new file mode 100644 index 00000000000..2d1235102d6 --- /dev/null +++ b/forge-gui/res/adventure/common/maps/extensions/rename-waypoints-by-ID.js @@ -0,0 +1,61 @@ +/// + +/* + * rename-waypoints-by-ID.js + * Created by TabletopGeneral for Forge Adventure Mode + * + * This extension adds a 'Rename waypoints by ID' (Ctrl+Shift+R) action to the Map + * menu, useful to visually identify points for mob navigation + * Based on https://github.com/justdaft/tiled-scripts/blob/main/rename-object-by-type.js + * + */ + +/* global tiled */ + +function doRenameWaypoints(thing) { + let count = 0; + for (let i = thing.layerCount - 1; i >= 0; i--) { + const layer = thing.layerAt(i); + + if (layer.isGroupLayer) { + const obj = doRenameWaypoints(layer, "waypoint"); + if (obj) { + count = count + obj; + } + } else if (layer.isObjectLayer) { + for (const obj of layer.objects) { + + if (obj.name == "waypoint") { + obj.name = obj.id; + count++; + } + } + } + } + + return count; +} + + +let renameWaypoints = tiled.registerAction("renameWaypoints", function(/* action */) { + const map = tiled.activeAsset; + if (!map.isTileMap) { + tiled.alert("Not a tile map!"); + return; + } + + + const count = doRenameWaypoints(map); + + tiled.alert("Renamed " + count + " waypoints"); + +}); + + +renameWaypoints.text = "Rename waypoints by ID"; +renameWaypoints.shortcut = "Ctrl+Shift+R"; + +tiled.extendMenu("Map", [ + { separator: true }, + { action: "renameWaypoints" }, +]); \ No newline at end of file diff --git a/forge-gui/res/adventure/common/maps/obj/enemy.tx b/forge-gui/res/adventure/common/maps/obj/enemy.tx index 38b20dfa6bb..070f8901781 100644 --- a/forge-gui/res/adventure/common/maps/obj/enemy.tx +++ b/forge-gui/res/adventure/common/maps/obj/enemy.tx @@ -10,7 +10,9 @@ + + diff --git a/forge-gui/res/adventure/common/maps/obj/entry_down.tx b/forge-gui/res/adventure/common/maps/obj/entry_down.tx index d408f3feae9..7772836b65c 100644 --- a/forge-gui/res/adventure/common/maps/obj/entry_down.tx +++ b/forge-gui/res/adventure/common/maps/obj/entry_down.tx @@ -5,6 +5,7 @@ + diff --git a/forge-gui/res/adventure/common/maps/obj/entry_left.tx b/forge-gui/res/adventure/common/maps/obj/entry_left.tx index 2a671a6dc88..8dc59f7584d 100644 --- a/forge-gui/res/adventure/common/maps/obj/entry_left.tx +++ b/forge-gui/res/adventure/common/maps/obj/entry_left.tx @@ -5,6 +5,7 @@ + diff --git a/forge-gui/res/adventure/common/maps/obj/entry_right.tx b/forge-gui/res/adventure/common/maps/obj/entry_right.tx index 83dc17f4c5d..cfbcd3f402b 100644 --- a/forge-gui/res/adventure/common/maps/obj/entry_right.tx +++ b/forge-gui/res/adventure/common/maps/obj/entry_right.tx @@ -5,6 +5,7 @@ + diff --git a/forge-gui/res/adventure/common/maps/obj/entry_up.tx b/forge-gui/res/adventure/common/maps/obj/entry_up.tx index a6cac56e68a..61c155891eb 100644 --- a/forge-gui/res/adventure/common/maps/obj/entry_up.tx +++ b/forge-gui/res/adventure/common/maps/obj/entry_up.tx @@ -5,6 +5,7 @@ + diff --git a/forge-gui/res/adventure/common/maps/tileset/dungeon-nocollide.tsx b/forge-gui/res/adventure/common/maps/tileset/dungeon-nocollide.tsx new file mode 100644 index 00000000000..58b30914711 --- /dev/null +++ b/forge-gui/res/adventure/common/maps/tileset/dungeon-nocollide.tsx @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/forge-gui/res/adventure/common/maps/tileset/dungeon.png b/forge-gui/res/adventure/common/maps/tileset/dungeon.png index 2ad25447304..0fc781ea8e2 100644 Binary files a/forge-gui/res/adventure/common/maps/tileset/dungeon.png and b/forge-gui/res/adventure/common/maps/tileset/dungeon.png differ diff --git a/forge-gui/res/adventure/common/maps/tileset/dungeon.tsx b/forge-gui/res/adventure/common/maps/tileset/dungeon.tsx index 594cbd3219a..7aeaa02830c 100644 --- a/forge-gui/res/adventure/common/maps/tileset/dungeon.tsx +++ b/forge-gui/res/adventure/common/maps/tileset/dungeon.tsx @@ -1,4 +1,1018 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/forge-gui/res/adventure/common/maps/tileset/main.tsx b/forge-gui/res/adventure/common/maps/tileset/main.tsx index 67c8c6de43f..dfa6eeb7899 100644 --- a/forge-gui/res/adventure/common/maps/tileset/main.tsx +++ b/forge-gui/res/adventure/common/maps/tileset/main.tsx @@ -104,12 +104,12 @@ - + - + @@ -5488,6 +5488,16 @@ + + + + + + + + + + @@ -5763,6 +5773,16 @@ + + + + + + + + + + @@ -9036,6 +9056,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -9262,6 +9302,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -9507,6 +9567,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -9774,6 +9854,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -10024,6 +10124,16 @@ + + + + + + + + + + @@ -10146,6 +10256,16 @@ + + + + + + + + + + @@ -10275,6 +10395,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -10381,6 +10568,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -10456,6 +10663,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -10486,6 +10713,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -10496,6 +10773,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -10523,6 +10865,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -10553,6 +10915,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -10573,6 +10975,16 @@ + + + + + + + + + + @@ -10590,6 +11002,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -10645,6 +11097,16 @@ + + + + + + + + + + @@ -10691,6 +11153,16 @@ + + + + + + + + + + @@ -10741,6 +11213,16 @@ + + + + + + + + + + @@ -11001,6 +11483,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -11011,6 +11528,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -11021,6 +11573,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -11924,20 +12622,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/forge-gui/res/adventure/common/maps/tileset/rivers.tsx b/forge-gui/res/adventure/common/maps/tileset/rivers.tsx index b72902e34b3..345dca600ff 100644 --- a/forge-gui/res/adventure/common/maps/tileset/rivers.tsx +++ b/forge-gui/res/adventure/common/maps/tileset/rivers.tsx @@ -2521,6 +2521,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2977,6 +3007,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3129,6 +3199,198 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +