mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 19:14:05 +09:00
fix: load menu buttons are pushed when they should not listen to the touchdown event
This commit is contained in:
@@ -14,7 +14,11 @@ import kotlin.io.path.Path
|
|||||||
class SavegameCollection(files0: List<DiskSkimmer>) {
|
class SavegameCollection(files0: List<DiskSkimmer>) {
|
||||||
|
|
||||||
/** Sorted in reverse by the last modified time of the files, index zero being the most recent */
|
/** 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 */
|
/** 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]")) }
|
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 */
|
/** Sorted in reverse by the last modified time of the files, index zero being the most recent */
|
||||||
|
|||||||
@@ -31,7 +31,15 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
"""
|
"""
|
||||||
const val DEFAULT_LOADORDER_FILE = """# Load Order
|
const val DEFAULT_LOADORDER_FILE = """# Load Order
|
||||||
# Modules are loaded from top to bottom.
|
# 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\<username>\AppData\Roaming\Terrarum
|
||||||
|
# macOS -- /Users/<username>/Library/Application Support/Terrarum
|
||||||
|
# Linux -- /home/<username>/.Terrarum
|
||||||
|
# Please refrain from removing 'basegame' on the load order -- it may render the game unpalyable.
|
||||||
|
|
||||||
basegame
|
basegame
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -101,7 +101,11 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() {
|
|||||||
|
|
||||||
private val playerCells = ArrayList<UIItemPlayerCells>()
|
private val playerCells = ArrayList<UIItemPlayerCells>()
|
||||||
|
|
||||||
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 = 0
|
||||||
private val MODE_SELECT_AFTER = 1
|
private val MODE_SELECT_AFTER = 1
|
||||||
@@ -188,6 +192,8 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun advanceMode(button: UIItem) {
|
override fun advanceMode(button: UIItem) {
|
||||||
|
printdbg(this, "advanceMode ${button.javaClass.canonicalName}")
|
||||||
|
|
||||||
mode += 1
|
mode += 1
|
||||||
uiScroll = 0f
|
uiScroll = 0f
|
||||||
scrollFrom = 0
|
scrollFrom = 0
|
||||||
@@ -312,6 +318,8 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() {
|
|||||||
|
|
||||||
MODE_SAVE_MULTIPLE_CHOICES*/
|
MODE_SAVE_MULTIPLE_CHOICES*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printdbg(this, "mode = $mode")
|
||||||
}
|
}
|
||||||
else if (mode == MODE_SAVE_DELETE_CONFIRM) {
|
else if (mode == MODE_SAVE_DELETE_CONFIRM) {
|
||||||
// confirm deletion of selected player
|
// confirm deletion of selected player
|
||||||
@@ -359,6 +367,8 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() {
|
|||||||
playerCells.clear()
|
playerCells.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var touchLatched = false
|
||||||
|
|
||||||
private fun getCells() = playerCells
|
private fun getCells() = playerCells
|
||||||
private var loadFired = 0
|
private var loadFired = 0
|
||||||
private var oldMode = -1
|
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 {
|
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) }
|
printdbg(this, "touchDown mode=$mode")
|
||||||
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_SAVE_MULTIPLE_CHOICES) {
|
||||||
if (mode == MODE_SELECT || mode == MODE_SAVE_DELETE) deleteCharacterButton.touchDown(screenX, screenY, pointer, button)
|
if (::loadAutoThumbButton.isInitialized) loadAutoThumbButton.touchDown(screenX, screenY, pointer, button)
|
||||||
if (mode == MODE_SAVE_DELETE_CONFIRM) {
|
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)
|
confirmCancelButton.touchDown(screenX, screenY, pointer, button)
|
||||||
confirmDeleteButton.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
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
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 (mode == MODE_SAVE_MULTIPLE_CHOICES) {
|
||||||
if (::loadAutoThumbButton.isInitialized && mode == MODE_SAVE_MULTIPLE_CHOICES) { loadAutoThumbButton.touchUp(screenX, screenY, pointer, button) }
|
if (::loadAutoThumbButton.isInitialized) loadAutoThumbButton.touchUp(screenX, screenY, pointer, button)
|
||||||
if (::loadManualThumbButton.isInitialized && mode == MODE_SAVE_MULTIPLE_CHOICES) { loadManualThumbButton.touchUp(screenX, screenY, pointer, button) }
|
if (::loadManualThumbButton.isInitialized) 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) {
|
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)
|
confirmCancelButton.touchUp(screenX, screenY, pointer, button)
|
||||||
confirmDeleteButton.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
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user