mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-27 08:09:21 +07:00
Avoid ANR errors when attempting to start a MP game when server takes too long to respond
This commit is contained in:
@ -113,10 +113,12 @@ class NewGameScreen(
|
|||||||
private fun startGameAvoidANRs(){
|
private fun startGameAvoidANRs(){
|
||||||
// Don't allow players to click the game while we're checking if it's ok
|
// Don't allow players to click the game while we're checking if it's ok
|
||||||
Gdx.input.inputProcessor = null
|
Gdx.input.inputProcessor = null
|
||||||
|
Concurrency.run { // even just *checking* can take time
|
||||||
val success = startGame()
|
val success = startGame()
|
||||||
// if it is successful, the player should wait for the new screen, not touch the old one
|
// if it is successful, the player should wait for the new screen, not touch the old one
|
||||||
if (!success) Gdx.input.inputProcessor = stage
|
if (!success) Gdx.input.inputProcessor = stage
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun startGame(): Boolean {
|
private fun startGame(): Boolean {
|
||||||
mapOptionsTable.cancelBackgroundJobs()
|
mapOptionsTable.cancelBackgroundJobs()
|
||||||
|
Reference in New Issue
Block a user