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)

This commit is contained in:
Yair Morgenstern 2020-04-28 00:05:58 +03:00
parent e59776f443
commit 206686a4d4

View File

@ -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)
}