Resolved #1426 - starting a new game from a file-map game shows new correct options on the new game screen

This commit is contained in:
Yair Morgenstern 2019-12-07 20:31:04 +02:00
parent 440941cdea
commit 9f3a943865
2 changed files with 23 additions and 16 deletions

View file

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

View file

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