mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 13:55:54 -04:00
fixed next turn button by updating it on main thread
This commit is contained in:
parent
eaa0a9dbad
commit
12f1b41784
@ -268,17 +268,25 @@ class WorldScreen : CameraStageBaseScreen() {
|
|||||||
// So what we do is we clone all the game data and serialize the clone.
|
// So what we do is we clone all the game data and serialize the clone.
|
||||||
if(gameInfo.turns % game.settings.turnsBetweenAutosaves == 0)
|
if(gameInfo.turns % game.settings.turnsBetweenAutosaves == 0)
|
||||||
GameSaver().saveGame(gameInfoClone, "Autosave")
|
GameSaver().saveGame(gameInfoClone, "Autosave")
|
||||||
|
|
||||||
|
// do this on main thread
|
||||||
|
Gdx.app.postRunnable {
|
||||||
nextTurnButton.enable() // only enable the user to next turn once we've saved the current one
|
nextTurnButton.enable() // only enable the user to next turn once we've saved the current one
|
||||||
updateNextTurnButton()
|
updateNextTurnButton()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// If we put this BEFORE the save game, then we try to save the game...
|
// If we put this BEFORE the save game, then we try to save the game...
|
||||||
// but the main thread does other stuff, including showing tutorials which guess what? Changes the game data
|
// but the main thread does other stuff, including showing tutorials which guess what? Changes the game data
|
||||||
// BOOM! Exception!
|
// BOOM! Exception!
|
||||||
// That's why this needs to be after the game is saved.
|
// That's why this needs to be after the game is saved.
|
||||||
shouldUpdate=true
|
shouldUpdate=true
|
||||||
|
|
||||||
|
// do this on main thread
|
||||||
|
Gdx.app.postRunnable {
|
||||||
updateNextTurnButton()
|
updateNextTurnButton()
|
||||||
|
}
|
||||||
Gdx.input.inputProcessor = stage
|
Gdx.input.inputProcessor = stage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user