mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-25 23:29:47 +07:00
Hotfix: Do not reset the screen to the capital in the multiplayer game (#2502)
This commit is contained in:
@ -129,10 +129,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
||||
|
||||
if(gameInfo.gameParameters.isOnlineMultiplayer && !isPlayersTurn) {
|
||||
// restart the timer
|
||||
if (multiPlayerRefresher != null) {
|
||||
multiPlayerRefresher?.cancel()
|
||||
multiPlayerRefresher?.purge()
|
||||
}
|
||||
stopMultiPlayerRefresher()
|
||||
// isDaemon = true, in order to not block the app closing
|
||||
multiPlayerRefresher = Timer("multiPlayerRefresh", true).apply {
|
||||
scheduleAtFixedRate(object : TimerTask() {
|
||||
@ -154,6 +151,13 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
||||
shouldUpdate = true
|
||||
}
|
||||
|
||||
private fun stopMultiPlayerRefresher() {
|
||||
if (multiPlayerRefresher != null) {
|
||||
multiPlayerRefresher?.cancel()
|
||||
multiPlayerRefresher?.purge()
|
||||
}
|
||||
}
|
||||
|
||||
private fun cleanupKeyDispatcher() {
|
||||
val delKeys = keyPressDispatcher.keys.filter { it!=' ' && it!='n' }
|
||||
delKeys.forEach { keyPressDispatcher.remove(it) }
|
||||
@ -232,7 +236,10 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
||||
}
|
||||
latestGame.isUpToDate=true
|
||||
// Since we're making a screen this needs to run from the main thread which has a GL context
|
||||
Gdx.app.postRunnable { game.loadGame(latestGame) }
|
||||
Gdx.app.postRunnable {
|
||||
stopMultiPlayerRefresher()
|
||||
game.loadGame(latestGame)
|
||||
}
|
||||
|
||||
} catch (ex: Exception) {
|
||||
loadingGamePopup.close()
|
||||
|
Reference in New Issue
Block a user