fix: display first page and unsubscribe from your old room

This commit is contained in:
Fangh 2024-02-04 14:09:04 +01:00
parent e9ac369702
commit cf0a4d578c

View File

@ -62,6 +62,8 @@ private void InitializeFirstPage()
explanationPage.SetActive(false);
waitForPropositionsPage.gameObject.SetActive(false);
votingPage.gameObject.SetActive(false);
scoringPage.gameObject.SetActive(false);
waitingForPlayersPage.SetActive(true);
ResetAllPlayerLabels();
}
@ -133,11 +135,13 @@ private IEnumerator Coroutine_ClearCurrentRoom(Action callback_OnRoomClear = nul
if(myRoom == null || string.IsNullOrEmpty(myRoom.code))
{
yield return null;
Debug.Log("There is no room to clean", this);
Debug.Log("There is no last room to clean", this);
callback_OnRoomClear?.Invoke();
}
else
{
realtimeDB.Child("rooms").Child(myRoom.code).ValueChanged -= OnRoomUpdate;
Debug.Log($"delete files of room {myRoom.code} from storage", this);
StorageManager.Instance.DeleteFileOfRoom(myRoom, () =>
{
@ -309,6 +313,7 @@ private void OnNewGameStateStarted()
{
case (int)GameState.EnteringName: //if game has been reset by a player on mobile
ClearOldAndCreateNewRoom();
InitializeFirstPage();
break;
case (int)GameState.WaitingForOtherPlayersToJoin: