From 2670a870be4921bc5d3a72e26054da4390c055d8 Mon Sep 17 00:00:00 2001 From: Fangh Date: Sun, 4 Feb 2024 14:32:14 +0100 Subject: [PATCH] fix: player can enter room multiple times --- Assets/Scripts/GameManager.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index f3450bd..36bdeb2 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -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); }