game save ui completely locked while saving in progress

This commit is contained in:
minjaesong
2021-09-15 11:34:13 +09:00
parent 22190be6d8
commit ae29f7ebea
7 changed files with 33 additions and 14 deletions

View File

@@ -84,11 +84,14 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
0 -> {
screen = 3; gameMenuButtons.deselect()
full.handler.lockToggle()
full.lockTransition()
// save the game
WriteSavegame(Terrarum.ingame!!.savegameArchive, File(App.defaultSaveDir, "${App.getTIME_T()}"), Terrarum.ingame!! as TerrarumIngame) {
// callback:
System.gc()
screen = 0
full.handler.unlockToggle()
full.unlockTransition()
}
}
4 -> {

View File

@@ -138,6 +138,15 @@ class UIInventoryFull(
"$gamepadLabelStart ${Lang["GAME_ACTION_CLOSE"]}$SP" +
"$gamepadLabelLT ${Lang["GAME_INVENTORY"]}"
private var panelTransitionLocked = false
fun lockTransition() {
panelTransitionLocked = true
}
fun unlockTransition() {
panelTransitionLocked = false
}
val catBar = UIItemInventoryCatBar(
this,
(App.scr.width - catBarWidth) / 2,
@@ -145,7 +154,7 @@ class UIInventoryFull(
internalWidth,
catBarWidth,
true,
{ i -> requestTransition(i) }
{ i -> if (!panelTransitionLocked) requestTransition(i) }
)
@@ -167,9 +176,11 @@ class UIInventoryFull(
addUIitem(catBar)
addUIitem(transitionPanel)
catBar.selectionChangeListener = { old, new ->
rebuildList()
transitionalItemCells.resetStatusAsCatChanges(old, new)
catBar.selectionChangeListener = { old, new ->
if (!panelTransitionLocked) {
rebuildList()
transitionalItemCells.resetStatusAsCatChanges(old, new)
}
}
@@ -190,7 +201,7 @@ class UIInventoryFull(
rebuildList()
}
catBar.update(delta)
if (!panelTransitionLocked) catBar.update(delta)
transitionPanel.update(delta)
}