From 6898ac3a84e27d8697040251abfd15231bef50eb Mon Sep 17 00:00:00 2001 From: Fangh Date: Mon, 29 Jan 2024 23:40:38 +0100 Subject: [PATCH] fix: stop sending request to server 60time per seconds --- Assets/Scripts/RoomManager.cs | 2 +- Assets/Scripts/VotingPage.cs | 2 ++ Assets/Scripts/WaitForPropositionsPage.cs | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/RoomManager.cs b/Assets/Scripts/RoomManager.cs index f7a2f5d..2da09a5 100644 --- a/Assets/Scripts/RoomManager.cs +++ b/Assets/Scripts/RoomManager.cs @@ -77,7 +77,7 @@ private void Update() private void SendRoomState(GameState _newState) { - Debug.Log($"sending to RTDB that we are now in the {_newState} state", this); + //Debug.Log($"sending to RTDB that we are now in the {_newState} state", this); realtimeDB.Child("rooms").Child(myRoom.code).Child("currentState").SetValueAsync((int)_newState); } diff --git a/Assets/Scripts/VotingPage.cs b/Assets/Scripts/VotingPage.cs index 12fec1f..36f58ae 100644 --- a/Assets/Scripts/VotingPage.cs +++ b/Assets/Scripts/VotingPage.cs @@ -54,6 +54,8 @@ private void Update() else { OnVoteEnded?.Invoke(); + OnVoteEnded = null; + gameObject.SetActive(false); } } } diff --git a/Assets/Scripts/WaitForPropositionsPage.cs b/Assets/Scripts/WaitForPropositionsPage.cs index 194fb62..73f2903 100644 --- a/Assets/Scripts/WaitForPropositionsPage.cs +++ b/Assets/Scripts/WaitForPropositionsPage.cs @@ -36,7 +36,6 @@ public void OnRoomUpdate(Room _myRoom) // Update is called once per frame void Update() { - //while MakeProposition State if (endOfPropositionDate != DateTime.MinValue) { @@ -46,6 +45,8 @@ void Update() if (duration.TotalMilliseconds <= 0 || allPlayersHasProposedTwoPictures) { OnPropositionFinish?.Invoke(); + OnPropositionFinish = null; + gameObject.SetActive(false); return; } @@ -103,7 +104,7 @@ private void CheckPlayersWhoHaveProposed() playerLabels.Find(x => x.text == player.name).color = Color.green; playersIdWhoHaveProposed.Add(player.id); } - Debug.Log($"{playersIdWhoHaveProposed.Count}/{myRoom.players.Count} players have answered.", this); + //Debug.Log($"{playersIdWhoHaveProposed.Count}/{myRoom.players.Count} players have answered.", this); if(playersIdWhoHaveProposed.Count == myRoom.players.Count) { allPlayersHasProposedTwoPictures = true;