move key indicators

This commit is contained in:
Anthony Calosa
2024-11-02 11:08:30 +08:00
parent 473a65f9ba
commit 8d9f17fbac
9 changed files with 59 additions and 39 deletions

View File

@@ -39,7 +39,8 @@ public final class Main {
options.setEnvironment(System.getProperty("os.name")); options.setEnvironment(System.getProperty("os.name"));
options.setTag("Java Version", System.getProperty("java.version")); options.setTag("Java Version", System.getProperty("java.version"));
options.setShutdownTimeoutMillis(5000); options.setShutdownTimeoutMillis(5000);
if (options.getDsn() == null) // these belong to sentry.properties, but somehow some OS/Zip tool discards it?
if (options.getDsn() == null || options.getDsn().isEmpty())
options.setDsn("https://87bc8d329e49441895502737c069067b@sentry.cardforge.org//3"); options.setDsn("https://87bc8d329e49441895502737c069067b@sentry.cardforge.org//3");
}, true); }, true);

View File

@@ -219,7 +219,11 @@ public class ConsoleCommandInterpreter {
}); });
registerCommand(new String[]{"give", "item"}, s -> { registerCommand(new String[]{"give", "item"}, s -> {
if (s.length < 1) return "Command needs 1 parameter: Item name."; if (s.length < 1) return "Command needs 1 parameter: Item name.";
if (Current.player().addItem(s[0])) return "Added item " + s[0] + "."; if (Current.player().addItem(s[0])) {
if (s[0].contains("Key"))
GameHUD.getInstance().updateKeys();
return "Added item " + s[0] + ".";
}
return "Cannot find item " + s[0]; return "Cannot find item " + s[0];
}); });
registerCommand(new String[]{"fullHeal"}, s -> { registerCommand(new String[]{"fullHeal"}, s -> {

View File

@@ -68,10 +68,10 @@ public class GameHUD extends Stage {
static public GameHUD instance; static public GameHUD instance;
private final GameStage gameStage; private final GameStage gameStage;
private final Image avatar, miniMapPlayer; private final Image avatar, miniMapPlayer;
private final TypingLabel keyCollection;
private final TypingLabel lifePoints; private final TypingLabel lifePoints;
private final TypingLabel money; private final TypingLabel money;
private final TypingLabel shards; private final TypingLabel shards;
private final TextraLabel keys;
private final TextraLabel notificationText = Controls.newTextraLabel(""); private final TextraLabel notificationText = Controls.newTextraLabel("");
private final Image miniMap, gamehud, mapborder, avatarborder, blank; private final Image miniMap, gamehud, mapborder, avatarborder, blank;
private final InputEvent eventTouchDown, eventTouchUp; private final InputEvent eventTouchDown, eventTouchUp;
@@ -87,9 +87,7 @@ public class GameHUD extends Stage {
private boolean dialogOnlyInput; private boolean dialogOnlyInput;
private final Array<TextraButton> dialogButtonMap = new Array<>(); private final Array<TextraButton> dialogButtonMap = new Array<>();
private final Array<TextraButton> abilityButtonMap = new Array<>(); private final Array<TextraButton> abilityButtonMap = new Array<>();
private final Array<String> questKeys = new Array<>();
private String lifepointsTextColor = ""; private String lifepointsTextColor = "";
private final ScrollPane scrollPane;
private final ScrollPane notificationPane; private final ScrollPane notificationPane;
private final Group mapGroup = new Group(); private final Group mapGroup = new Group();
private final Group hudGroup = new Group(); private final Group hudGroup = new Group();
@@ -153,6 +151,8 @@ public class GameHUD extends Stage {
ui.onButtonPress("deck", this::openDeck); ui.onButtonPress("deck", this::openDeck);
ui.onButtonPress("exittoworldmap", this::exitToWorldMap); ui.onButtonPress("exittoworldmap", this::exitToWorldMap);
ui.onButtonPress("bookmark", this::bookmark); ui.onButtonPress("bookmark", this::bookmark);
keyCollection = ui.findActor("keyCollection");
keyCollection.skipToTheEnd();
lifePoints = ui.findActor("lifePoints"); lifePoints = ui.findActor("lifePoints");
lifePoints.skipToTheEnd(); lifePoints.skipToTheEnd();
shards = ui.findActor("shards"); shards = ui.findActor("shards");
@@ -162,11 +162,6 @@ public class GameHUD extends Stage {
shards.setText("[%95][+Shards]"); shards.setText("[%95][+Shards]");
money.setText("[%95][+Gold]"); money.setText("[%95][+Gold]");
lifePoints.setText("[%95][+Life]"); lifePoints.setText("[%95][+Life]");
keys = Controls.newTextraLabel("");
scrollPane = new ScrollPane(keys);
scrollPane.setPosition(2, 2);
scrollPane.setStyle(Controls.getSkin().get("translucent", ScrollPane.ScrollPaneStyle.class));
addActor(scrollPane);
AdventurePlayer.current().onLifeChange(() -> { AdventurePlayer.current().onLifeChange(() -> {
String effect = "{EMERGE}"; String effect = "{EMERGE}";
String effectEnd = "{ENDEMERGE}"; String effectEnd = "{ENDEMERGE}";
@@ -222,6 +217,7 @@ public class GameHUD extends Stage {
ui.addActor(mapGroup); ui.addActor(mapGroup);
//HUD //HUD
hudGroup.addActor(gamehud); hudGroup.addActor(gamehud);
hudGroup.addActor(keyCollection);
hudGroup.addActor(lifePoints); hudGroup.addActor(lifePoints);
hudGroup.addActor(shards); hudGroup.addActor(shards);
hudGroup.addActor(money); hudGroup.addActor(money);
@@ -361,7 +357,7 @@ public class GameHUD extends Stage {
public boolean fromWorldMap = false; public boolean fromWorldMap = false;
public void enter() { public void enter() {
questKeys.clear(); updateKeys();
if (miniMapTexture != null) if (miniMapTexture != null)
miniMapTexture.dispose(); miniMapTexture.dispose();
miniMapTexture = new Texture(WorldSave.getCurrentSave().getWorld().getBiomeImage()); miniMapTexture = new Texture(WorldSave.getCurrentSave().getWorld().getBiomeImage());
@@ -375,28 +371,6 @@ public class GameHUD extends Stage {
miniMap.setDrawable(new TextureRegionDrawable(miniMapTexture)); miniMap.setDrawable(new TextureRegionDrawable(miniMapTexture));
avatar.setDrawable(new TextureRegionDrawable(Current.player().avatar())); avatar.setDrawable(new TextureRegionDrawable(Current.player().avatar()));
Deck deck = AdventurePlayer.current().getSelectedDeck(); Deck deck = AdventurePlayer.current().getSelectedDeck();
if (AdventurePlayer.current().hasItem("Red Key"))
questKeys.add("[+RedKey]");
if (AdventurePlayer.current().hasItem("Green Key"))
questKeys.add("[+GreenKey]");
if (AdventurePlayer.current().hasItem("Blue Key"))
questKeys.add("[+BlueKey]");
if (AdventurePlayer.current().hasItem("Black Key"))
questKeys.add("[+BlackKey]");
if (AdventurePlayer.current().hasItem("White Key"))
questKeys.add("[+WhiteKey]");
if (AdventurePlayer.current().hasItem("Strange Key"))
questKeys.add("[+StrangeKey]");
if (!questKeys.isEmpty()) {
keys.setText(String.join("\n", questKeys));
scrollPane.setSize(keys.getWidth() + 8, keys.getHeight() + 5);
scrollPane.layout();
keys.layout();
scrollPane.getColor().a = opacity;
} else {
keys.setText("");
scrollPane.getColor().a = 0;
}
switch (GameScene.instance().getAdventurePlayerLocation(false, false)) { switch (GameScene.instance().getAdventurePlayerLocation(false, false)) {
case "capital": case "capital":
@@ -453,6 +427,17 @@ public class GameHUD extends Stage {
avatarGroup.setZIndex(ui.getChildren().size); avatarGroup.setZIndex(ui.getChildren().size);
} }
void updateKeys() {
String keys = "";
keys += AdventurePlayer.current().hasItem("Red Key") ? "[+RedKey]\n" : "[+Dot]\n";
keys += AdventurePlayer.current().hasItem("Green Key") ? "[+GreenKey]\n" : "[+Dot]\n";
keys += AdventurePlayer.current().hasItem("Blue Key") ? "[+BlueKey]\n" : "[+Dot]\n";
keys += AdventurePlayer.current().hasItem("Black Key") ? "[+BlackKey]\n" : "[+Dot]\n";
keys += AdventurePlayer.current().hasItem("White Key") ? "[+WhiteKey]\n" : "[+Dot]\n";
keys += AdventurePlayer.current().hasItem("Strange Key") ? "[+StrangeKey]" : "[+Dot]";
keyCollection.setText(keys);
}
void clearAbility() { void clearAbility() {
for (TextraButton button : abilityButtonMap) { for (TextraButton button : abilityButtonMap) {
button.remove(); button.remove();

View File

@@ -453,6 +453,9 @@ GreenLeaf
GreenLeaf2 GreenLeaf2
xy: 112, 608 xy: 112, 608
size: 16, 16 size: 16, 16
Dot
xy: 464, 48
size: 16, 16
GoldCoin GoldCoin
xy: 464, 63 xy: 464, 63
size: 16, 16 size: 16, 16

Binary file not shown.

Before

Width:  |  Height:  |  Size: 275 KiB

After

Width:  |  Height:  |  Size: 139 KiB

View File

@@ -6,10 +6,10 @@
{ {
"type": "Image", "type": "Image",
"name": "gamehud", "name": "gamehud",
"width": 64, "width": 75,
"height": 104, "height": 104,
"image": "ui/hud_portrait.png", "image": "ui/hud_portrait.png",
"x": 416, "x": 405,
"y": 0 "y": 0
}, },
{ {
@@ -55,6 +55,15 @@
"x": 425, "x": 425,
"y": 10 "y": 10
}, },
{
"type": "TypingLabel",
"name": "keyCollection",
"font": "default",
"width": 75,
"height": 96,
"x": 410,
"y": 5
},
{ {
"type": "TypingLabel", "type": "TypingLabel",
"name": "lifePoints", "name": "lifePoints",

View File

@@ -6,10 +6,10 @@
{ {
"type": "Image", "type": "Image",
"name": "gamehud", "name": "gamehud",
"width": 64, "width": 75,
"height": 104, "height": 104,
"image": "ui/hud_portrait.png", "image": "ui/hud_portrait.png",
"x": 416, "x": 405,
"y": 0 "y": 0
}, },
{ {
@@ -55,6 +55,15 @@
"x": 425, "x": 425,
"y": 10 "y": 10
}, },
{
"type": "TypingLabel",
"name": "keyCollection",
"font": "default",
"width": 75,
"height": 96,
"x": 410,
"y": 5
},
{ {
"type": "TypingLabel", "type": "TypingLabel",
"name": "lifePoints", "name": "lifePoints",

View File

@@ -6,10 +6,10 @@
{ {
"type": "Image", "type": "Image",
"name": "gamehud", "name": "gamehud",
"width": 64, "width": 75,
"height": 104, "height": 104,
"image": "ui/hud_portrait.png", "image": "ui/hud_portrait.png",
"x": 206, "x": 195,
"y": 0 "y": 0
}, },
{ {
@@ -55,6 +55,15 @@
"x": 215, "x": 215,
"y": 10 "y": 10
}, },
{
"type": "TypingLabel",
"name": "keyCollection",
"font": "default",
"width": 75,
"height": 96,
"x": 200,
"y": 5
},
{ {
"type": "TypingLabel", "type": "TypingLabel",
"name": "lifePoints", "name": "lifePoints",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB