fix: if there is a broken room, retry

This commit is contained in:
Fangh 2024-02-04 14:30:11 +01:00
parent 50bff13fae
commit ee6c2fa97c
2 changed files with 6 additions and 3 deletions

View File

@ -385,12 +385,14 @@ private void OnNewGameState()
EndGame.SetActive(false);
VotePicture.SetActive(true);
Debug.Log("subscribe to question ID");
myOnlineRoom.Child("currentQuestionId").ValueChanged += OnCurrentQuestionChanged;
break;
}
case (int)GameState.Score:
{
Debug.Log("it's scoring time !", this);
Debug.Log("unsubscribe to question ID");
myOnlineRoom.Child("currentQuestionId").ValueChanged -= OnCurrentQuestionChanged;
WaitingOtherPlayers.SetActive(false);

View File

@ -401,7 +401,7 @@ private void QueryRoomsInDatabase(Action<List<Room>> callback)
catch (Exception e)
{
Debug.LogException(e);
Debug.LogError($"Room {JSON} was broken, deleting it", this);
Debug.Log($"Room {JSON} is broken, deleting it", this);
snapshot.Reference.RemoveValueAsync().ContinueWithOnMainThread(task =>
{
if (task.IsFaulted)
@ -409,8 +409,9 @@ private void QueryRoomsInDatabase(Action<List<Room>> callback)
Debug.LogException(task.Exception);
return;
}
Debug.Log($"Broken room has been deleted", this);
}); ;
Debug.Log($"Broken room has been deleted. Checking again", this);
QueryRoomsInDatabase(callback);
});
}
}
else