diff options
Diffstat (limited to 'core/src/kz/ilotterytea/maxon/ui')
| -rw-r--r-- | core/src/kz/ilotterytea/maxon/ui/game/QuickActionsTable.kt | 19 |
1 files changed, 14 insertions, 5 deletions
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 |
