Exemplo n.º 1
0
            public void ApplyDiff(ViewDiff diff)
            {
                var diffStorage = (DiffComponentStorage)diff.GetComponentDiffStorage(ComponentId);

                foreach (var entityId in diffStorage.GetComponentsAdded())
                {
                    AddComponent(entityId);
                }

                var updates        = diffStorage.GetUpdates();
                var dataFromEntity = workerSystem.GetComponentDataFromEntity <Component>();

                for (int i = 0; i < updates.Count; ++i)
                {
                    ApplyUpdate(in updates[i], dataFromEntity);
                }

                var authChanges = diffStorage.GetAuthorityChanges();

                for (int i = 0; i < authChanges.Count; ++i)
                {
                    ref readonly var change = ref authChanges[i];
Exemplo n.º 2
0
            public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
            {
                if (op.Update.SchemaData.Value.GetFields().GetUniqueFieldIdCount() > 0)
                {
                    var update = global::Improbable.DependentSchema.DependentDataComponent.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);
                    diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
                }
                var eventsObject = op.Update.SchemaData.Value.GetEvents();

                {
                    var eventCount = eventsObject.GetObjectCount(1);
                    if (eventCount > 0)
                    {
                        for (uint i = 0; i < eventCount; i++)
                        {
                            var payload = global::Improbable.TestSchema.SomeType.Serialization.Deserialize(eventsObject.IndexObject(1, i));
                            var e       = new FooEvent.Event(payload);
                            diff.AddEvent(e, op.EntityId, op.Update.ComponentId, updateId);
                        }
                    }
                }
            }
            public void AddResponseToDiff(CommandResponseOp op, ViewDiff diff, CommandMetaDataAggregate commandMetaData)
            {
                global::Improbable.Gdk.Tests.ComponentsWithNoFields.Empty?rawResponse = null;
                if (op.StatusCode == StatusCode.Success)
                {
                    rawResponse = global::Improbable.Gdk.Tests.ComponentsWithNoFields.Empty.Serialization.Deserialize(op.Response.SchemaData.Value.GetObject());
                }

                var commandContext = commandMetaData.GetContext <global::Improbable.Gdk.Tests.ComponentsWithNoFields.Empty>(ComponentId, 1, op.RequestId);

                commandMetaData.MarkIdForRemoval(ComponentId, 1, op.RequestId);

                var response = new Cmd.ReceivedResponse(
                    commandContext.SendingEntity,
                    new EntityId(op.EntityId),
                    op.Message,
                    op.StatusCode,
                    rawResponse,
                    commandContext.Request,
                    commandContext.Context,
                    commandContext.RequestId);

                diff.AddCommandResponse(response, ComponentId, 1);
            }
            public void AddResponseToDiff(CommandResponseOp op, ViewDiff diff, CommandMetaData commandMetaData)
            {
                global::Improbable.TestSchema.SomeType?rawResponse = null;
                if (op.StatusCode == StatusCode.Success)
                {
                    rawResponse = global::Improbable.TestSchema.SomeType.Serialization.Deserialize(op.Response.SchemaData.Value.GetObject());
                }

                var commandContext = commandMetaData.GetContext <global::Improbable.TestSchema.SomeType>(ComponentId, 1, op.RequestId);

                commandMetaData.RemoveRequest(ComponentId, 1, op.RequestId);

                var response = new BarCommand.ReceivedResponse(
                    commandContext.SendingEntity,
                    new EntityId(op.EntityId),
                    op.Message,
                    op.StatusCode,
                    rawResponse,
                    commandContext.Request,
                    commandContext.Context,
                    commandContext.RequestId);

                diff.AddCommandResponse(response, ComponentId, 1);
            }
Exemplo n.º 5
0
            public void AddComponentToDiff(AddComponentOp op, ViewDiff diff)
            {
                var data = Serialization.DeserializeUpdate(op.Data.SchemaData.Value);

                diff.AddComponent(data, op.EntityId, op.Data.ComponentId);
            }
Exemplo n.º 6
0
            public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
            {
                var update = global::Improbable.Gdk.Tests.ExhaustiveOptional.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);

                diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
            }
            public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
            {
                var update = Improbable.PlayerLifecycle.PlayerCreator.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);

                diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
            }
            public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
            {
                var update = global::Com.Infalliblecode.PlayerTransform.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);

                diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
            }
            public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
            {
                var update = global::Improbable.Gdk.TransformSynchronization.TransformInternal.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);

                diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
            }
Exemplo n.º 10
0
 internal void ApplyDiff(ViewDiff diff)
 {
     lastIncomingData.CopyFrom(diff.GetNetStats());
 }
            public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
            {
                var update = global::Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFieldsWithCommands.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);

                diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
            }
Exemplo n.º 12
0
            public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
            {
                var update = global::Improbable.Restricted.Worker.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);

                diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
            }
            public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
            {
                var update = global::Improbable.Tests.DependencyTestGrandchild.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);

                diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
            }
            public void AddUpdateToDiff(ComponentUpdateOp op, ViewDiff diff, uint updateId)
            {
                var update = Improbable.Gdk.Health.HealthRegenComponent.Serialization.DeserializeUpdate(op.Update.SchemaData.Value);

                diff.AddComponentUpdate(update, op.EntityId, op.Update.ComponentId, updateId);
            }