fix(GameManager): onroomupdate

This commit is contained in:
Fangh 2024-02-29 22:13:47 +01:00
parent dc20e8e87e
commit 68697c7b06
3 changed files with 4 additions and 36 deletions

View File

@ -1,25 +0,0 @@
<linker>
<assembly fullname="Unity.Addressables, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" preserve="all">
<type fullname="UnityEngine.AddressableAssets.Addressables" preserve="all" />
</assembly>
<assembly fullname="Unity.Localization, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<type fullname="UnityEngine.Localization.Locale" preserve="all" />
<type fullname="UnityEngine.Localization.Tables.SharedTableData" preserve="all" />
<type fullname="UnityEngine.Localization.Tables.StringTable" preserve="all" />
<type fullname="UnityEngine.Localization.LocaleIdentifier" preserve="nothing" serialized="true" />
<type fullname="UnityEngine.Localization.Metadata.MetadataCollection" preserve="nothing" serialized="true" />
<type fullname="UnityEngine.Localization.Tables.DistributedUIDGenerator" preserve="nothing" serialized="true" />
<type fullname="UnityEngine.Localization.Tables.SharedTableData/SharedTableEntry" preserve="nothing" serialized="true" />
<type fullname="UnityEngine.Localization.Tables.TableEntryData" preserve="nothing" serialized="true" />
</assembly>
<assembly fullname="Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" preserve="all">
<type fullname="UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider" preserve="all" />
<type fullname="UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider" preserve="all" />
<type fullname="UnityEngine.ResourceManagement.ResourceProviders.InstanceProvider" preserve="all" />
<type fullname="UnityEngine.ResourceManagement.ResourceProviders.LegacyResourcesProvider" preserve="all" />
<type fullname="UnityEngine.ResourceManagement.ResourceProviders.SceneProvider" preserve="all" />
</assembly>
<assembly fullname="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<type fullname="UnityEngine.Object" preserve="all" />
</assembly>
</linker>

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 1348ae8b4f67ed743a4d30604cebfa9d
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -207,11 +207,11 @@ 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);
@ -307,8 +307,6 @@ public void StartGame()
/// </summary>
private void OnRoomUpdate(object sender, ValueChangedEventArgs e)
{
GameState lastState = (GameState)myRoom.currentState;
try
{
if (e?.Snapshot?.GetRawJsonValue() != null)
@ -328,6 +326,8 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs e)
return;
}
GameState lastState = (GameState)myRoom.currentState;
Debug.Log($"lasState = {lastState}. Currentstep = {(GameState)myRoom.currentState}", this);
if (myRoom.currentState != (int)lastState)
{