From 325e67f999fd43d720b293428f5472b941380cb7 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Sat, 8 Jul 2023 18:49:56 +0900 Subject: [PATCH] damaged savegame is handled by the management scr --- .../terrarum/modulebasegame/ui/UILoadList.kt | 3 +- .../modulebasegame/ui/UILoadManage.kt | 29 ++++++++++++++----- .../modulebasegame/ui/UILoadSavegame.kt | 6 ++-- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UILoadList.kt b/src/net/torvald/terrarum/modulebasegame/ui/UILoadList.kt index f62abf6ad..d81dbc0b9 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UILoadList.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UILoadList.kt @@ -80,7 +80,8 @@ class UILoadList(val full: UILoadSavegame) : UICanvas() { } else if (!full.loadables.saveAvaliable()) { // show save is damaged and cannot be loaded - full.queueUpDamagedSaveScr() +// full.queueUpDamagedSaveScr() + full.queueUpManageScr() // management screen will take care of damaged saves full.takeAutosaveSelectorDown() } else { diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UILoadManage.kt b/src/net/torvald/terrarum/modulebasegame/ui/UILoadManage.kt index 32d3d1068..10093f7db 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UILoadManage.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UILoadManage.kt @@ -36,23 +36,32 @@ class UILoadManage(val full: UILoadSavegame) : UICanvas() { private val buttonRowY = drawY + 480 - buttonHeight private val buttonRowY2 = buttonRowY - buttonHeight - buttonGap - private val mainGoButton = UIItemTextButton(this, "MENU_IO_LOAD_GAME", buttonX1third, buttonRowY2, buttonWidth * 3 + buttonGap * 2, true, alignment = UIItemTextButton.Companion.Alignment.CENTRE, hasBorder = true).also { + private val mainGoButton = UIItemTextButton(this, "MENU_IO_LOAD_GAME", buttonX1third, buttonRowY, buttonWidth * 3 + buttonGap * 2, true, alignment = UIItemTextButton.Companion.Alignment.CENTRE, hasBorder = true).also { } - private val mainReturnButton = UIItemTextButton(this, "MENU_LABEL_RETURN", buttonX1third, buttonRowY, buttonWidth, true, alignment = UIItemTextButton.Companion.Alignment.CENTRE, hasBorder = true).also { + private val mainNoGoButton = UIItemTextButton(this, "ERROR_SAVE_CORRUPTED", buttonX1third, buttonRowY, buttonWidth * 3 + buttonGap * 2, true, alignment = UIItemTextButton.Companion.Alignment.CENTRE, hasBorder = true).also { + it.isEnabled = false + } + private val mainReturnButton = UIItemTextButton(this, "MENU_LABEL_BACK", buttonX1third, buttonRowY2, buttonWidth, true, alignment = UIItemTextButton.Companion.Alignment.CENTRE, hasBorder = true).also { it.clickOnceListener = { _,_ -> full.changePanelTo(0) } } - private val mainRenameButton = UIItemTextButton(this, "MENU_LABEL_RENAME", buttonXcentre, buttonRowY, buttonWidth, true, alignment = UIItemTextButton.Companion.Alignment.CENTRE, hasBorder = true).also { - + private val mainRenameButton = UIItemTextButton(this, "MENU_LABEL_RENAME", buttonXcentre, buttonRowY2, buttonWidth, true, alignment = UIItemTextButton.Companion.Alignment.CENTRE, hasBorder = true).also { + it.clickOnceListener = { _,_ -> + mode = MODE_RENAME + } } - private val mainDeleteButton = UIItemTextButton(this, "CONTEXT_CHARACTER_DELETE", buttonX3third, buttonRowY, buttonWidth, true, alignment = UIItemTextButton.Companion.Alignment.CENTRE, hasBorder = true, inactiveCol = Toolkit.Theme.COL_RED, activeCol = Toolkit.Theme.COL_REDD).also { - + private val mainDeleteButton = UIItemTextButton(this, "CONTEXT_CHARACTER_DELETE", buttonX3third, buttonRowY2, buttonWidth, true, alignment = UIItemTextButton.Companion.Alignment.CENTRE, hasBorder = true, inactiveCol = Toolkit.Theme.COL_RED, activeCol = Toolkit.Theme.COL_REDD).also { + it.clickOnceListener = { _,_ -> + mode = MODE_DELETE + } } private val confirmCancelButton = UIItemTextButton(this, "MENU_LABEL_CANCEL", buttonXleft, buttonRowY, buttonWidth, true, alignment = UIItemTextButton.Companion.Alignment.CENTRE, hasBorder = true).also { - it.clickOnceListener = { _,_ -> full.remoCon.openUI(UILoadSavegame(full.remoCon)) } + it.clickOnceListener = { _,_ -> + mode = MODE_INIT + } } private val confirmDeleteButton = UIItemTextButton(this, "MENU_LABEL_DELETE", buttonXright, buttonRowY, buttonWidth, true, alignment = UIItemTextButton.Companion.Alignment.CENTRE, hasBorder = true, inactiveCol = Toolkit.Theme.COL_RED, activeCol = Toolkit.Theme.COL_REDD).also { it.clickOnceListener = { _,_ -> @@ -70,9 +79,13 @@ class UILoadManage(val full: UILoadSavegame) : UICanvas() { private var mode = 0 - private var mainButtons = listOf(mainGoButton, mainReturnButton, mainRenameButton, mainDeleteButton) + private var mainButtons0 = listOf(mainGoButton, mainReturnButton, mainRenameButton, mainDeleteButton) + private var mainButtons1 = listOf(mainNoGoButton, mainReturnButton, mainRenameButton, mainDeleteButton) private var delButtons = listOf(confirmCancelButton, confirmDeleteButton) + private val mainButtons: List + get() = if (full.loadables.saveAvaliable()) mainButtons0 else mainButtons1 + private val MODE_INIT = 0 private val MODE_DELETE = 16 // are you sure? private val MODE_RENAME = 32 // show rename dialogue diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UILoadSavegame.kt b/src/net/torvald/terrarum/modulebasegame/ui/UILoadSavegame.kt index ec6fb0bfa..26b27e89e 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UILoadSavegame.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UILoadSavegame.kt @@ -95,7 +95,7 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { private val transitionalAutosave = UILoadAutosave(this) private val transitionalManage = UILoadManage(this) private val transitionalNewCharacter = UINewCharacter(remoCon) - private val transitionalSaveDamaged = UILoadSaveDamaged(this) +// private val transitionalSaveDamaged = UILoadSaveDamaged(this) private val transitionPanel = UIItemHorizontalFadeSlide( this, (width - internalWidth) / 2, @@ -104,13 +104,13 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { App.scr.height, 0f, listOf(transitionalListing), - listOf(transitionalManage, transitionalNewCharacter, transitionalSaveDamaged), + listOf(transitionalManage, transitionalNewCharacter), listOf(NullUI, transitionalAutosave) ) internal fun queueUpManageScr() { transitionPanel.setCentreUIto(0) } internal fun queueUpNewCharScr() { transitionPanel.setCentreUIto(1) } - internal fun queueUpDamagedSaveScr() { transitionPanel.setCentreUIto(2) } +// internal fun queueUpDamagedSaveScr() { transitionPanel.setCentreUIto(2) } internal fun bringAutosaveSelectorUp() { transitionPanel.setRightUIto(1) } internal fun takeAutosaveSelectorDown() { transitionPanel.setRightUIto(0) }