diff --git a/src/net/torvald/terrarum/SavegameCollection.kt b/src/net/torvald/terrarum/SavegameCollection.kt index 8d77032a8..cca4b3be0 100644 --- a/src/net/torvald/terrarum/SavegameCollection.kt +++ b/src/net/torvald/terrarum/SavegameCollection.kt @@ -14,7 +14,11 @@ import kotlin.io.path.Path class SavegameCollection(files0: List) { /** Sorted in reverse by the last modified time of the files, index zero being the most recent */ - val files = files0.sortedByDescending { it.getLastModifiedTime().shl(2) or it.diskFile.extension.isBlank().toLong(1) or it.diskFile.extension.matches(Regex("^[abc]${'$'}")).toLong() } + val files = files0.sortedByDescending { + it.getLastModifiedTime().shl(2) or + it.diskFile.extension.matches(Regex("^[abc]${'$'}")).toLong(1) or + it.diskFile.extension.isBlank().toLong(0) + } /** Sorted in reverse by the last modified time of the files, index zero being the most recent */ val autoSaves = files.filter { it.diskFile.extension.matches(Regex("[a-z]")) } /** Sorted in reverse by the last modified time of the files, index zero being the most recent */ diff --git a/src/net/torvald/terrarum/TerrarumAppConfiguration.kt b/src/net/torvald/terrarum/TerrarumAppConfiguration.kt index 35a26da55..870f1fdff 100644 --- a/src/net/torvald/terrarum/TerrarumAppConfiguration.kt +++ b/src/net/torvald/terrarum/TerrarumAppConfiguration.kt @@ -31,7 +31,15 @@ along with this program. If not, see . """ const val DEFAULT_LOADORDER_FILE = """# Load Order # Modules are loaded from top to bottom. -# You can disable basegame, but we don't recommend. +# Name of the module corresponds with the name of the directory the module is stored in, +# typically under: +# 1. assets/mods of the installation path (the modules comes with the release of the game) +# 2. %APPDATA%/Modules (the modules installed by the user) +# where %APPDATA% is: +# Windows -- C:\Users\\AppData\Roaming\Terrarum +# macOS -- /Users//Library/Application Support/Terrarum +# Linux -- /home//.Terrarum +# Please refrain from removing 'basegame' on the load order -- it may render the game unpalyable. basegame """ diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UILoadSavegame.kt b/src/net/torvald/terrarum/modulebasegame/ui/UILoadSavegame.kt index 2a6818626..72d515e8f 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UILoadSavegame.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UILoadSavegame.kt @@ -101,7 +101,11 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { private val playerCells = ArrayList() - var mode = 0; private set// 0: show players, 1: show worlds + var mode = 0 // 0: show players, 1: show worlds + private set(value) { + touchLatched = true + field = value + } private val MODE_SELECT = 0 private val MODE_SELECT_AFTER = 1 @@ -188,6 +192,8 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { } override fun advanceMode(button: UIItem) { + printdbg(this, "advanceMode ${button.javaClass.canonicalName}") + mode += 1 uiScroll = 0f scrollFrom = 0 @@ -312,6 +318,8 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { MODE_SAVE_MULTIPLE_CHOICES*/ } + + printdbg(this, "mode = $mode") } else if (mode == MODE_SAVE_DELETE_CONFIRM) { // confirm deletion of selected player @@ -359,6 +367,8 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { playerCells.clear() } + private var touchLatched = false + private fun getCells() = playerCells private var loadFired = 0 private var oldMode = -1 @@ -605,29 +615,40 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { } override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean { - if (mode == MODE_SELECT || mode == MODE_SAVE_DELETE) getCells().forEach { it.touchDown(screenX, screenY, pointer, button) } - if (::loadAutoThumbButton.isInitialized && mode == MODE_SAVE_MULTIPLE_CHOICES) { loadAutoThumbButton.touchDown(screenX, screenY, pointer, button) } - if (::loadManualThumbButton.isInitialized && mode == MODE_SAVE_MULTIPLE_CHOICES) { loadManualThumbButton.touchDown(screenX, screenY, pointer, button) } - if (mode == MODE_SELECT || mode == MODE_SAVE_DELETE) deleteCharacterButton.touchDown(screenX, screenY, pointer, button) - if (mode == MODE_SAVE_DELETE_CONFIRM) { + printdbg(this, "touchDown mode=$mode") + + if (mode == MODE_SAVE_MULTIPLE_CHOICES) { + if (::loadAutoThumbButton.isInitialized) loadAutoThumbButton.touchDown(screenX, screenY, pointer, button) + if (::loadManualThumbButton.isInitialized) loadManualThumbButton.touchDown(screenX, screenY, pointer, button) + } + else if (mode == MODE_SELECT || mode == MODE_SAVE_DELETE) { + getCells().forEach { it.touchDown(screenX, screenY, pointer, button) } + deleteCharacterButton.touchDown(screenX, screenY, pointer, button) + } + else if (mode == MODE_SAVE_DELETE_CONFIRM) { confirmCancelButton.touchDown(screenX, screenY, pointer, button) confirmDeleteButton.touchDown(screenX, screenY, pointer, button) } - if (mode == MODE_SAVE_DAMAGED) corruptedBackButton.touchDown(screenX, screenY, pointer, button) + else if (mode == MODE_SAVE_DAMAGED) corruptedBackButton.touchDown(screenX, screenY, pointer, button) return true } override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean { - if (mode == MODE_SELECT || mode == MODE_SAVE_DELETE) getCells().forEach { it.touchUp(screenX, screenY, pointer, button) } - if (::loadAutoThumbButton.isInitialized && mode == MODE_SAVE_MULTIPLE_CHOICES) { loadAutoThumbButton.touchUp(screenX, screenY, pointer, button) } - if (::loadManualThumbButton.isInitialized && mode == MODE_SAVE_MULTIPLE_CHOICES) { loadManualThumbButton.touchUp(screenX, screenY, pointer, button) } - if (mode == MODE_SELECT || mode == MODE_SAVE_DELETE) deleteCharacterButton.touchUp(screenX, screenY, pointer, button) - if (mode == MODE_SAVE_DELETE_CONFIRM) { + if (mode == MODE_SAVE_MULTIPLE_CHOICES) { + if (::loadAutoThumbButton.isInitialized) loadAutoThumbButton.touchUp(screenX, screenY, pointer, button) + if (::loadManualThumbButton.isInitialized) loadManualThumbButton.touchUp(screenX, screenY, pointer, button) + } + else if (mode == MODE_SELECT || mode == MODE_SAVE_DELETE) { + getCells().forEach { it.touchUp(screenX, screenY, pointer, button) } + deleteCharacterButton.touchUp(screenX, screenY, pointer, button) + } + else if (mode == MODE_SAVE_DELETE_CONFIRM) { confirmCancelButton.touchUp(screenX, screenY, pointer, button) confirmDeleteButton.touchUp(screenX, screenY, pointer, button) } - if (mode == MODE_SAVE_DAMAGED) corruptedBackButton.touchUp(screenX, screenY, pointer, button) + else if (mode == MODE_SAVE_DAMAGED) corruptedBackButton.touchUp(screenX, screenY, pointer, button) + return true }