private void OnCmdRequest(CommandRequestOp op) { if (!IsValidEntityId(op.EntityId, "CommandRequestOp", out var entity)) { return; } var deserializedRequest = global::Generated.Improbable.Gdk.Tests.ComponentsWithNoFields.Empty.Serialization.Deserialize(op.Request.SchemaData.Value.GetObject()); List <Generated.Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFieldsWithCommands.Cmd.ReceivedRequest> requests; if (entityManager.HasComponent <Generated.Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFieldsWithCommands.CommandRequests.Cmd>(entity)) { requests = entityManager.GetComponentData <Generated.Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFieldsWithCommands.CommandRequests.Cmd>(entity).Requests; } else { var data = new Generated.Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFieldsWithCommands.CommandRequests.Cmd { CommandListHandle = Generated.Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFieldsWithCommands.ReferenceTypeProviders.CmdRequestsProvider.Allocate(World) }; requests = data.Requests = new List <Generated.Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFieldsWithCommands.Cmd.ReceivedRequest>(); entityManager.AddComponentData(entity, data); } requests.Add(new Generated.Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFieldsWithCommands.Cmd.ReceivedRequest(op.RequestId.Id, op.CallerWorkerId, op.CallerAttributeSet, deserializedRequest)); }
public override void OnCommandRequest(CommandRequestOp op) { if (!IsValidEntityId(op.EntityId, "CommandRequestOp", out var entity)) { return; } var commandIndex = op.Request.SchemaData.Value.GetCommandIndex(); switch (commandIndex) { case 1: OnCmdRequest(op); break; default: LogDispatcher.HandleLog(LogType.Error, new LogEvent(CommandIndexNotFound) .WithField(LoggingUtils.LoggerName, LoggerName) .WithField(LoggingUtils.EntityId, op.EntityId.Id) .WithField("CommandIndex", commandIndex) .WithField("Component", "Generated.Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFieldsWithCommands") ); break; } }
public override void OnCommandRequest(CommandRequestOp op) { var commandIndex = op.Request.SchemaData.Value.GetCommandIndex(); switch (commandIndex) { default: throw new UnknownCommandIndexException(commandIndex, "ExhaustiveOptional"); } }
public override void OnCommandRequest(CommandRequestOp op) { var commandIndex = op.Request.SchemaData.Value.GetCommandIndex(); switch (commandIndex) { default: throw new UnknownCommandIndexException(commandIndex, "ComponentWithNoFieldsWithEvents"); } }
internal void OnCommandRequest(CommandRequestOp op) { if (!componentSpecificDispatchers.TryGetValue(op.Request.ComponentId, out var specificDispatcher)) { throw new UnknownComponentIdException( string.Format(Errors.UnknownComponentIdError, op.GetType(), op.Request.ComponentId)); } specificDispatcher.OnCommandRequest(op); }
public static WrappedOp <CommandRequestOp> CreateCommandRequestOp(uint componentId, uint commandIndex, long requestId) { var schemaRequest = new SchemaCommandRequest(componentId, commandIndex); var op = new CommandRequestOp { Request = new CommandRequest(schemaRequest), RequestId = new RequestId <IncomingCommandRequest>(requestId) }; return(new WrappedOp <CommandRequestOp>(op)); }
private void OnCommandRequest(CommandRequestOp op) { if (!componentSpecificDispatchers.TryGetValue(op.Request.ComponentId, out var specificDispatcher)) { worker.LogDispatcher.HandleLog(LogType.Error, new LogEvent(UnknownComponentIdError).WithField("Op Type", op.GetType()) .WithField("ComponentId", op.Request.ComponentId)); return; } specificDispatcher.OnCommandRequest(op); }
public void AddRequestToDiff(CommandRequestOp op, ViewDiff diff) { var deserializedRequest = global::Improbable.Restricted.DisconnectRequest.Serialization.Deserialize(op.Request.SchemaData.Value.GetObject()); var request = new Disconnect.ReceivedRequest( new EntityId(op.EntityId), op.RequestId, op.CallerWorkerId, op.CallerAttributeSet, deserializedRequest); diff.AddCommandRequest(request, ComponentId, 1); }
public void AddRequestToDiff(CommandRequestOp op, ViewDiff diff) { var deserializedRequest = global::Improbable.Gdk.Tests.ComponentsWithNoFields.Empty.Serialization.Deserialize(op.Request.SchemaData.Value.GetObject()); var request = new Cmd.ReceivedRequest( new EntityId(op.EntityId), op.RequestId, op.CallerWorkerId, op.CallerAttributeSet, deserializedRequest); diff.AddCommandRequest(request, ComponentId, 1); }
public override void OnCommandRequest(CommandRequestOp op) { var commandIndex = op.Request.SchemaData.Value.GetCommandIndex(); Profiler.BeginSample("ComponentWithNoFieldsWithCommands"); switch (commandIndex) { case 1: OnCmdRequest(op); break; default: throw new UnknownCommandIndexException(commandIndex, "ComponentWithNoFieldsWithCommands"); } Profiler.EndSample(); }
public void OnCommandRequestSecondCommand(CommandRequestOp <global::Improbable.Gdk.Tests.BlittableTypes.BlittableComponent.Commands.SecondCommand> op) { Unity.Entities.Entity entity; if (!view.TryGetEntity(op.EntityId.Id, out entity)) { LogDispatcher.HandleLog(LogType.Error, new LogEvent("Entity not found during OnCommandRequest.") .WithField(LoggingUtils.LoggerName, LoggerName) .WithField(LoggingUtils.EntityId, op.EntityId.Id) .WithField(MutableView.Component, "SpatialOSBlittableComponent")); return; } var requestPayload = op.Request.Get().Value; var unityRequestPayload = global::Generated.Improbable.Gdk.Tests.BlittableTypes.SecondCommandRequest.ToNative(requestPayload); var request = new SecondCommand.Request(op.RequestId.Id, this, op.CallerWorkerId, op.CallerAttributeSet, unityRequestPayload); view.AddCommandRequest(entity, request, SecondCommandRequestPool); }
public override void OnCommandRequest(CommandRequestOp op) { if (!IsValidEntityId(op.EntityId, "CommandRequestOp", out var entity)) { return; } var commandIndex = op.Request.SchemaData.Value.GetCommandIndex(); switch (commandIndex) { default: LogDispatcher.HandleLog(LogType.Error, new LogEvent(CommandIndexNotFound) .WithField(LoggingUtils.LoggerName, LoggerName) .WithField(LoggingUtils.EntityId, op.EntityId.Id) .WithField("CommandIndex", commandIndex) .WithField("Component", "SpatialOSExhaustiveSingular") ); break; } }
private static Entity CreatePlayerTemplate(CommandRequestOp <Automaton.Spawner.Commands.SpawnPlayer> op, Coordinates position) { var callerWorkerRequirementSet = new WorkerRequirementSet(new Improbable.Collections.List <WorkerAttributeSet> { new WorkerAttributeSet(op.CallerAttributeSet) }); var gameWorkerAttr = new WorkerAttributeSet(new Improbable.Collections.List <string> { "GameWorker" }); var clientWorkerAttr = new WorkerAttributeSet(new Improbable.Collections.List <string>() { "TPSClient" }); var gameWorkerRequirementSet = new WorkerRequirementSet(new Improbable.Collections.List <WorkerAttributeSet> { gameWorkerAttr }); var allRequirementSet = new WorkerRequirementSet(new Improbable.Collections.List <WorkerAttributeSet> { clientWorkerAttr, gameWorkerAttr }); var writeAcl = new Map <uint, WorkerRequirementSet> { { Position.ComponentId, callerWorkerRequirementSet }, { EntityAcl.ComponentId, gameWorkerRequirementSet }, { Movement.ComponentId, callerWorkerRequirementSet }, { Automaton.Player.Player.ComponentId, callerWorkerRequirementSet }, { Score.ComponentId, gameWorkerRequirementSet } }; Entity entity = new Entity(); entity.Add(new EntityAcl.Data(/* read */ allRequirementSet, /* write */ writeAcl)); entity.Add(new Metadata.Data("SpatialOsPlayer")); entity.Add(new Position.Data(position)); entity.Add(new Movement.Data(false, new Quaternion(1, 0, 0, 0), false)); entity.Add(new Automaton.Player.Player.Data()); entity.Add(new Score.Data(0, 0)); return(entity); }
private void HandleCommandRequest(CommandRequestOp op) { commandRequestCallbacks.InvokeAll(op); }
static void OnGenerateResourceRequest(CommandRequestOp <Harvestable.Commands.GenerateResource, ResourceGenerationRequest> op) { generateResourceRequestOps.Enqueue(op); }
static void OnExtractResourceRequest(CommandRequestOp <Harvestable.Commands.ExtractResource, ResourceExtractionRequest> op) { extractResourceRequestOps.Enqueue(op); }
public override void OnCommandRequest(CommandRequestOp op) { var commandIndex = op.Request.SchemaData.Value.GetCommandIndex(); throw new UnknownCommandIndexException(commandIndex, "NestedComponent"); }
public override void OnCommandRequest(CommandRequestOp op) { HasCommandRequestReceived = true; }
static void OnChatRequest(CommandRequestOp <Communication.Commands.Chat, ChatMessage> op) => chatMessageOps.Enqueue(op);
internal static void OnCreatePlayerRequest(CommandRequestOp <PlayerSpawner.Commands.CreatePlayer, CreatePlayerRequest> op) { commandRequestOps.Enqueue(op); }
public abstract void OnCommandRequest(CommandRequestOp op);
public static void OnPopulateGridCell(CommandRequestOp <AsteroidSpawner.Commands.PopulateGridCell, PopulateGridCellRequest> op) { commandRequestOps.Enqueue(op); }
public override void OnCommandRequest(CommandRequestOp op) { var commandIndex = op.Request.SchemaData.Value.GetCommandIndex(); throw new UnknownCommandIndexException(commandIndex, "ExhaustiveBlittableSingular"); }