mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-30 15:30:43 -04:00
Organized new game screen functions
This commit is contained in:
parent
9bb4d988a3
commit
d86672b0c0
@ -20,7 +20,7 @@ class UnCivGame(val version: String) : Game() {
|
|||||||
val viewEntireMapForDebug = false
|
val viewEntireMapForDebug = false
|
||||||
|
|
||||||
// For when you need to test something in an advanced game and don't have time to faff around
|
// For when you need to test something in an advanced game and don't have time to faff around
|
||||||
val superchargedForDebug = true
|
val superchargedForDebug = false
|
||||||
|
|
||||||
lateinit var worldScreen: WorldScreen
|
lateinit var worldScreen: WorldScreen
|
||||||
|
|
||||||
|
@ -74,6 +74,29 @@ class NewGameScreen: PickerScreen(){
|
|||||||
val newGameOptionsTable = Table()
|
val newGameOptionsTable = Table()
|
||||||
newGameOptionsTable.skin = skin
|
newGameOptionsTable.skin = skin
|
||||||
|
|
||||||
|
addMapTypeSizeAndFile(newGameOptionsTable)
|
||||||
|
|
||||||
|
addNumberOfHumansAndEnemies(newGameOptionsTable)
|
||||||
|
|
||||||
|
addDifficultySelectBox(newGameOptionsTable)
|
||||||
|
|
||||||
|
rightSideButton.enable()
|
||||||
|
rightSideButton.setText("Start game!".tr())
|
||||||
|
rightSideButton.onClick {
|
||||||
|
Gdx.input.inputProcessor = null // remove input processing - nothing will be clicked!
|
||||||
|
rightSideButton.disable()
|
||||||
|
rightSideButton.setText("Working...".tr())
|
||||||
|
|
||||||
|
thread { // Creating a new game can take a while and we don't want ANRs
|
||||||
|
newGame = GameStarter().startNewGame(newGameParameters)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
newGameOptionsTable.pack()
|
||||||
|
return newGameOptionsTable
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun addMapTypeSizeAndFile(newGameOptionsTable: Table) {
|
||||||
newGameOptionsTable.add("{Map type}:".tr())
|
newGameOptionsTable.add("{Map type}:".tr())
|
||||||
val mapTypes = LinkedHashMap<String, MapType>()
|
val mapTypes = LinkedHashMap<String, MapType>()
|
||||||
for (type in MapType.values()) {
|
for (type in MapType.values()) {
|
||||||
@ -117,8 +140,9 @@ class NewGameScreen: PickerScreen(){
|
|||||||
|
|
||||||
newGameOptionsTable.add(mapFileLabel)
|
newGameOptionsTable.add(mapFileLabel)
|
||||||
newGameOptionsTable.add(mapFileSelectBox).pad(10f).row()
|
newGameOptionsTable.add(mapFileSelectBox).pad(10f).row()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun addNumberOfHumansAndEnemies(newGameOptionsTable: Table) {
|
||||||
newGameOptionsTable.add("{Number of human players}:".tr())
|
newGameOptionsTable.add("{Number of human players}:".tr())
|
||||||
val humanPlayers = SelectBox<Int>(skin)
|
val humanPlayers = SelectBox<Int>(skin)
|
||||||
val humanPlayersArray = Array<Int>()
|
val humanPlayersArray = Array<Int>()
|
||||||
@ -153,7 +177,9 @@ class NewGameScreen: PickerScreen(){
|
|||||||
removeExtraHumanNations(humanPlayers)
|
removeExtraHumanNations(humanPlayers)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun addDifficultySelectBox(newGameOptionsTable: Table) {
|
||||||
newGameOptionsTable.add("{Difficulty}:".tr())
|
newGameOptionsTable.add("{Difficulty}:".tr())
|
||||||
val difficultySelectBox = TranslatedSelectBox(GameBasics.Difficulties.keys, newGameParameters.difficulty, skin)
|
val difficultySelectBox = TranslatedSelectBox(GameBasics.Difficulties.keys, newGameParameters.difficulty, skin)
|
||||||
difficultySelectBox.addListener(object : ChangeListener() {
|
difficultySelectBox.addListener(object : ChangeListener() {
|
||||||
@ -162,23 +188,6 @@ class NewGameScreen: PickerScreen(){
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
newGameOptionsTable.add(difficultySelectBox).pad(10f).row()
|
newGameOptionsTable.add(difficultySelectBox).pad(10f).row()
|
||||||
|
|
||||||
|
|
||||||
rightSideButton.enable()
|
|
||||||
rightSideButton.setText("Start game!".tr())
|
|
||||||
rightSideButton.onClick {
|
|
||||||
Gdx.input.inputProcessor = null // remove input processing - nothing will be clicked!
|
|
||||||
rightSideButton.disable()
|
|
||||||
rightSideButton.setText("Working...".tr())
|
|
||||||
|
|
||||||
thread {
|
|
||||||
// Creating a new game can tke a while and we don't want ANRs
|
|
||||||
newGame = GameStarter().startNewGame(newGameParameters)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
newGameOptionsTable.pack()
|
|
||||||
return newGameOptionsTable
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getMapFileSelectBox(): SelectBox<String> {
|
private fun getMapFileSelectBox(): SelectBox<String> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user