Hopefully got rid of ANRs when entering a link when the app has been closed for too long? I think that's the problem?

This commit is contained in:
Yair Morgenstern
2022-04-09 23:08:12 +03:00
parent 76284c923e
commit 9169ec1e42

View File

@ -75,6 +75,7 @@ class UncivGame(parameters: UncivGameParameters) : Game() {
val translations = Translations() val translations = Translations()
override fun create() { override fun create() {
isInitialized = false // this could be on reload, therefore we need to keep setting this to false
Gdx.input.setCatchKey(Input.Keys.BACK, true) Gdx.input.setCatchKey(Input.Keys.BACK, true)
if (Gdx.app.type != Application.ApplicationType.Desktop) { if (Gdx.app.type != Application.ApplicationType.Desktop) {
viewEntireMapForDebug = false viewEntireMapForDebug = false
@ -100,7 +101,7 @@ class UncivGame(parameters: UncivGameParameters) : Game() {
ImageGetter.resetAtlases() ImageGetter.resetAtlases()
ImageGetter.setNewRuleset(ImageGetter.ruleset) // This needs to come after the settings, since we may have default visual mods ImageGetter.setNewRuleset(ImageGetter.ruleset) // This needs to come after the settings, since we may have default visual mods
if(settings.tileSet !in ImageGetter.getAvailableTilesets()) { // If one of the tilesets is no longer available, default back if (settings.tileSet !in ImageGetter.getAvailableTilesets()) { // If one of the tilesets is no longer available, default back
settings.tileSet = "FantasyHex" settings.tileSet = "FantasyHex"
} }
@ -166,7 +167,8 @@ class UncivGame(parameters: UncivGameParameters) : Game() {
fun tryLoadDeepLinkedGame() { fun tryLoadDeepLinkedGame() {
if (deepLinkedMultiplayerGame != null) { if (deepLinkedMultiplayerGame != null) {
try { try {
loadGame(OnlineMultiplayer().tryDownloadGame(deepLinkedMultiplayerGame!!)) val onlineGame = OnlineMultiplayer().tryDownloadGame(deepLinkedMultiplayerGame!!)
loadGame(onlineGame)
} catch (ex: Exception) { } catch (ex: Exception) {
setScreen(MainMenuScreen()) setScreen(MainMenuScreen())
} }