mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 06:16:37 -04:00
All UI changes in MultiplayerScreen now use postRunnable to run on the main thread
This commit is contained in:
parent
cba9995f99
commit
1bb26c579d
@ -135,9 +135,9 @@ class MultiplayerScreen(previousScreen: CameraStageBaseScreen) : PickerScreen()
|
||||
return
|
||||
}
|
||||
|
||||
thread(name="MultiplayerDownload") {
|
||||
addGameButton.setText("Working...".tr())
|
||||
addGameButton.disable()
|
||||
thread(name="MultiplayerDownload") {
|
||||
try {
|
||||
// The tryDownload can take more than 500ms. Therefore, to avoid ANRs,
|
||||
// we need to run it in a different thread.
|
||||
@ -157,10 +157,12 @@ class MultiplayerScreen(previousScreen: CameraStageBaseScreen) : PickerScreen()
|
||||
errorPopup.open()
|
||||
}
|
||||
}
|
||||
Gdx.app.postRunnable {
|
||||
addGameButton.setText(addGameText)
|
||||
addGameButton.enable()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//just loads the game from savefile
|
||||
//the game will be downloaded opon joining it anyway
|
||||
@ -256,12 +258,15 @@ class MultiplayerScreen(previousScreen: CameraStageBaseScreen) : PickerScreen()
|
||||
} catch (ex: Exception) {
|
||||
//skipping one is not fatal
|
||||
//Trying to use as many prev. used strings as possible
|
||||
Gdx.app.postRunnable {
|
||||
ResponsePopup("Could not download game!".tr() + " ${multiplayerGameList.getValue(gameId)}", this)
|
||||
}
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
//Reset UI
|
||||
Gdx.app.postRunnable {
|
||||
addGameButton.enable()
|
||||
refreshButton.setText(refreshText)
|
||||
refreshButton.enable()
|
||||
@ -269,6 +274,7 @@ class MultiplayerScreen(previousScreen: CameraStageBaseScreen) : PickerScreen()
|
||||
reloadGameListUI()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Adds a Button to add the currently running game to multiplayerGameList
|
||||
private fun addCurrentGameButton(){
|
||||
|
Loading…
x
Reference in New Issue
Block a user