EndSamePlayer new players
This commit is contained in:
parent
b04804c677
commit
fc103f8fab
@ -312,14 +312,31 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs e)
|
||||
}
|
||||
switch (myRoom.currentState)
|
||||
{
|
||||
case (int)GameState.EnteringName:
|
||||
{
|
||||
if (EndGame.activeInHierarchy)
|
||||
{
|
||||
EndGame.SetActive(false);
|
||||
HomeConnection.SetActive(true);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case (int)GameState.WaitingForOtherPlayersToJoin:
|
||||
{
|
||||
if (!HomeConnection.activeInHierarchy)
|
||||
{
|
||||
CheckIfIAmTheFirst(myRoom.GetPlayerList());
|
||||
UpdateDisplayedListUser(myRoom.GetPlayerList());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (int)GameState.Explanation:
|
||||
{
|
||||
if (EndGame.activeInHierarchy)
|
||||
{
|
||||
EndGame.SetActive(false);
|
||||
}
|
||||
WaitingRoom.SetActive(false);
|
||||
BeforeStart.SetActive(true);
|
||||
endOfExplanationDate = DateTime.Now.AddSeconds(3);
|
||||
@ -390,6 +407,39 @@ public void OnClickSubmitSignIn()
|
||||
string roomCode = roomCodeField.text;
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user