New players are correctly send to the language screen

This commit is contained in:
Yair Morgenstern 2020-04-20 23:21:52 +03:00
parent a3a9bd142e
commit eaf7c0a150
2 changed files with 31 additions and 31 deletions

View file

@ -94,7 +94,10 @@ class UncivGame(
CameraStageBaseScreen.resetFonts()
thread(name="Music") { startMusic() }
restoreSize()
setScreen(MenuScreen())
if (settings.isFreshlyCreated) {
setScreen(LanguagePickerScreen())
} else { setScreen(MenuScreen()) }
isInitialized = true
}
}
@ -207,35 +210,31 @@ class MenuScreen:CameraStageBaseScreen() {
}
init {
if (game.settings.isFreshlyCreated) {
game.setScreen(LanguagePickerScreen(this))
} else {
val table = Table().apply { defaults().pad(10f) }
val autosaveGame = GameSaver.getSave(autosave, false)
if(autosaveGame.exists()) {
val resumeTable = getTableBlock("Resume")
resumeTable.onClick { autoLoadGame() }
table.add(resumeTable).row()
}
val quickstartTable = getTableBlock("Quickstart")
quickstartTable.onClick { startNewGame() }
table.add(quickstartTable).row()
val newGameButton = getTableBlock("Start new game")
newGameButton.onClick { UncivGame.Current.setScreen(NewGameScreen(this)) }
table.add(newGameButton).row()
if(GameSaver.getSaves(false).any()) {
val loadGameTable = getTableBlock("Load game")
loadGameTable.onClick { UncivGame.Current.setScreen(LoadGameScreen(this)) }
table.add(loadGameTable).row()
}
table.pack()
table.center(stage)
stage.addActor(table)
val table = Table().apply { defaults().pad(10f) }
val autosaveGame = GameSaver.getSave(autosave, false)
if (autosaveGame.exists()) {
val resumeTable = getTableBlock("Resume")
resumeTable.onClick { autoLoadGame() }
table.add(resumeTable).row()
}
val quickstartTable = getTableBlock("Quickstart")
quickstartTable.onClick { startNewGame() }
table.add(quickstartTable).row()
val newGameButton = getTableBlock("Start new game")
newGameButton.onClick { UncivGame.Current.setScreen(NewGameScreen(this)) }
table.add(newGameButton).row()
if (GameSaver.getSaves(false).any()) {
val loadGameTable = getTableBlock("Load game")
loadGameTable.onClick { UncivGame.Current.setScreen(LoadGameScreen(this)) }
table.add(loadGameTable).row()
}
table.pack()
table.center(stage)
stage.addActor(table)
}
fun autoLoadGame() {

View file

@ -3,6 +3,7 @@ package com.unciv.ui
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.Touchable
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.unciv.MenuScreen
import com.unciv.UncivGame
import com.unciv.models.translations.tr
import com.unciv.ui.pickerscreens.PickerScreen
@ -32,7 +33,7 @@ class LanguageTable(val language:String, val percentComplete: Int):Table(){
}
class LanguagePickerScreen(val previousScreen: CameraStageBaseScreen): PickerScreen(){
class LanguagePickerScreen(): PickerScreen(){
var chosenLanguage = "English"
private val languageTables = ArrayList<LanguageTable>()
@ -80,7 +81,7 @@ class LanguagePickerScreen(val previousScreen: CameraStageBaseScreen): PickerScr
game.translations.tryReadTranslationForCurrentLanguage()
resetFonts()
game.setScreen(previousScreen)
game.setScreen(MenuScreen())
dispose()
}
}