From ee6c2fa97c46b7dd9bcc497123c0298720c37bc8 Mon Sep 17 00:00:00 2001 From: Fangh Date: Sun, 4 Feb 2024 14:30:11 +0100 Subject: [PATCH] fix: if there is a broken room, retry --- Assets/Scripts/GameManager.cs | 2 ++ Assets/Scripts/RoomManager.cs | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 3e769c7..f3450bd 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -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); diff --git a/Assets/Scripts/RoomManager.cs b/Assets/Scripts/RoomManager.cs index 9dd62c9..a1482d5 100644 --- a/Assets/Scripts/RoomManager.cs +++ b/Assets/Scripts/RoomManager.cs @@ -401,7 +401,7 @@ private void QueryRoomsInDatabase(Action> 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> 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