damaged savegame is handled by the management scr

This commit is contained in:
minjaesong
2023-07-08 18:49:56 +09:00
parent 211f936bd3
commit 325e67f999
3 changed files with 26 additions and 12 deletions

View File

@@ -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 {

View File

@@ -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<UIItemTextButton>
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

View File

@@ -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) }