From 5e58f33ea1a512bc3546061cfe0084b9927a317a Mon Sep 17 00:00:00 2001 From: Marine Date: Sun, 28 Jan 2024 17:36:00 +0100 Subject: [PATCH] fix merge --- Assets/Scripts/GameManager.cs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index e79e370..3571c2f 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -115,6 +115,19 @@ private void Update() } } + + if (myRoom.currentState == (int)GameState.MakeVote && endOfViewDate != DateTime.MinValue) + { + TimeSpan duration = endOfViewDate - DateTime.Now; + counterMakeProposition.text = ((int)duration.TotalSeconds).ToString("D1"); + + if (duration.TotalMilliseconds <= 0) + { + Debug.Log("It's time to finish proposition !"); + endOfViewDate = DateTime.MinValue; + } + } + } @@ -462,7 +475,7 @@ public void onClickSamePlayers() { myRoom.currentState = (int)GameState.Explanation; myRoom.questions = null; - myRoom.currentQuestionId = string.Empty; + myRoom.currentQuestionId = 0; string json = JsonUtility.ToJson(myRoom); myOnlineRoom.SetRawJsonValueAsync(json).ContinueWithOnMainThread(task => @@ -477,7 +490,7 @@ public void onClickSamePlayers() public void onClickNewPlayers() { myRoom.currentState = (int)GameState.EnteringName; - myRoom.currentQuestionId = string.Empty; + myRoom.currentQuestionId = 0; myRoom.questions = null; myRoom.players = null; string json = JsonUtility.ToJson(myRoom); @@ -494,8 +507,7 @@ public void onClickNewPlayers() public void OnClickProposition(int propositionNumber) { - int currentQuestionId = Int32.Parse(myRoom.currentQuestionId); - List voters = myRoom.questions[currentQuestionId].propositions[propositionNumber].voters.ToList(); + List voters = myRoom.questions[myRoom.currentQuestionId].propositions[propositionNumber].voters.ToList(); voters.Add(currentPlayer.id); myOnlineRoom.Child("questions").Child(myRoom.currentQuestionId.ToString()).Child("propositions").Child(propositionNumber.ToString()).Child("voters").SetValueAsync(voters); }