From 9f3a9438652edfda41717ed5a2ea50f5e57b910e Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sat, 7 Dec 2019 20:31:04 +0200 Subject: [PATCH] Resolved #1426 - starting a new game from a file-map game shows new correct options on the new game screen --- android/build.gradle | 4 +-- .../NewGameScreenOptionsTable.kt | 35 +++++++++++-------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index b9b46e20..f4cf1953 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,8 +21,8 @@ android { applicationId "com.unciv.app" minSdkVersion 14 targetSdkVersion 29 - versionCode 336 - versionName "3.3.5" + versionCode 337 + versionName "3.3.6" } // Had to add this crap for Travis to build, it wanted to sign the app diff --git a/core/src/com/unciv/ui/newgamescreen/NewGameScreenOptionsTable.kt b/core/src/com/unciv/ui/newgamescreen/NewGameScreenOptionsTable.kt index 4788486b..99e94b23 100644 --- a/core/src/com/unciv/ui/newgamescreen/NewGameScreenOptionsTable.kt +++ b/core/src/com/unciv/ui/newgamescreen/NewGameScreenOptionsTable.kt @@ -98,24 +98,31 @@ class NewGameScreenOptionsTable(val newGameParameters: GameParameters, val rules val worldSizeSelectBox = getWorldSizeSelectBox() val worldSizeLabel = "{World size}:".toLabel() + fun updateOnMapTypeChange(){ + newGameParameters.mapType = mapTypeSelectBox.selected.value + if (newGameParameters.mapType == MapType.file) { + worldSizeSelectBox.isVisible = false + worldSizeLabel.isVisible = false + mapFileSelectBox.isVisible = true + mapFileLabel.isVisible = true + newGameParameters.mapFileName = mapFileSelectBox.selected + } else { + worldSizeSelectBox.isVisible = true + worldSizeLabel.isVisible = true + mapFileSelectBox.isVisible = false + mapFileLabel.isVisible = false + newGameParameters.mapFileName = null + } + } + + updateOnMapTypeChange() // activate once, so when we had a file map before we'll have the right things set for another one + mapTypeSelectBox.addListener(object : ChangeListener() { override fun changed(event: ChangeEvent?, actor: Actor?) { - newGameParameters.mapType = mapTypeSelectBox.selected.value - if (newGameParameters.mapType == MapType.file) { - worldSizeSelectBox.isVisible = false - worldSizeLabel.isVisible = false - mapFileSelectBox.isVisible = true - mapFileLabel.isVisible = true - newGameParameters.mapFileName = mapFileSelectBox.selected - } else { - worldSizeSelectBox.isVisible = true - worldSizeLabel.isVisible = true - mapFileSelectBox.isVisible = false - mapFileLabel.isVisible = false - newGameParameters.mapFileName = null - } + updateOnMapTypeChange() } }) + add(mapTypeSelectBox).pad(10f).row()