diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index cefaed4..6d25655 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -4,6 +4,7 @@ using Firebase.Database; using Firebase.Extensions; using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using TMPro; using UnityEngine; using static UnityEditor.Experimental.AssetDatabaseExperimental.AssetDatabaseCounters; @@ -57,6 +58,13 @@ private void Start() { currentExplanationTime = explanationTime; HomeConnection.SetActive(true); + WaitingRoom.SetActive(false); + BeforeStart.SetActive(false); + TakePicture.SetActive(false); + VotePicture.SetActive(false); + WaitingOtherPlayers.SetActive(false); + EndGame.SetActive(false); + submitNewPlayer.interactable = false; } @@ -82,6 +90,7 @@ private void Update() if (duration.TotalMilliseconds <= 0) { Debug.Log("It's time to make proposition !"); + endOfExplanationDate = DateTime.MinValue; } } } @@ -288,10 +297,13 @@ public void DisplayEndScreen() /// private void OnRoomUpdate(object sender, ValueChangedEventArgs e) { + Debug.Log("begin OnRoomUpdate"); try { - if (e!= null) + if (e?.Snapshot?.GetRawJsonValue() != null) { + string JSON = e.Snapshot.GetRawJsonValue(); + Debug.Log($"your room has been updated :\n{JSON}"); myRoom = JsonConvert.DeserializeObject(e.Snapshot.GetRawJsonValue()); } @@ -302,12 +314,15 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs e) } if (myRoom == null) { + Debug.Log("myroom is null"); return; } switch (myRoom.currentState) { case (int)GameState.WaitingForOtherPlayersToJoin: { + Debug.Log("update player List"); + Debug.Log(myRoom.GetPlayerList()); CheckIfIAmTheFirst(myRoom.GetPlayerList()); UpdateDisplayedListUser(myRoom.GetPlayerList()); break;