fix: player can enter room multiple times

This commit is contained in:
Fangh 2024-02-04 14:32:14 +01:00
parent ee6c2fa97c
commit 2670a870be

View File

@ -63,6 +63,11 @@ private void Awake()
}
private void Start()
{
InitializeHomePage();
}
private void InitializeHomePage()
{
HomeConnection.SetActive(true);
WaitingRoom.SetActive(false);
@ -72,10 +77,10 @@ private void Start()
WaitingOtherPlayers.SetActive(false);
EndGame.SetActive(false);
submitStartGame.SetActive(false);
submitNewPlayer.interactable = true;
if (PlayerPrefs.HasKey("lastplayername"))
playerNameField.text = PlayerPrefs.GetString("lastplayername");
}
private void OnApplicationQuit()
@ -339,13 +344,7 @@ private void OnNewGameState()
{
case (int)GameState.EnteringName:
{
WaitingOtherPlayers.SetActive(false);
BeforeStart.SetActive(false);
TakePicture.SetActive(false);
VotePicture.SetActive(false);
EndGame.SetActive(false);
HomeConnection.SetActive(true);
InitializeHomePage();
break;
}
case (int)GameState.Explanation:
@ -477,6 +476,7 @@ public void OnClickSubmitSignIn()
{
string playerName = playerNameField.text;
string roomCode = roomCodeField.text;
submitNewPlayer.interactable = false;
PlayerValidateNameAndServerRoom(playerName, roomCode);
}