From 206686a4d44c8d4ee06ec2f514cf0e62536c2e7d Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Tue, 28 Apr 2020 00:05:58 +0300 Subject: [PATCH] Game always resume previous screen on resume(), and autosaves on pause (in case the user / Android decides later that it's closing the app completely) --- core/src/com/unciv/UncivGame.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/src/com/unciv/UncivGame.kt b/core/src/com/unciv/UncivGame.kt index 13f80fb71c..2ed0df3355 100644 --- a/core/src/com/unciv/UncivGame.kt +++ b/core/src/com/unciv/UncivGame.kt @@ -145,12 +145,13 @@ class UncivGame( override fun resume() { super.resume() if (!isInitialized) return // The stuff from Create() is still happening, so the main screen will load eventually - ImageGetter.refreshAtlas() - - setScreen(MainMenuScreen()) } - // Maybe this will solve the resume error on chrome OS, issue 322? Worth a shot + override fun pause() { + if (this::gameInfo.isInitialized) GameSaver.autoSave(this.gameInfo) + super.pause() + } + override fun resize(width: Int, height: Int) { screen.resize(width, height) }