fix(gamemanager): subscribe only after room is created

This commit is contained in:
Fangh 2024-02-29 22:06:16 +01:00
parent b9c1d74943
commit dc20e8e87e

View File

@ -207,11 +207,12 @@ public void PlayerValidateNameAndServerRoom(string _name, string _code)
else
{
myOnlineRoom = realtimeDB.Child("rooms").Child(_code);
//subscribe to it
myOnlineRoom.ValueChanged += OnRoomUpdate;
//if room exists, join it
JoinRoom(() =>
{
//subscribe to it
myOnlineRoom.ValueChanged += OnRoomUpdate;
myRoom.currentState = (int)GameState.WaitingForOtherPlayersToJoin;
players.Add(currentPlayer);