diff --git a/forge-gui-mobile/src/forge/adventure/stage/GameHUD.java b/forge-gui-mobile/src/forge/adventure/stage/GameHUD.java index d24d5cc4d77..5efa7f9a3bc 100644 --- a/forge-gui-mobile/src/forge/adventure/stage/GameHUD.java +++ b/forge-gui-mobile/src/forge/adventure/stage/GameHUD.java @@ -8,15 +8,9 @@ import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.math.Vector2; -import com.badlogic.gdx.scenes.scene2d.Action; -import com.badlogic.gdx.scenes.scene2d.Actor; -import com.badlogic.gdx.scenes.scene2d.InputEvent; -import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.scenes.scene2d.*; import com.badlogic.gdx.scenes.scene2d.actions.Actions; -import com.badlogic.gdx.scenes.scene2d.ui.Button; -import com.badlogic.gdx.scenes.scene2d.ui.Dialog; -import com.badlogic.gdx.scenes.scene2d.ui.Image; -import com.badlogic.gdx.scenes.scene2d.ui.Touchpad; +import com.badlogic.gdx.scenes.scene2d.ui.*; import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; @@ -48,20 +42,11 @@ public class GameHUD extends Stage { static public GameHUD instance; private final GameStage gameStage; - private final Image avatar; - private final Image miniMapPlayer; - private final TextraLabel lifePoints; - private final TextraLabel money; - private final TextraLabel shards; + private final Image avatar, miniMapPlayer; + private final TextraLabel lifePoints, money, shards, keys; private final Image miniMap, gamehud, mapborder, avatarborder, blank; - private final InputEvent eventTouchDown; - private final InputEvent eventTouchUp; - private final TextraButton deckActor; - private final TextraButton openMapActor; - private final TextraButton menuActor; - private final TextraButton statsActor; - private final TextraButton inventoryActor; - private final TextraButton exitToWorldMapActor; + private final InputEvent eventTouchDown, eventTouchUp; + private final TextraButton deckActor, openMapActor, menuActor, statsActor, inventoryActor, exitToWorldMapActor; public final UIActor ui; private final Touchpad touchpad; private final Console console; @@ -73,8 +58,10 @@ public class GameHUD extends Stage { private final Dialog dialog; private boolean dialogOnlyInput; private final Array dialogButtonMap = new Array<>(); + private final Array questKeys = new Array<>(); private String lifepointsTextColor = ""; - TextraButton selectedKey; + private TextraButton selectedKey; + private final ScrollPane scrollPane; private GameHUD(GameStage gameStage) { super(new ScalingViewport(Scaling.stretch, Scene.getIntendedWidth(), Scene.getIntendedHeight()), gameStage.getBatch()); @@ -137,6 +124,11 @@ public class GameHUD extends Stage { shards.setText("[%95][+Shards] 0"); money.setText("[%95][+Gold] "); lifePoints.setText("[%95][+Life] 20/20"); + keys = Controls.newTextraLabel(""); + scrollPane = new ScrollPane(keys); + scrollPane.setPosition(2, 2); + scrollPane.setStyle(Controls.getSkin().get("transluscent", ScrollPane.ScrollPaneStyle.class)); + addActor(scrollPane); AdventurePlayer.current().onLifeChange(() -> lifePoints.setText("[%95][+Life]" + lifepointsTextColor + " " + AdventurePlayer.current().getLife() + "/" + AdventurePlayer.current().getMaxLife())); AdventurePlayer.current().onShardsChange(() -> shards.setText("[%95][+Shards] " + AdventurePlayer.current().getShards())); @@ -291,6 +283,7 @@ public class GameHUD extends Stage { Pixmap miniMapToolTipPixmap; public void enter() { + questKeys.clear(); if (miniMapTexture != null) miniMapTexture.dispose(); miniMapTexture = new Texture(WorldSave.getCurrentSave().getWorld().getBiomeImage()); @@ -304,6 +297,28 @@ public class GameHUD extends Stage { miniMap.setDrawable(new TextureRegionDrawable(miniMapTexture)); avatar.setDrawable(new TextureRegionDrawable(Current.player().avatar())); 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; + } if (deck == null || deck.isEmpty() || deck.getMain().toFlatList().size() < 30) { deckActor.setColor(Color.RED); } else { diff --git a/forge-gui/res/adventure/Shandalar/skin/ui_skin.atlas b/forge-gui/res/adventure/Shandalar/skin/ui_skin.atlas index 62959ab3e2e..68915e0c981 100644 --- a/forge-gui/res/adventure/Shandalar/skin/ui_skin.atlas +++ b/forge-gui/res/adventure/Shandalar/skin/ui_skin.atlas @@ -260,6 +260,15 @@ thinwindow orig: 16, 16 offset: 0, 0 index: -1 +transwindow + rotate: false + xy: 305, 415 + size: 16, 16 + split: 2, 2, 2, 2 + pad: 0, 0, 0, 0 + orig: 16, 16 + offset: 0, 0 + index: -1 uncheck rotate: false xy: 293, 375 diff --git a/forge-gui/res/adventure/Shandalar/skin/ui_skin.json b/forge-gui/res/adventure/Shandalar/skin/ui_skin.json index 562c914a4d3..a1a02a7ac15 100644 --- a/forge-gui/res/adventure/Shandalar/skin/ui_skin.json +++ b/forge-gui/res/adventure/Shandalar/skin/ui_skin.json @@ -166,6 +166,26 @@ "playMode": 2, "crushMode": 0 }, + "transwindow10Patch": { + "region": "transwindow", + "horizontalStretchAreas": [ 2, 13 ], + "verticalStretchAreas": [ 2, 13 ], + "tiling": true, + "minWidth": 16, + "minHeight": 16, + "rightWidth": 4, + "leftWidth": 4, + "bottomHeight": 4, + "topHeight": 4, + "offsetX": 0, + "offsetY": 0, + "offsetXspeed": 0, + "offsetYspeed": 0, + "frameDuration": 0.03, + "regions": [], + "playMode": 2, + "crushMode": 0 + }, "pressed10Patch": { "region": "pressed", "horizontalStretchAreas": [ 3, 10 ], @@ -443,6 +463,9 @@ "gold": { "background": "9patch4" }, + "transluscent": { + "background": "transwindow10Patch" + }, "nobg": { "background": "transparent" } @@ -549,6 +572,11 @@ "background": "paper10Patch", "titleFont": "default" }, + "transluscent": { + "parent": "default", + "background": "transwindow10Patch", + "titleFont": "default" + }, "gold": { "background": "TenPatchGold", "titleFont": "default"