fix: (I hope) switch to waiting screen after vote (and clean some debug log)

This commit is contained in:
Fangh 2024-01-29 23:00:10 +01:00
parent 6b56da648c
commit 884d2a0e2d
6 changed files with 16 additions and 19 deletions

View File

@ -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);
}

View File

@ -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
}

View File

@ -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)
/// <param name="_gsUrl"></param>
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<Player> _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))

View File

@ -305,7 +305,7 @@ private void UpdateConnectedPlayerList(List<Player> _players)
AudioManager.Instance.PlaySFX(playerJoinSFX);
ResetAllPlayerLabels();
Debug.Log($"players count = {_players.Count}");
//Debug.Log($"players count = {_players.Count}");
List<Player> orderedPlayers = _players.OrderBy(x => x.creationDate).ToList();
for (int i = 0; i < orderedPlayers.Count; i++)
{
@ -316,7 +316,7 @@ private void UpdateConnectedPlayerList(List<Player> _players)
private void QueryRoomsInDatabase(Action<List<Room>> 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)

View File

@ -99,7 +99,7 @@ public static void ConvertGoogleStorageURLToHttpsUrl(string _gsURL, Action<strin
}
else
{
Debug.Log("Image HTTPS URL: " + task.Result);
//Debug.Log("Image HTTPS URL: " + task.Result);
callback_OnURLFound?.Invoke(task.Result.ToString());
}
});

View File

@ -77,12 +77,16 @@ public void ShowVotingPage(DatabaseReference _roomRef, Dictionary<string, Player
}
currentQuestion = remainingQuestions.Dequeue();
roomRef.Child("currentQuestionId").SetValueAsync(currentQuestion.index);
ShowQuestion();
}
/// <summary>
/// Display next question on screen
/// </summary>
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;