From 2de1611c4d6bafcee8fdf8003b3509595eaa6d31 Mon Sep 17 00:00:00 2001 From: Fangh Date: Sun, 4 Feb 2024 12:42:57 +0100 Subject: [PATCH] wip: reset values --- Assets/Scripts/RoomManager.cs | 2 -- Assets/Scripts/StorageManager.cs | 32 ----------------------- Assets/Scripts/VotingPage.cs | 6 ++++- Assets/Scripts/WaitForPropositionsPage.cs | 3 +++ 4 files changed, 8 insertions(+), 35 deletions(-) diff --git a/Assets/Scripts/RoomManager.cs b/Assets/Scripts/RoomManager.cs index 74c8e64..cee72ae 100644 --- a/Assets/Scripts/RoomManager.cs +++ b/Assets/Scripts/RoomManager.cs @@ -259,8 +259,6 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs value) case (int)GameState.WaitingForOtherPlayersToJoin: UpdateConnectedPlayerList(myRoom.GetPlayerList()); break; - case (int)GameState.Explanation: - break; case (int)GameState.MakeProposition: waitForPropositionsPage.OnRoomUpdate(myRoom); break; diff --git a/Assets/Scripts/StorageManager.cs b/Assets/Scripts/StorageManager.cs index 5ce5b80..5d6d451 100644 --- a/Assets/Scripts/StorageManager.cs +++ b/Assets/Scripts/StorageManager.cs @@ -65,7 +65,6 @@ public void DeleteFileOfRoom(Room _room, Action callBack_OnFinish) Debug.Log($"There is no files to delete for room {_room.code}", this); callBack_OnFinish.Invoke(); } - } private void RunDeleteTasks(List deleteTasks, Action callback_OnFinish) @@ -80,37 +79,6 @@ private void RunDeleteTasks(List deleteTasks, Action callback_OnFinish) }); } - /* - private IEnumerator RunDeleteTasks(List deleteTasks, Action callback_OnFinish) - { - int taskCount = deleteTasks.Count; - Debug.Log($"There are {taskCount} files to delete", this); - foreach (Task task in deleteTasks) - { - task.ContinueWith((completedTask) => - { - // This code will be executed when the task is completed. - taskCount--; - }); - - // Start the task - task.Start(); - } - while (taskCount > 0) - { - yield return null; - } - callback_OnFinish?.Invoke(); - } - - private Task DeletePhoto(string _gsURL) - { - string temp = _gsURL; - StorageReference imageRef = FirebaseStorage.DefaultInstance.GetReferenceFromUrl(temp); - Debug.Log($"deleting {temp}", this); - return imageRef.DeleteAsync(); - }*/ - public void UploadPhoto(string roomCode, string playerId, int question, int proposition, Action callback_OnPhotoUploaded) { Texture2D photo = cameraManager.GetPhoto(); diff --git a/Assets/Scripts/VotingPage.cs b/Assets/Scripts/VotingPage.cs index b77157b..0894796 100644 --- a/Assets/Scripts/VotingPage.cs +++ b/Assets/Scripts/VotingPage.cs @@ -94,10 +94,13 @@ private void EndCurrentQuestion() public void ShowVotingPage(DatabaseReference _roomRef, Dictionary _currentPlayers, Dictionary _questions, Action _callback_OnVoteEnded) { Debug.Log("Initializing voting page"); - this.gameObject.SetActive(true); roomRef = _roomRef; currentPlayers = _currentPlayers; OnVoteEnded = _callback_OnVoteEnded; + allPlayersHaveVotedForCurrentQuestion = false; + endOfTimer = DateTime.MinValue; + remainingQuestions.Clear(); + currentQuestion = null; Question[] _questionArray = _questions.Values.ToArray(); numberOfQuestions = _questionArray.Length; @@ -108,6 +111,7 @@ public void ShowVotingPage(DatabaseReference _roomRef, Dictionary