fix(GameManager): onroomupdate
This commit is contained in:
parent
dc20e8e87e
commit
68697c7b06
@ -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>
|
|
@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 1348ae8b4f67ed743a4d30604cebfa9d
|
|
||||||
TextScriptImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -207,11 +207,11 @@ public void PlayerValidateNameAndServerRoom(string _name, string _code)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
myOnlineRoom = realtimeDB.Child("rooms").Child(_code);
|
myOnlineRoom = realtimeDB.Child("rooms").Child(_code);
|
||||||
|
//subscribe to it
|
||||||
|
myOnlineRoom.ValueChanged += OnRoomUpdate;
|
||||||
//if room exists, join it
|
//if room exists, join it
|
||||||
JoinRoom(() =>
|
JoinRoom(() =>
|
||||||
{
|
{
|
||||||
//subscribe to it
|
|
||||||
myOnlineRoom.ValueChanged += OnRoomUpdate;
|
|
||||||
|
|
||||||
myRoom.currentState = (int)GameState.WaitingForOtherPlayersToJoin;
|
myRoom.currentState = (int)GameState.WaitingForOtherPlayersToJoin;
|
||||||
players.Add(currentPlayer);
|
players.Add(currentPlayer);
|
||||||
@ -307,8 +307,6 @@ public void StartGame()
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void OnRoomUpdate(object sender, ValueChangedEventArgs e)
|
private void OnRoomUpdate(object sender, ValueChangedEventArgs e)
|
||||||
{
|
{
|
||||||
GameState lastState = (GameState)myRoom.currentState;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (e?.Snapshot?.GetRawJsonValue() != null)
|
if (e?.Snapshot?.GetRawJsonValue() != null)
|
||||||
@ -328,6 +326,8 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs e)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GameState lastState = (GameState)myRoom.currentState;
|
||||||
|
|
||||||
Debug.Log($"lasState = {lastState}. Currentstep = {(GameState)myRoom.currentState}", this);
|
Debug.Log($"lasState = {lastState}. Currentstep = {(GameState)myRoom.currentState}", this);
|
||||||
if (myRoom.currentState != (int)lastState)
|
if (myRoom.currentState != (int)lastState)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user