Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Commit 82c49b5

Browse files
authored
Subscription cleanup (#1200)
* Fix filename * Fix folder name * Split Callbacks.cs into separate files per class * Remove unused EntitySubscriptions.cs Folder rename metafiles * AggregateSubscriptions are now made by the SubscriptionSystem * Don't clear empty lists Named tuples * Formatting to style guide * Remove GuardedAuthorityCallbackManagerSet as its a duplicated of the GuardedCallbackManagerSet * Callback arguments are passed as ref readonly (in) * Remove unused HashSet in WorkerFlagSubscriptionManager * Have subscriptions use Option<T> instead of re-implementing optional values * Changelog
1 parent 8710dd5 commit 82c49b5

File tree

52 files changed

+259
-292
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+259
-292
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616

1717
- Generated Worker ID's for local development are now smaller and easier to read for debugging. [#1197](https://github.com/spatialos/gdk-for-unity/pull/1197)
1818

19+
### Internal
20+
21+
- Cleaned up Subscriptions and Callbacks. [#1200](https://github.com/spatialos/gdk-for-unity/pull/1200)
22+
- Replaced usage of `GuardedAuthorityCallbackManagerSet` with more generic `GuardedCallbackManagerSet`.
23+
- Removed unused `EntitySubscriptions` class.
24+
- Formatting pass on all Subscriptions and Callbacks files.
25+
1926
## `0.2.10` - 2019-10-14
2027

2128
### Breaking Changes

workers/unity/Packages/io.improbable.gdk.core/Subscriptions/CalllbackManagers.meta renamed to workers/unity/Packages/io.improbable.gdk.core/Subscriptions/CallbackManagers.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public AuthorityConstraintCallbackManager(uint componentId, World world)
2222
public void InvokeCallbacks()
2323
{
2424
var changes = componentUpdateSystem.GetAuthorityChangesReceived(componentId);
25-
for (int i = 0; i < changes.Count; ++i)
25+
for (var i = 0; i < changes.Count; ++i)
2626
{
2727
if (changes[i].Authority == Authority.Authoritative)
2828
{
@@ -38,7 +38,7 @@ public void InvokeCallbacks()
3838
public void InvokeLossImminentCallbacks()
3939
{
4040
var changes = componentUpdateSystem.GetAuthorityChangesReceived(componentId);
41-
for (int i = 0; i < changes.Count; ++i)
41+
for (var i = 0; i < changes.Count; ++i)
4242
{
4343
if (changes[i].Authority == Authority.AuthorityLossImminent)
4444
{
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public CommandRequestCallbackManager(World world)
2020
public void InvokeCallbacks()
2121
{
2222
var requests = commandSystem.GetRequests<T>();
23-
for (int i = 0; i < requests.Count; ++i)
23+
for (var i = 0; i < requests.Count; ++i)
2424
{
2525
ref readonly var request = ref requests[i];
2626
callbacks.InvokeAll(request.GetEntityId().Id, request);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public CommandResponseCallbackManager(World world)
2020
public void InvokeCallbacks()
2121
{
2222
var responses = commandSystem.GetResponses<T>();
23-
for (int i = 0; i < responses.Count; ++i)
23+
for (var i = 0; i < responses.Count; ++i)
2424
{
2525
ref readonly var response = ref responses[i];
2626
callbacks.InvokeAll(response.GetRequestId(), response);
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using Improbable.Gdk.Core;
3-
using Improbable.Worker.CInterop;
43
using Unity.Entities;
54

65
namespace Improbable.Gdk.Subscriptions
@@ -23,9 +22,9 @@ public ComponentAddedCallbackManager(uint componentId, World world)
2322
public void InvokeCallbacks()
2423
{
2524
var entities = componentUpdateSystem.GetComponentsAdded(componentId);
26-
for (int i = 0; i < entities.Count; ++i)
25+
foreach (var entityId in entities)
2726
{
28-
callbacks.InvokeAll(entities[i]);
27+
callbacks.InvokeAll(entityId);
2928
}
3029
}
3130

0 commit comments

Comments
 (0)