diff options
| author | ilotterytea <iltsu@alright.party> | 2024-10-19 16:39:35 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-10-19 16:39:35 +0500 |
| commit | 1251b9d2f18f04a55a702cb96f10a0aeccbda6f7 (patch) | |
| tree | 2977ed830cd74ec9e3d2c4f5c3884291b42b2816 | |
| parent | 281b83e8cae408b8bd7f6cf32e9ca767930996f5 (diff) | |
feat: slots button
| -rw-r--r-- | assets/sprites/gui/widgets.atlas | 20 | ||||
| -rw-r--r-- | assets/sprites/gui/widgets.png | bin | 31819 -> 36352 bytes | |||
| -rw-r--r-- | core/src/kz/ilotterytea/maxon/screens/game/GameScreen.java | 6 | ||||
| -rw-r--r-- | core/src/kz/ilotterytea/maxon/ui/game/QuickActionsTable.kt | 19 |
4 files changed, 25 insertions, 20 deletions
diff --git a/assets/sprites/gui/widgets.atlas b/assets/sprites/gui/widgets.atlas index 026b16b..84d26de 100644 --- a/assets/sprites/gui/widgets.atlas +++ b/assets/sprites/gui/widgets.atlas @@ -2,16 +2,18 @@ widgets.png size:256,256 repeat:none exit -bounds:68,2,64,64 +bounds:64,64,64,64 fullscreen -bounds:83,68,64,64 +bounds:0,0,64,64 +locale_en +bounds:87,192,64,64 +locale_ru +bounds:0,64,64,64 music_off -bounds:2,134,87,64 +bounds:0,192,87,64 music_on -bounds:2,68,79,64 -locale_ru -bounds:91,134,64,64 -locale_en -bounds:2,2,64,64 +bounds:0,128,79,64 +slots +bounds:151,192,64,64 windowed -bounds:157,134,64,64 +bounds:79,128,64,64 diff --git a/assets/sprites/gui/widgets.png b/assets/sprites/gui/widgets.png Binary files differindex f46646e..96221a7 100644 --- a/assets/sprites/gui/widgets.png +++ b/assets/sprites/gui/widgets.png diff --git a/core/src/kz/ilotterytea/maxon/screens/game/GameScreen.java b/core/src/kz/ilotterytea/maxon/screens/game/GameScreen.java index 09e3522..40e7e8e 100644 --- a/core/src/kz/ilotterytea/maxon/screens/game/GameScreen.java +++ b/core/src/kz/ilotterytea/maxon/screens/game/GameScreen.java @@ -31,7 +31,6 @@ import kz.ilotterytea.maxon.player.MaxonItem; import kz.ilotterytea.maxon.player.MaxonItemRegister; import kz.ilotterytea.maxon.player.Savegame; import kz.ilotterytea.maxon.screens.MenuScreen; -import kz.ilotterytea.maxon.screens.SlotsMinigameScreen; import kz.ilotterytea.maxon.screens.game.shop.ShopUI; import kz.ilotterytea.maxon.ui.*; import kz.ilotterytea.maxon.ui.game.QuickActionsTable; @@ -328,11 +327,6 @@ public class GameScreen implements Screen, InputProcessor { @Override public boolean keyDown(int keycode) { - if (Gdx.input.isKeyPressed(Input.Keys.K)) { - game.setScreen(new SlotsMinigameScreen()); - dispose(); - } - if (Gdx.input.isKeyPressed(Input.Keys.ESCAPE)) { savegame.setElapsedTime((System.currentTimeMillis() - playTimestamp) + savegame.getElapsedTime()); savegame.save(); diff --git a/core/src/kz/ilotterytea/maxon/ui/game/QuickActionsTable.kt b/core/src/kz/ilotterytea/maxon/ui/game/QuickActionsTable.kt index c2c1667..64719b6 100644 --- a/core/src/kz/ilotterytea/maxon/ui/game/QuickActionsTable.kt +++ b/core/src/kz/ilotterytea/maxon/ui/game/QuickActionsTable.kt @@ -4,7 +4,6 @@ import com.badlogic.gdx.Gdx import com.badlogic.gdx.audio.Sound import com.badlogic.gdx.graphics.g2d.Batch import com.badlogic.gdx.scenes.scene2d.InputEvent -import com.badlogic.gdx.scenes.scene2d.ui.ImageButton import com.badlogic.gdx.scenes.scene2d.ui.Skin import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.utils.ClickListener @@ -12,15 +11,26 @@ import com.badlogic.gdx.utils.Align import kz.ilotterytea.maxon.MaxonGame import kz.ilotterytea.maxon.player.Savegame import kz.ilotterytea.maxon.screens.MenuScreen +import kz.ilotterytea.maxon.screens.SlotsMinigameScreen import kz.ilotterytea.maxon.ui.ShakingImageButton class QuickActionsTable(skin: Skin) : Table() { init { val game = MaxonGame.getInstance() - val quitButton = ShakingImageButton(skin, "exit") - val clickSound = game.assetManager.get("sfx/ui/click.ogg", Sound::class.java) + val slotsButton = ShakingImageButton(skin, "slots") + slotsButton.addListener(object : ClickListener() { + override fun clicked(event: InputEvent, x: Float, y: Float) { + super.clicked(event, x, y) + clickSound.play() + Savegame.getInstance().save() + game.screen = SlotsMinigameScreen() + } + }) + add(slotsButton).height(64f).width(64f).padRight(8f) + + val quitButton = ShakingImageButton(skin, "exit") quitButton.addListener(object : ClickListener() { override fun clicked(event: InputEvent, x: Float, y: Float) { super.clicked(event, x, y) @@ -29,7 +39,6 @@ class QuickActionsTable(skin: Skin) : Table() { game.screen = MenuScreen() } }) - add(quitButton).height(64f).width(64f) } @@ -37,7 +46,7 @@ class QuickActionsTable(skin: Skin) : Table() { super.draw(batch, parentAlpha) // i'm not sure how much does it affect on performance - setX(Gdx.graphics.width - 36f, Align.left) + setX(Gdx.graphics.width - 36f * 2f, Align.left) setY(Gdx.graphics.height - 36f, Align.top) } }
\ No newline at end of file |
