Skip to content

Commit 08b7f5a

Browse files
committed
updating public properties.
1 parent a5887d3 commit 08b7f5a

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

Assets/ColyseusClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void ConnectToServer ()
5959
client = new Client(endpoint);
6060
client.OnOpen += (object sender, EventArgs e) => {
6161
/* Update Demo UI */
62-
m_IdText.text = "id: " + client.id;
62+
m_IdText.text = "id: " + client.Id;
6363
};
6464
client.OnError += (sender, e) => Debug.LogError(e.Message);
6565
client.OnClose += (sender, e) => Debug.Log("CONNECTION CLOSED");

Assets/Plugins/Colyseus/Events.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,17 @@ public class StateChangeEventArgs : EventArgs
5454

5555
public IndexedDictionary<string, object> State { get; private set; }
5656

57+
/// <summary>
58+
/// Boolean representing if the event is setting the state of the <see cref="Room" /> for the first time.
59+
/// </summary>
60+
public bool IsFirstState;
5761

5862
/// <summary>
5963
/// </summary>
60-
public StateChangeEventArgs (IndexedDictionary<string, object> state)
64+
public StateChangeEventArgs (IndexedDictionary<string, object> state, bool isFirstState = false)
6165
{
6266
this.State = state;
67+
this.IsFirstState = isFirstState;
6368
}
6469
}
6570
}

Assets/Plugins/Colyseus/Room.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public void SetState(byte[] encodedState)
127127
serializer.SetState(encodedState);
128128

129129
if (OnStateChange != null) {
130-
OnStateChange.Invoke (this, new StateChangeEventArgs(serializer.GetState()));
130+
OnStateChange.Invoke (this, new StateChangeEventArgs(serializer.GetState(), true));
131131
}
132132
}
133133

Assets/Tests/RoomTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public IEnumerator TestConnection()
1818
yield return new WaitForFixedUpdate();
1919

2020
component.client.OnOpen += (object sender, System.EventArgs e) => {
21-
Assert.NotNull (component.client.id);
21+
Assert.NotNull (component.client.Id);
2222
};
2323

2424
yield return new WaitForSeconds(0.1f);

0 commit comments

Comments
 (0)