diff options
Diffstat (limited to 'core/src/com/ilotterytea/maxoning/screens')
| -rw-r--r-- | core/src/com/ilotterytea/maxoning/screens/GameScreen.java | 31 | ||||
| -rw-r--r-- | core/src/com/ilotterytea/maxoning/screens/MenuScreen.java | 13 |
2 files changed, 17 insertions, 27 deletions
diff --git a/core/src/com/ilotterytea/maxoning/screens/GameScreen.java b/core/src/com/ilotterytea/maxoning/screens/GameScreen.java index 263f282..9c6f08a 100644 --- a/core/src/com/ilotterytea/maxoning/screens/GameScreen.java +++ b/core/src/com/ilotterytea/maxoning/screens/GameScreen.java @@ -36,7 +36,9 @@ public class GameScreen implements Screen, InputProcessor { MaxonPlayer player; Stage stage; - Skin skin; + Skin skin, widgetSkin; + + TextureAtlas widgetAtlas, environmentAtlas; Label pointsLabel; Image blackBg, inventoryBg, shopBg, pointsBg; @@ -46,10 +48,6 @@ public class GameScreen implements Screen, InputProcessor { Table petTable, inventoryTable, mainTable; ScrollPane petScroll; - NinePatch btnUp, btnDown, btnOver, btnDisabled; - - Texture bgTile, bgTileAlt; - ArrayList<MaxonItem> items; Map<Integer, Integer> invItems; @@ -66,13 +64,10 @@ public class GameScreen implements Screen, InputProcessor { // Initializing the stage and skin: stage = new Stage(new FillViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight())); skin = new Skin(Gdx.files.internal("main.skin")); + widgetSkin = new Skin(Gdx.files.internal("sprites/gui/widgets.skin")); - // Ninepatch textures for buttons: - btnUp = new NinePatch(game.assetManager.get("sprites/ui/sqrbutton.png", Texture.class), 8, 8, 8, 8); - btnDown = new NinePatch(game.assetManager.get("sprites/ui/sqrbutton_down.png", Texture.class), 8, 8, 8, 8); - btnOver = new NinePatch(game.assetManager.get("sprites/ui/sqrbutton_over.png", Texture.class), 8, 8, 8, 8); - btnDisabled = new NinePatch(game.assetManager.get("sprites/ui/sqrbutton_disabled.png", Texture.class), 8, 8, 8, 8); - + widgetAtlas = game.assetManager.get("sprites/gui/widgets.atlas", TextureAtlas.class); + environmentAtlas = game.assetManager.get("sprites/env/environment.atlas", TextureAtlas.class); items = new ArrayList<>(); @@ -87,7 +82,7 @@ public class GameScreen implements Screen, InputProcessor { stage.addActor(blackBg); // Setting the background for inventory: - inventoryBg = new Image(btnDisabled); + inventoryBg = new Image(widgetSkin, "button_disabled"); inventoryBg.setSize((Gdx.graphics.getWidth() / 2.0f) - 512f, (Gdx.graphics.getHeight() / 2.0f) - 8f); inventoryBg.setPosition(8, 4); stage.addActor(inventoryBg); @@ -104,12 +99,6 @@ public class GameScreen implements Screen, InputProcessor { inventoryTable.setSize(inventoryBg.getWidth(), inventoryBg.getHeight() - inventoryLabel.getHeight()); inventoryTable.setPosition(inventoryBg.getX(), inventoryBg.getY()); - TextTooltip.TextTooltipStyle textTooltipStyle = new TextTooltip.TextTooltipStyle(); - textTooltipStyle.label = new Label.LabelStyle(); - textTooltipStyle.label.font = skin.getFont("default"); - textTooltipStyle.label.fontColor = skin.getColor("white"); - textTooltipStyle.background = new NinePatchDrawable(btnUp); - invItems = new HashMap<>(); for (Integer id : player.purchasedItems) { @@ -135,7 +124,7 @@ public class GameScreen implements Screen, InputProcessor { stage.addActor(inventoryTable); // Setting the background for pet shop: - shopBg = new Image(btnDisabled); + shopBg = new Image(widgetSkin, "button_disabled"); shopBg.setSize((Gdx.graphics.getWidth() / 2.0f) - 512f, (Gdx.graphics.getHeight() / 2.0f) - 8f); shopBg.setPosition(8, inventoryBg.getY() + inventoryBg.getHeight() + 8f); stage.addActor(shopBg); @@ -153,7 +142,7 @@ public class GameScreen implements Screen, InputProcessor { // Adding the pet items in pet table: for (final MaxonItem item : MaxonItemRegister.getItems()) { PurchaseItem purchaseItem = new PurchaseItem( - skin, btnUp, item.icon, item.name, item.desc, item.price + skin, widgetSkin, item.icon, item.name, item.desc, item.price ); purchaseItem.addListener(new ClickListener() { @@ -202,7 +191,7 @@ public class GameScreen implements Screen, InputProcessor { stage.addActor(petScroll); // Background for points label: - pointsBg = new Image(btnDisabled); + pointsBg = new Image(widgetSkin, "button_disabled"); pointsBg.setSize((Gdx.graphics.getWidth() - (shopBg.getX() + shopBg.getWidth()) - 8f), 64f); pointsBg.setPosition(shopBg.getX() + shopBg.getWidth() + 4f, Gdx.graphics.getHeight() - pointsBg.getHeight() - 4f); diff --git a/core/src/com/ilotterytea/maxoning/screens/MenuScreen.java b/core/src/com/ilotterytea/maxoning/screens/MenuScreen.java index 7acdf66..f1d63df 100644 --- a/core/src/com/ilotterytea/maxoning/screens/MenuScreen.java +++ b/core/src/com/ilotterytea/maxoning/screens/MenuScreen.java @@ -26,12 +26,12 @@ public class MenuScreen implements Screen, InputProcessor { final MaxonGame game; final Stage stage; - final Skin skin; + final Skin skin, widgetSkin; Image brandLogo, blackBg; Label startLabel, infoLabel; - NinepatchButton singlePlayerButton, optionsButton, quitButton; + TextButton singlePlayerButton, optionsButton, quitButton; final Music menuMusic; Table menuTable, optionsTable; @@ -69,6 +69,7 @@ public class MenuScreen implements Screen, InputProcessor { this.stage = new Stage(new FillViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight())); this.skin = new Skin(Gdx.files.internal("main.skin")); + this.widgetSkin = new Skin(Gdx.files.internal("sprites/gui/widgets.skin")); this.menuMusic = game.assetManager.get("mus/menu/mus_menu_loop.ogg", Music.class); @@ -81,9 +82,9 @@ public class MenuScreen implements Screen, InputProcessor { // Menu Buttons: menuTable = new Table(); - singlePlayerButton = new NinepatchButton(buttonUp, buttonDown, buttonOver, game.locale.TranslatableText("menu.playGame"), skin, "default"); - optionsButton = new NinepatchButton(buttonUp, buttonDown, buttonOver, game.locale.TranslatableText("menu.options"), skin, "default"); - quitButton = new NinepatchButton(buttonUp, buttonDown, buttonOver, game.locale.TranslatableText("menu.quit"), skin, "default"); + singlePlayerButton = new TextButton(game.locale.TranslatableText("menu.playGame"), widgetSkin, "default"); + optionsButton = new TextButton(game.locale.TranslatableText("menu.options"), widgetSkin, "default"); + quitButton = new TextButton(game.locale.TranslatableText("menu.quit"), widgetSkin, "default"); singlePlayerButton.addListener(new ClickListener() { @Override @@ -137,7 +138,7 @@ public class MenuScreen implements Screen, InputProcessor { blackBg.addAction(Actions.alpha(0.25f)); // Options table: - optionsTable = new OptionsTable(game, skin, buttonUp, buttonDown, buttonOver, menuMusic, menuTable, blackBg, brandLogo); + optionsTable = new OptionsTable(game, skin, widgetSkin, menuMusic, menuTable, blackBg, brandLogo); stage.addActor(blackBg); stage.addActor(infoLabel); |
