Skip to content

Commit 3a49a23

Browse files
committed
rename DeltaContainer to StateContainer. rename room.data to room.state
1 parent d0c52ae commit 3a49a23

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

Assets/Plugins/Colyseus/Room.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class RoomAvailable {
1919

2020
/// <summary>
2121
/// </summary>
22-
public class Room : DeltaContainer
22+
public class Room : StateContainer
2323
{
2424
public string id;
2525
public string name;
@@ -204,7 +204,7 @@ protected void Patch (byte[] delta)
204204
this.Set(newState);
205205

206206
if (this.OnStateChange != null)
207-
this.OnStateChange.Invoke(this, new RoomUpdateEventArgs(this.data));
207+
this.OnStateChange.Invoke(this, new RoomUpdateEventArgs(this.state));
208208
}
209209
}
210210
}

Assets/Plugins/Colyseus/DeltaListener/DeltaContainer.cs renamed to Assets/Plugins/Colyseus/StateListener/StateContainer.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ public struct Listener<T>
2525
public string[] rawRules;
2626
}
2727

28-
public class DeltaContainer
28+
public class StateContainer
2929
{
30-
public IndexedDictionary<string, object> data;
30+
public IndexedDictionary<string, object> state;
3131
private List<PatchListener> listeners;
3232
private FallbackPatchListener defaultListener;
3333

@@ -40,17 +40,17 @@ public class DeltaContainer
4040
{ ":*", new Regex(@"(.*)") },
4141
};
4242

43-
public DeltaContainer (IndexedDictionary<string, object> data)
43+
public StateContainer (IndexedDictionary<string, object> state)
4444
{
45-
this.data = data;
45+
this.state = state;
4646
this.Reset();
4747
}
4848

4949
public PatchObject[] Set(IndexedDictionary<string, object> newData) {
50-
var patches = Compare.GetPatchList(this.data, newData);
50+
var patches = Compare.GetPatchList(this.state, newData);
5151

5252
this.CheckPatches(patches);
53-
this.data = newData;
53+
this.state = newData;
5454

5555
return patches;
5656
}

Assets/Tests/ClientComponent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class ClientComponent : MonoBehaviour
99

1010
// Use this for initialization
1111
public IEnumerator Start () {
12-
client = new Client("ws://localhost:3553");
12+
client = new Client("ws://localhost:8080");
1313

1414
yield return StartCoroutine(client.Connect());
1515

Assets/Tests/RoomTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public IEnumerator TestConnection()
2929
};
3030

3131
component.room.OnStateChange += (object sender, RoomUpdateEventArgs e) => {
32-
Assert.NotNull (component.room.data ["players"]);
33-
Assert.NotNull (component.room.data ["messages"]);
32+
Assert.NotNull (component.room.state ["players"]);
33+
Assert.NotNull (component.room.state ["messages"]);
3434
};
3535
}
3636
}

Assets/Tests/DeltaContainerTest.cs renamed to Assets/Tests/StateContainerTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
using Colyseus;
88
using GameDevWare.Serialization;
99

10-
public class DeltaContainerTest {
11-
DeltaContainer container;
10+
public class StateContainerTest {
11+
StateContainer container;
1212

1313
[SetUp]
1414
public void Init () {
15-
container = new DeltaContainer (GetRawData());
15+
container = new StateContainer (GetRawData());
1616
}
1717

1818
[TearDown]
@@ -192,7 +192,7 @@ public void ListenRemoveArray() {
192192

193193
[Test]
194194
public void ListenInitialState() {
195-
var container = new DeltaContainer (new IndexedDictionary<string, object>());
195+
var container = new StateContainer (new IndexedDictionary<string, object>());
196196
var listenCalls = 0;
197197

198198
container.Listen ("players/:id/position/:attribute", (DataChange change) => {
28 Bytes
Binary file not shown.

ProjectSettings/ProjectSettings.asset

3.86 KB
Binary file not shown.

0 commit comments

Comments
 (0)