private void SendCommand(GameCommand command) { if (currentCommand) { Debug.LogError("Can't send command while awaiting response."); return; } GameObject commandPrefab = null; if (command.CommandPrefabName != null) { commandPrefab = commandPrefabs.GetPrefab(command.CommandPrefabName); if (commandPrefab == null) { Debug.LogError("Command specified a prefab, but one was not found by that name: " + command.CommandPrefabName); } } if (commandPrefab != null) { GameObject go = Instantiate(commandPrefab); currentCommand = go.GetComponent <CommandBehaviour>(); go.transform.parent = transform; if (currentCommand == null) { Debug.LogError("Command prefab missing CommandBehaviour"); } currentCommand.Command = command; } validPlays = null; if (commandFilter != null) { commandFilter.HandleCommand(command); } GameClient.Instance.SendRequest(command); }
protected virtual bool IsUploadEnabled(HttpContext context) { CommandInfo info = typeof(Upload).GetCommandInfo(); CommandBehaviour behaviour = _options.BuiltInCommandBehaviours[info.Name]; return(behaviour.IsEnabled); }
//Создание новой комманды, //parent - родитель, start, finish - проценты от родителя, //isDanger - задает опасную операцию, isProgress - процент отображается на индикаторе //context - контекст в котором выполняется комманда (проект, провайдер и т.п.) public Command(Logger logger, Command parent, double start, double finish, CommandBehaviour behaviour, bool isProgress) { Logger = logger; Parent = parent; StartProcent = start; FinishProcent = finish; Behaviour = behaviour; IsProgress = isProgress; Quality = CommandQuality.Success; Procent = 0; }
public void AckReceived(int id) { Debug.Log("Received ack id " + id + " for " + currentCommand); if (currentCommand != null) { if (currentCommand.Command.ackId == id) { currentCommand.Finish(); currentCommand = null; } else { Debug.LogWarning("Received ack id '" + id + "', but didn't match expected '" + currentCommand.Command.ackId + "'"); } } }
//Создание новой комманды без указания процентов //parent - родитель, isDanger - задает опасную операцию, isProgress - процент отображается на индикаторе //context - контекст в котором выполняется комманда (проект, провайдер и т.п.) public Command(Logger logger, Command parent, CommandBehaviour behaviour, bool isProgress) { Logger = logger; Parent = parent; if (parent == null) { StartProcent = 0; FinishProcent = 100; } else { StartProcent = Parent.Procent; FinishProcent = Parent.Procent; } Behaviour = behaviour; IsProgress = isProgress; Quality = CommandQuality.Success; Procent = 0; }
public void AddCommand(CommandID id, CommandBehaviour command) { commands.Add(id, command); }
public CommandLog(Logger logger, Command parent, CommandBehaviour behaviour, double start, double finish, bool isProgress) : base(logger, parent, start, finish, behaviour, isProgress) { StartTime = DateTime.Now; LogEventTime = DateTime.Now; }
//******************************************************************************* // Util Functions //******************************************************************************* private void addCommandBehaviour(string command, Action<ReceivedData> callBack) { CommandBehaviour messageBehaviour = new CommandBehaviour(command, callBack); commandBehaviours.Add(messageBehaviour); }