From 884d2a0e2dedd2243a9a29bd892e0aeeeebfdb4e Mon Sep 17 00:00:00 2001 From: Fangh Date: Mon, 29 Jan 2024 23:00:10 +0100 Subject: [PATCH] fix: (I hope) switch to waiting screen after vote (and clean some debug log) --- Assets/Scripts/AudioManager.cs | 4 ++-- Assets/Scripts/GameManager.cs | 11 ++--------- Assets/Scripts/PropositionFrame.cs | 8 ++++---- Assets/Scripts/RoomManager.cs | 4 ++-- Assets/Scripts/StorageManager.cs | 2 +- Assets/Scripts/VotingPage.cs | 6 +++++- 6 files changed, 16 insertions(+), 19 deletions(-) diff --git a/Assets/Scripts/AudioManager.cs b/Assets/Scripts/AudioManager.cs index e93327f..42c89ef 100644 --- a/Assets/Scripts/AudioManager.cs +++ b/Assets/Scripts/AudioManager.cs @@ -30,7 +30,7 @@ private void Awake() public void ChangeMusic(MusicTitle _title) { - Debug.Log($"changing music to {_title}"); + //Debug.Log($"changing music to {_title}"); musicSource.clip = musics.Find(x => x.title == _title).clip; musicSource.Play(); } @@ -42,7 +42,7 @@ public void StopMusic() public void PlaySFX(AudioClip _clip) { - Debug.Log($"playing {_clip.name} SFX"); + //Debug.Log($"playing {_clip.name} SFX"); sfxSource.PlayOneShot(_clip); } diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index e9a1587..5aaf6d2 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -360,10 +360,6 @@ private void OnNewGameState() } break; } - case (int)GameState.PropositionsSent: - { - break; - } case (int)GameState.MakeVote: { if (TakePicture.activeInHierarchy || WaitingOtherPlayers.activeInHierarchy) @@ -529,7 +525,6 @@ public void OnClickProposition(int propositionNumber) voters.Add(currentPlayer.id); myOnlineRoom.Child("questions").Child(myRoom.currentQuestionId.ToString()).Child("propositions").Child(propositionNumber.ToString()).Child("voters").SetValueAsync(voters); - myRoom.currentState = (int)GameState.VoteSent; WaitingOtherPlayers.SetActive(true); VotePicture.SetActive(false); } @@ -543,8 +538,6 @@ public enum GameState WaitingForOtherPlayersToJoin = 1, Explanation = 2, MakeProposition = 3, - PropositionsSent = 4, - MakeVote = 5, - VoteSent = 6, - Score = 7 + MakeVote = 4, + Score = 5 } diff --git a/Assets/Scripts/PropositionFrame.cs b/Assets/Scripts/PropositionFrame.cs index 38294fa..95c0946 100644 --- a/Assets/Scripts/PropositionFrame.cs +++ b/Assets/Scripts/PropositionFrame.cs @@ -20,7 +20,7 @@ public class PropositionFrame : MonoBehaviour public void Initialize(Proposition _proposition) { - Debug.Log($"Initializing {_proposition.owner.name}'s proposition", this); + //Debug.Log($"Initializing {_proposition.owner.name}'s proposition", this); proposition = _proposition; playerName.text = proposition.owner.name; @@ -34,12 +34,12 @@ public void Initialize(Proposition _proposition) /// private void DisplayPicture(string _gsUrl) { - Debug.Log($"Google Storage URL : {_gsUrl}"); + //Debug.Log($"Google Storage URL : {_gsUrl}"); StorageManager.ConvertGoogleStorageURLToHttpsUrl(_gsUrl, _url => { StartCoroutine(StorageManager.DownloadImage_Coroutine(_url, _texture => { - Debug.Log("Set texture in the raw image"); + //Debug.Log("Set texture in the raw image"); picture.texture = _texture; })); }); @@ -47,7 +47,7 @@ private void DisplayPicture(string _gsUrl) public void UpdateVoters(List _newVoters) { - Debug.Log($"There are some new voters for {proposition.owner}'s proposition", this); + //Debug.Log($"There are some new voters for {proposition.owner}'s proposition", this); foreach (Player p in _newVoters) { if (!currentVoters.Contains(p)) diff --git a/Assets/Scripts/RoomManager.cs b/Assets/Scripts/RoomManager.cs index 5f75101..4715904 100644 --- a/Assets/Scripts/RoomManager.cs +++ b/Assets/Scripts/RoomManager.cs @@ -305,7 +305,7 @@ private void UpdateConnectedPlayerList(List _players) AudioManager.Instance.PlaySFX(playerJoinSFX); ResetAllPlayerLabels(); - Debug.Log($"players count = {_players.Count}"); + //Debug.Log($"players count = {_players.Count}"); List orderedPlayers = _players.OrderBy(x => x.creationDate).ToList(); for (int i = 0; i < orderedPlayers.Count; i++) { @@ -316,7 +316,7 @@ private void UpdateConnectedPlayerList(List _players) private void QueryRoomsInDatabase(Action> callback) { - Debug.Log("Querying rooms from the database", this); + //Debug.Log("Querying rooms from the database", this); realtimeDB.Child("rooms").GetValueAsync().ContinueWithOnMainThread(task => { if (task.IsFaulted) diff --git a/Assets/Scripts/StorageManager.cs b/Assets/Scripts/StorageManager.cs index 185c226..9896c89 100644 --- a/Assets/Scripts/StorageManager.cs +++ b/Assets/Scripts/StorageManager.cs @@ -99,7 +99,7 @@ public static void ConvertGoogleStorageURLToHttpsUrl(string _gsURL, Action + /// Display next question on screen + /// void ShowQuestion() { + roomRef.Child("currentQuestionId").SetValueAsync(currentQuestion.index); + Debug.Log($"Show Question {currentQuestion.promptId}", this); Prompt currentPrompt = promptList.GetPromptById(currentQuestion.promptId); currentPromptLabel.text = currentPrompt.en;