diff options
| author | ilotterytea <iltsu@alright.party> | 2022-12-08 20:53:06 +0600 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2022-12-08 20:53:06 +0600 |
| commit | 1fe0288f20b16555a481e39cb212bb57983b2400 (patch) | |
| tree | 41ecf651d5eca5189802a6e8a77f715130659cf8 /core | |
| parent | d2541b07cec3e47f58ae4200f73a71dc5ae8dfde (diff) | |
Savegame info widget
Diffstat (limited to 'core')
| -rw-r--r-- | core/src/com/ilotterytea/maxoning/ui/SavegameInfo.kt | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/core/src/com/ilotterytea/maxoning/ui/SavegameInfo.kt b/core/src/com/ilotterytea/maxoning/ui/SavegameInfo.kt new file mode 100644 index 0000000..df4936d --- /dev/null +++ b/core/src/com/ilotterytea/maxoning/ui/SavegameInfo.kt @@ -0,0 +1,90 @@ +package com.ilotterytea.maxoning.ui + +import com.badlogic.gdx.scenes.scene2d.InputEvent +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.MaxonGame +import com.ilotterytea.maxoning.player.MaxonSavegame +import com.ilotterytea.maxoning.screens.GameScreen +import com.ilotterytea.maxoning.utils.formatters.NumberFormatter + +/** + * Savegame information widget. + * @since 1.3 + * @author ilotterytea + */ +class SavegameInfo( + game: MaxonGame, + skin: Skin, + sav: MaxonSavegame, + savId: Int +) : Table(skin) { + init { + this.setBackground("bg") + this.width = 512f + this.height = 324f + this.align(Align.top) + + val title = Label("Save $savId (${sav.name})", skin, "with_background") + this.add(title).width(506f).pad(6f).row() + + val content = Table() + content.align(Align.top) + this.add(content).width(506f).maxWidth(506f).pad(6f).expandY().row() + + // - - - P O I N T S - - - : + // Label for points: + val pointsLabel = Label("Points", skin) + content.add(pointsLabel).width(246f).pad(4f) + // Label for points count: + val pointsCLabel = Label(NumberFormatter.format(sav.points.toLong()), skin) + pointsCLabel.setAlignment(Align.right) + content.add(pointsCLabel).width(246f).pad(4f).row() + + // - - - M U L T I P L I E R - - - : + // Label for multiplier: + val mpLabel = Label("Multiplier", skin) + content.add(mpLabel).width(246f).pad(4f) + // Label for multiplier count: + val mpCLabel = Label("+${NumberFormatter.format(sav.multiplier.toLong())}/click", skin) + mpCLabel.setAlignment(Align.right) + content.add(mpCLabel).width(246f).pad(4f).row() + + // - - - P U R C H A S E D I T E M S - - - : + // Label for purchased items: + val piLabel = Label("Inventory size", skin) + content.add(piLabel).width(246f).pad(4f) + // Label for purchased items count: + val piCLabel = Label(sav.inv.size.toString(), skin) + piCLabel.setAlignment(Align.right) + content.add(piCLabel).width(246f).pad(4f).row() + + // - - - A C T I O N S - - - : + val actions = Table() + this.add(actions).width(508f).row() + + // Deletion button: + val delButton = ImageButton(skin, "delete") + + delButton.addListener(object : ClickListener() { + override fun clicked(event: InputEvent?, x: Float, y: Float) { + super.clicked(event, x, y) + } + }) + + actions.add(delButton).pad(4f) + // Play button: + val playButton = TextButton("Play!", skin) + + playButton.addListener(object : ClickListener() { + override fun clicked(event: InputEvent, x: Float, y: Float) { + game.screen = GameScreen(game, sav, savId) + } + }) + + actions.add(playButton).width(444f) + + + } +}
\ No newline at end of file |
