diff options
| -rw-r--r-- | assets/MainSpritesheet.skin | 1 | ||||
| -rw-r--r-- | core/src/com/ilotterytea/maxoning/screens/GameScreen.java | 1 | ||||
| -rw-r--r-- | core/src/com/ilotterytea/maxoning/screens/game/shop/ShopUI.java | 38 |
3 files changed, 37 insertions, 3 deletions
diff --git a/assets/MainSpritesheet.skin b/assets/MainSpritesheet.skin index c300997..7306f2b 100644 --- a/assets/MainSpritesheet.skin +++ b/assets/MainSpritesheet.skin @@ -25,6 +25,7 @@ tile_05: { color: { hex: "#222222ff" }, name: tile }, board: { color: { hex: "#00000055" }, name: tile }, + shop_list: { color: {hex: "#dda300ff" }, name: tile }, window: { color: { hex: "#00000055" }, name: bg }, fill_circle: { color: { hex: "#00ff00ff" }, name: circle } diff --git a/core/src/com/ilotterytea/maxoning/screens/GameScreen.java b/core/src/com/ilotterytea/maxoning/screens/GameScreen.java index 5044b67..555e87e 100644 --- a/core/src/com/ilotterytea/maxoning/screens/GameScreen.java +++ b/core/src/com/ilotterytea/maxoning/screens/GameScreen.java @@ -539,6 +539,7 @@ public class GameScreen implements Screen, InputProcessor { shopUI.createSavegameUI(this.player); shopUI.createShopTitleUI(); shopUI.createShopControlUI(); + shopUI.createShopListUI(); } @Override diff --git a/core/src/com/ilotterytea/maxoning/screens/game/shop/ShopUI.java b/core/src/com/ilotterytea/maxoning/screens/game/shop/ShopUI.java index 8cdb2e8..2203ad9 100644 --- a/core/src/com/ilotterytea/maxoning/screens/game/shop/ShopUI.java +++ b/core/src/com/ilotterytea/maxoning/screens/game/shop/ShopUI.java @@ -7,13 +7,19 @@ import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.ui.*; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.badlogic.gdx.utils.Align; +import com.ilotterytea.maxoning.player.MaxonItem; +import com.ilotterytea.maxoning.player.MaxonItemRegister; import com.ilotterytea.maxoning.player.MaxonSavegame; +import com.ilotterytea.maxoning.ui.PurchaseItem; import com.ilotterytea.maxoning.utils.math.Math; +import java.util.ArrayList; + public class ShopUI { private final Stage stage; private final Skin skin; private final TextureAtlas atlas; + private final ArrayList<MaxonItem> items; private ShopMode mode; private ShopMultiplier multiplier; @@ -24,6 +30,7 @@ public class ShopUI { this.atlas = atlas; this.mode = ShopMode.BUY; this.multiplier = ShopMultiplier.X1; + this.items = MaxonItemRegister.getItems(); } public void createSavegameUI(final MaxonSavegame player) { @@ -32,7 +39,6 @@ public class ShopUI { table.setWidth(Math.percentFromValue(25f, Gdx.graphics.getWidth())); table.setHeight(Math.percentFromValue(15f, Gdx.graphics.getHeight())); - table.setX(Gdx.graphics.getWidth() - table.getWidth()); table.align(Align.center | Align.left); table.pad(10f); @@ -67,7 +73,6 @@ public class ShopUI { table.setWidth(Math.percentFromValue(25f, Gdx.graphics.getWidth())); table.setHeight(Math.percentFromValue(5f, Gdx.graphics.getHeight())); - table.setX(Gdx.graphics.getWidth() - table.getWidth()); table.setY(Gdx.graphics.getHeight() - table.getHeight()); table.align(Align.center); table.pad(10f); @@ -84,7 +89,6 @@ public class ShopUI { table.setWidth(Math.percentFromValue(25f, Gdx.graphics.getWidth())); table.setHeight(Math.percentFromValue(10f, Gdx.graphics.getHeight())); - table.setX(Gdx.graphics.getWidth() - table.getWidth()); table.setY(Gdx.graphics.getHeight() - table.getHeight() - Math.percentFromValue(5f, Gdx.graphics.getHeight())); table.align(Align.center); table.pad(10f); @@ -141,4 +145,32 @@ public class ShopUI { this.stage.addActor(table); } + + public void createShopListUI() { + Table table = new Table(); + + table.setWidth(Math.percentFromValue(25f, Gdx.graphics.getWidth())); + table.setHeight(Math.percentFromValue(70f, Gdx.graphics.getHeight())); + table.setY(Math.percentFromValue(15f, Gdx.graphics.getHeight())); + table.align(Align.center); + table.pad(10f); + + for (MaxonItem item : this.items) { + PurchaseItem purchaseItem = new PurchaseItem(this.skin, item); + + table.add(purchaseItem).width(table.getWidth()).padBottom(5f).row(); + } + + ScrollPane scrollPane = new ScrollPane(table); + scrollPane.setScrollingDisabled(true, false); + + Table scrollPaneTable = new Table(this.skin); + scrollPaneTable.setBackground("shop_list"); + scrollPaneTable.setPosition(table.getX(), table.getY()); + scrollPaneTable.setSize(table.getWidth(), table.getHeight()); + scrollPaneTable.pad(1f, 5f, 1f, 5f); + scrollPaneTable.add(scrollPane).grow(); + + this.stage.addActor(scrollPaneTable); + } } |
