wip: reset values

This commit is contained in:
Fangh 2024-02-04 12:42:57 +01:00
parent 825c69fcc1
commit 2de1611c4d
4 changed files with 8 additions and 35 deletions

View File

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

View File

@ -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<Task> deleteTasks, Action callback_OnFinish)
@ -80,37 +79,6 @@ private void RunDeleteTasks(List<Task> deleteTasks, Action callback_OnFinish)
});
}
/*
private IEnumerator RunDeleteTasks(List<Task> 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<bool> callback_OnPhotoUploaded)
{
Texture2D photo = cameraManager.GetPhoto();

View File

@ -94,10 +94,13 @@ private void EndCurrentQuestion()
public void ShowVotingPage(DatabaseReference _roomRef, Dictionary<string, Player> _currentPlayers, Dictionary<int, Question> _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<string, Player
roomRef.Child("questions").Child(i.ToString()).ValueChanged += OnQuestionDataUpdate;
}
gameObject.SetActive(true);
currentQuestion = remainingQuestions.Dequeue();
ShowNextQuestion();
}

View File

@ -24,6 +24,9 @@ public void Initialize(Room _myRoom, Action _onPropositionFinish)
gameObject.SetActive(true);
OnPropositionFinish = _onPropositionFinish;
myRoom = _myRoom;
allPlayersHasProposedTwoPictures = false;
playersIdWhoHaveProposed.Clear();
ShowPlayerLabels();
}