Ejemplo n.º 1
0
        internal void ApplyDiff(ViewDiff diff)
        {
            if (diff.Disconnected)
            {
                OnDisconnect(diff.DisconnectMessage);
                return;
            }

            foreach (var entityId in diff.GetEntitiesAdded())
            {
                AddEntity(entityId);
            }

            foreach (var manager in managers)
            {
                manager.ApplyDiff(diff);
            }

            foreach (var entityId in diff.GetEntitiesRemoved())
            {
                RemoveEntity(entityId);
            }
        }
Ejemplo n.º 2
0
        internal void ApplyDiff(ViewDiff diff)
        {
            using (applyDiffMarker.Auto())
            {
                entitiesAdded.Clear();
                entitiesRemoved.Clear();

                // todo decide on a container and remove this
                foreach (var entityId in diff.GetEntitiesAdded())
                {
                    entitiesAdded.Add(entityId);
                }

                foreach (var entityId in diff.GetEntitiesRemoved())
                {
                    entitiesRemoved.Add(entityId);
                }

                if (entitiesAdded.Count != 0 || entitiesRemoved.Count != 0)
                {
                    ViewVersion += 1;
                }
            }
        }
            public EntityTemplateDynamicHandler(EntityTemplate template, long entityId, ViewDiff viewDiff)
            {
                this.template = template;
                this.viewDiff = viewDiff;
                this.entityId = entityId;

                viewDiff.AddEntity(this.entityId);
            }
 public RemoveEntityTemplateDynamicHandler(EntityTemplate template, long entityId, ViewDiff viewDiff)
 {
     this.template = template;
     this.entityId = entityId;
     this.viewDiff = viewDiff;
 }