Few UI fixes (#3070)
* Fixed close button in LoadMapScreen setDefaultCloseAction(MainMenuScreen()) * Fixed mapFileSelectBox in MapOptionsTable first map will be properly selected upon creation of mapFileSelectBox
This commit is contained in:
parent
91ad769eb2
commit
0570f0a974
2 changed files with 5 additions and 3 deletions
|
@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.Color
|
|||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
||||
import com.badlogic.gdx.utils.Align
|
||||
import com.unciv.MainMenuScreen
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.logic.MapSaver
|
||||
import com.unciv.logic.map.TileMap
|
||||
|
@ -79,8 +80,7 @@ class LoadMapScreen(previousMap: TileMap?) : PickerScreen(){
|
|||
rightSideTable.add(deleteButton).row()
|
||||
|
||||
topTable.add(rightSideTable)
|
||||
if (previousMap != null)
|
||||
closeButton.onClick { UncivGame.Current.setScreen(MapEditorScreen(previousMap)) }
|
||||
setDefaultCloseAction(MainMenuScreen())
|
||||
|
||||
update()
|
||||
}
|
||||
|
|
|
@ -145,7 +145,9 @@ class MapOptionsTable(val newGameScreen: NewGameScreen): Table() {
|
|||
}
|
||||
mapFileSelectBox.items = mapFiles
|
||||
val selectedItem = mapFiles.firstOrNull { it.fileHandle.name()==mapParameters.name }
|
||||
if(selectedItem!=null) mapFileSelectBox.selected = selectedItem
|
||||
if (selectedItem != null) mapFileSelectBox.selected = selectedItem
|
||||
else mapFileSelectBox.selected = mapFiles.first()
|
||||
newGameScreen.gameSetupInfo.mapFile = mapFileSelectBox.selected.fileHandle
|
||||
|
||||
mapFileSelectBox.onChange {
|
||||
val mapFile = mapFileSelectBox.selected.fileHandle
|
||||
|
|
Loading…
Reference in a new issue