@@ -67,7 +67,7 @@ public void SetState(string key, object value, bool reliable = false)
6767 _ubb . CallJs ( "SetPlayerStateByPlayerId" , null , null , false , _id , key , json ,
6868 reliable . ToString ( ) . ToLower ( ) ) ;
6969 }
70-
70+
7171 public T GetState < T > ( string key )
7272 {
7373 string rawValue = _ubb . CallJs < string > ( "GetPlayerStateByPlayerId" , null , null , false , _id , key ) ;
@@ -81,7 +81,7 @@ public T GetState<T>(string key)
8181 try
8282 {
8383 var jsonNode = JSON . Parse ( rawValue ) ;
84-
84+
8585 if ( typeof ( T ) == typeof ( string ) )
8686 {
8787 return ( T ) ( object ) jsonNode . Value ;
@@ -108,7 +108,7 @@ public T GetState<T>(string key)
108108 catch ( ArgumentException )
109109 {
110110 Debug . LogError ( $ "Failed to parse '{ rawValue } ' to Enum of type { typeof ( T ) } ") ;
111- return default ;
111+ return default ;
112112 }
113113 }
114114
@@ -119,8 +119,8 @@ public T GetState<T>(string key)
119119 Debug . LogError ( $ "Failed to parse state for key '{ key } ': { e . Message } \n Received value: { rawValue } ") ;
120120 return default ;
121121 }
122-
123-
122+
123+
124124 }
125125
126126 #endregion
@@ -140,6 +140,11 @@ public void Kick(Action onKickCallBack = null)
140140 _ubb . CallJs ( "Kick" , null , null , true , _id ) ;
141141 }
142142
143+ public void LeaveRoom ( Action onLeave = null )
144+ {
145+ DebugLogger . LogWarning ( "[MockMode] leaveRoom doesn't work in mock mode, build test required" ) ;
146+ }
147+
143148 public void WaitForState ( string stateKey , Action < string > onStateSetCallback = null )
144149 {
145150 string callbackKey = $ "WaitForState_{ stateKey } ";
@@ -152,7 +157,7 @@ public void WaitForState(string stateKey, Action<string> onStateSetCallback = nu
152157
153158 _ubb . CallJs ( "WaitForPlayerState" , null , null , true , _id , stateKey , callbackKey ) ;
154159 }
155-
160+
156161 private List < Action < string > > OnQuitCallbacks = new ( ) ;
157162
158163 public Action OnQuit ( Action < string > callback )
@@ -166,14 +171,14 @@ void Unsubscribe()
166171
167172 return Unsubscribe ;
168173 }
169-
174+
170175 public void OnQuitWrapperCallback ( string id )
171176 {
172177 if ( OnQuitCallbacks != null )
173178 foreach ( var callback in OnQuitCallbacks )
174179 callback ? . Invoke ( id ) ;
175180 }
176-
181+
177182 internal void InvokePlayerOnQuitCallback ( string id )
178183 {
179184 OnQuitWrapperCallback ( id ) ;
0 commit comments