Beispiel #1
0
            public override void OnAddComponent(AddComponentOp op)
            {
                if (!IsValidEntityId(op.EntityId, "AddComponentOp", out var entity))
                {
                    return;
                }

                var data = Generated.Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFields.Serialization.Deserialize(op.Data.SchemaData.Value.GetFields(), World);

                data.DirtyBit = false;
                entityManager.AddComponentData(entity, data);
                entityManager.AddComponentData(entity, new NotAuthoritative <Generated.Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFields.Component>());

                var update = new Generated.Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFields.Update
                {
                };

                var updates = new List <Generated.Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFields.Update>
                {
                    update
                };

                var updatesComponent = new Generated.Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFields.ReceivedUpdates
                {
                    handle = ReferenceTypeProviders.UpdatesProvider.Allocate(World)
                };

                ReferenceTypeProviders.UpdatesProvider.Set(updatesComponent.handle, updates);
                entityManager.AddComponentData(entity, updatesComponent);

                if (entityManager.HasComponent <ComponentRemoved <Generated.Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFields.Component> >(entity))
                {
                    entityManager.RemoveComponent <ComponentRemoved <Generated.Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFields.Component> >(entity);
                }
                else if (!entityManager.HasComponent <ComponentAdded <Generated.Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFields.Component> >(entity))
                {
                    entityManager.AddComponentData(entity, new ComponentAdded <Generated.Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFields.Component>());
                }
                else
                {
                    LogDispatcher.HandleLog(LogType.Error, new LogEvent(ReceivedDuplicateComponentAdded)
                                            .WithField(LoggingUtils.LoggerName, LoggerName)
                                            .WithField(LoggingUtils.EntityId, op.EntityId.Id)
                                            .WithField("Component", "Generated.Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFields")
                                            );
                }
            }
Beispiel #2
0
            public static Generated.Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFields.Update GetAndApplyUpdate(global::Improbable.Worker.Core.SchemaObject obj, ref Generated.Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFields.Component component)
            {
                var update = new Generated.Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFields.Update();

                return(update);
            }