Avoid ANR errors when attempting to start a MP game when server takes too long to respond

This commit is contained in:
yairm210
2024-11-19 08:55:49 +02:00
parent a914571b8e
commit 78c02df317

View File

@ -113,9 +113,11 @@ 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
val success = startGame() Concurrency.run { // even just *checking* can take time
// if it is successful, the player should wait for the new screen, not touch the old one val success = startGame()
if (!success) Gdx.input.inputProcessor = stage // if it is successful, the player should wait for the new screen, not touch the old one
if (!success) Gdx.input.inputProcessor = stage
}
} }
private fun startGame(): Boolean { private fun startGame(): Boolean {