public void OneTimeSetup()
        {
            world         = new World("test-world");
            logDispatcher = new TestLogDispatcher();
            world.CreateManager <WorkerSystem>(null, logDispatcher, TestWorkerType, Vector3.zero);

            sendSystem = world.GetOrCreateManager <SpatialOSSendSystem>();

            var testHandler = new TestComponentReplicationHandler(world.GetOrCreateManager <EntityManager>());

            sendSystem.AddComponentReplicator(testHandler);
        }
 public override void SendCommands(SpatialOSSendSystem sendSystem, global::Improbable.Worker.Core.Connection connection)
 {
     var entityType = sendSystem.GetArchetypeChunkEntityType();
 }
Beispiel #3
0
 public override void SendCommands(SpatialOSSendSystem sendSystem, global::Improbable.Worker.Core.Connection connection)
 {
 }
Beispiel #4
0
 protected override void OnCreate()
 {
     spatialOsSendSystem = World.GetExistingSystem <SpatialOSSendSystem>();
 }
Beispiel #5
0
 public abstract void SendCommands(SpatialOSSendSystem sendSystem, Connection connection);
Beispiel #6
0
            public override void SendCommands(SpatialOSSendSystem sendSystem, global::Improbable.Worker.Core.Connection connection)
            {
                Profiler.BeginSample("ComponentWithNoFieldsWithCommands");
                var entityType = sendSystem.GetArchetypeChunkEntityType();

                {
                    var senderType    = sendSystem.GetArchetypeChunkComponentType <Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFieldsWithCommands.CommandSenders.Cmd>(true);
                    var responderType = sendSystem.GetArchetypeChunkComponentType <Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFieldsWithCommands.CommandResponders.Cmd>(true);

                    var chunks = EntityManager.CreateArchetypeChunkArray(CommandQueries[0], Allocator.TempJob);
                    foreach (var chunk in chunks)
                    {
                        var entities   = chunk.GetNativeArray(entityType);
                        var senders    = chunk.GetNativeArray(senderType);
                        var responders = chunk.GetNativeArray(responderType);
                        for (var i = 0; i < senders.Length; i++)
                        {
                            var requests  = senders[i].RequestsToSend;
                            var responses = responders[i].ResponsesToSend;
                            if (requests.Count > 0)
                            {
                                foreach (var request in requests)
                                {
                                    var schemaCommandRequest = new global::Improbable.Worker.Core.SchemaCommandRequest(ComponentId, 1);
                                    global::Improbable.Gdk.Tests.ComponentsWithNoFields.Empty.Serialization.Serialize(request.Payload, schemaCommandRequest.GetObject());

                                    var requestId = connection.SendCommandRequest(request.TargetEntityId,
                                                                                  new global::Improbable.Worker.Core.CommandRequest(schemaCommandRequest),
                                                                                  request.TimeoutMillis,
                                                                                  request.AllowShortCircuiting ? ShortCircuitParameters : null);

                                    cmdStorage.CommandRequestsInFlight[requestId.Id] =
                                        new CommandRequestStore <global::Improbable.Gdk.Tests.ComponentsWithNoFields.Empty>(entities[i], request.Payload, request.Context, request.RequestId);
                                }

                                requests.Clear();
                            }

                            if (responses.Count > 0)
                            {
                                foreach (var response in responses)
                                {
                                    var requestId = new global::Improbable.Worker.Core.RequestId <IncomingCommandRequest>(response.RequestId);

                                    if (response.FailureMessage != null)
                                    {
                                        // Send a command failure if the string is non-null.
                                        connection.SendCommandFailure(requestId, response.FailureMessage);
                                        continue;
                                    }

                                    var schemaCommandResponse = new global::Improbable.Worker.Core.SchemaCommandResponse(ComponentId, 1);
                                    global::Improbable.Gdk.Tests.ComponentsWithNoFields.Empty.Serialization.Serialize(response.Payload.Value, schemaCommandResponse.GetObject());

                                    connection.SendCommandResponse(requestId, new global::Improbable.Worker.Core.CommandResponse(schemaCommandResponse));
                                }

                                responses.Clear();
                            }
                        }
                    }

                    chunks.Dispose();
                }

                Profiler.EndSample();
            }
 public override void SendCommands(SpatialOSSendSystem sendSystem, Connection connection)
 {
     throw new System.NotImplementedException();
 }