Merge branch 'main' of github.com:LeGall29/GGJ2024

This commit is contained in:
Michel Roux 2024-01-28 02:53:14 +01:00
commit 1e53eb3ae5

View File

@ -309,14 +309,31 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs e)
} }
switch (myRoom.currentState) switch (myRoom.currentState)
{ {
case (int)GameState.EnteringName:
{
if (EndGame.activeInHierarchy)
{
EndGame.SetActive(false);
HomeConnection.SetActive(true);
}
break;
}
case (int)GameState.WaitingForOtherPlayersToJoin: case (int)GameState.WaitingForOtherPlayersToJoin:
{
if (!HomeConnection.activeInHierarchy)
{ {
CheckIfIAmTheFirst(myRoom.GetPlayerList()); CheckIfIAmTheFirst(myRoom.GetPlayerList());
UpdateDisplayedListUser(myRoom.GetPlayerList()); UpdateDisplayedListUser(myRoom.GetPlayerList());
}
break; break;
} }
case (int)GameState.Explanation: case (int)GameState.Explanation:
{ {
if (EndGame.activeInHierarchy)
{
EndGame.SetActive(false);
}
WaitingRoom.SetActive(false); WaitingRoom.SetActive(false);
BeforeStart.SetActive(true); BeforeStart.SetActive(true);
endOfExplanationDate = DateTime.Now.AddSeconds(3); endOfExplanationDate = DateTime.Now.AddSeconds(3);
@ -387,6 +404,39 @@ public void OnClickSubmitSignIn()
string roomCode = roomCodeField.text; string roomCode = roomCodeField.text;
PlayerValidateNameAndServerRoom(playerName, roomCode); PlayerValidateNameAndServerRoom(playerName, roomCode);
} }
public void onClickSamePlayers()
{
myRoom.currentState = (int)GameState.Explanation;
myRoom.currentQuestion = 2;
myRoom.questions = null;
string json = JsonUtility.ToJson(myRoom);
myOnlineRoom.SetRawJsonValueAsync(json).ContinueWithOnMainThread(task =>
{
if (task.IsFaulted)
{
Debug.LogException(task.Exception);
}
});
}
public void onClickNewPlayers()
{
myRoom.currentState = (int)GameState.EnteringName;
myRoom.currentQuestion = 0;
myRoom.questions = null;
myRoom.players = null;
string json = JsonUtility.ToJson(myRoom);
myOnlineRoom.SetRawJsonValueAsync(json).ContinueWithOnMainThread(task =>
{
if (task.IsFaulted)
{
Debug.LogException(task.Exception);
}
});
}
} }
public enum GameState public enum GameState