From eaf7c0a15012fde6b3e93c34ca6af33d6b35ba09 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 20 Apr 2020 23:21:52 +0300 Subject: [PATCH] New players are correctly send to the language screen --- core/src/com/unciv/UncivGame.kt | 57 +++++++++---------- core/src/com/unciv/ui/LanguagePickerScreen.kt | 5 +- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/core/src/com/unciv/UncivGame.kt b/core/src/com/unciv/UncivGame.kt index fe336afc..ae6ba0d2 100644 --- a/core/src/com/unciv/UncivGame.kt +++ b/core/src/com/unciv/UncivGame.kt @@ -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() { diff --git a/core/src/com/unciv/ui/LanguagePickerScreen.kt b/core/src/com/unciv/ui/LanguagePickerScreen.kt index 629f0ccf..22efdf03 100644 --- a/core/src/com/unciv/ui/LanguagePickerScreen.kt +++ b/core/src/com/unciv/ui/LanguagePickerScreen.kt @@ -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() @@ -80,7 +81,7 @@ class LanguagePickerScreen(val previousScreen: CameraStageBaseScreen): PickerScr game.translations.tryReadTranslationForCurrentLanguage() resetFonts() - game.setScreen(previousScreen) + game.setScreen(MenuScreen()) dispose() } } \ No newline at end of file