Game crash popup is no longer a tutorial, so it doesn't get affected by the "displayTutorials" settings and has migrated to the .properties files for translation.

This commit is contained in:
Yair Morgenstern
2019-12-21 18:58:14 +02:00
parent 3f0e33df89
commit 32621b6611
31 changed files with 64 additions and 120 deletions

View File

@ -27,21 +27,23 @@ import kotlin.concurrent.thread
class UncivGame(val version: String) : Game() {
lateinit var gameInfo: GameInfo
lateinit var settings : GameSettings
/**
* This exists so that when debugging we can see the entire map.
* Remember to turn this to false before commit and upload!
*/
var viewEntireMapForDebug = false
/** For when you need to test something in an advanced game and don't have time to faff around */
val superchargedForDebug = false
var rewriteTranslationFiles = false
lateinit var worldScreen: WorldScreen
var music : Music? =null
val musicLocation = "music/thatched-villagers.mp3"
var isInitialized = false
var rewriteTranslationFiles = false
lateinit var ruleset:Ruleset
@ -59,11 +61,12 @@ class UncivGame(val version: String) : Game() {
// If this takes too long players, especially with older phones, get ANR problems.
// Whatever needs graphics needs to be done on the main thread,
// So it's basically a long set of deferred actions.
// We probably could make this better by moving stuff that we can to another thread but ehhhhhhh
settings = GameSaver().getGeneralSettings() // needed for the screen
screen=LoadingScreen()
thread {
ruleset = Ruleset(true)
settings.hasCrashedRecently=true // for test
if(rewriteTranslationFiles) { // Yes, also when running from the Jar. Sue me.
translations.readAllLanguagesTranslation()
@ -79,6 +82,7 @@ class UncivGame(val version: String) : Game() {
settings.save()
}
// This stuff needs to run on the main thread because it needs the GL context
Gdx.app.postRunnable {
CameraStageBaseScreen.resetFonts()
autoLoadGame()

View File

@ -15,8 +15,8 @@ import com.unciv.logic.GameSaver
import com.unciv.logic.civilization.CivilizationInfo
import com.unciv.logic.civilization.diplomacy.DiplomaticStatus
import com.unciv.models.ruleset.tile.ResourceType
import com.unciv.models.translations.tr
import com.unciv.models.ruleset.unit.UnitType
import com.unciv.models.translations.tr
import com.unciv.ui.VictoryScreen
import com.unciv.ui.cityscreen.CityScreen
import com.unciv.ui.pickerscreens.GreatPersonPickerScreen
@ -262,8 +262,13 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
private fun displayTutorialsOnUpdate() {
if (UncivGame.Current.settings.hasCrashedRecently) {
displayTutorials("_GameCrashed")
UncivGame.Current.settings.tutorialsShown.remove("_GameCrashed")
val crashPopup = PopupTable(this)
crashPopup.addGoodSizedLabel("Oh no! It looks like something went DISASTROUSLY wrong!" +
" This is ABSOLUTELY not supposed to happen! Please send me (yairm210@hotmail.com)" +
" an email with the game information (menu -> save game -> copy game info -> paste into email)" +
" and I'll try to fix it as fast as I can!").row()
crashPopup.addCloseButton()
crashPopup.open()
UncivGame.Current.settings.hasCrashedRecently = false
UncivGame.Current.settings.save()
}