public static void ReplicateEverything( this IMessageSender messageSender, MessagePool messagePool, ConnectionId receiver, ReplicatedObjectStore store) { var existingObjectIds = store.ObjectIds; for (int i = 0; i < existingObjectIds.Count; i++) { var objectId = existingObjectIds[i]; var @object = store.Find(objectId); messageSender.Replicate(messagePool, receiver, @object); } }
public static void RemoveAll(this ReplicatedObjectStore store, ConnectionId connectionId) { ObjectIdCache.Clear(); store.ObjectIds.CopyListInto(ObjectIdCache); for (int i = 0; i < ObjectIdCache.Count; i++) { var objectId = ObjectIdCache[i]; var instance = store.Find(objectId); if (instance.OwnerConnectionId == connectionId || instance.AuthorityConnectionId == connectionId) { store.RemoveReplicatedInstance(connectionId, objectId); } } }