コード例 #1
0
ファイル: CommandManager.cs プロジェクト: tmcfar/galacdecks
    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);
    }
コード例 #2
0
ファイル: TerminalInitializer.cs プロジェクト: ooaavee/beavis
        protected virtual bool IsUploadEnabled(HttpContext context)
        {
            CommandInfo      info      = typeof(Upload).GetCommandInfo();
            CommandBehaviour behaviour = _options.BuiltInCommandBehaviours[info.Name];

            return(behaviour.IsEnabled);
        }
コード例 #3
0
 //Создание новой комманды,
 //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;
 }
コード例 #4
0
ファイル: CommandManager.cs プロジェクト: tmcfar/galacdecks
 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 + "'");
         }
     }
 }
コード例 #5
0
 //Создание новой комманды без указания процентов
 //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;
 }
コード例 #6
0
ファイル: CommandHandler.cs プロジェクト: DBeumans/Puzzle_2D
 public void AddCommand(CommandID id, CommandBehaviour command)
 {
     commands.Add(id, command);
 }
コード例 #7
0
 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;
 }
コード例 #8
0
 //*******************************************************************************
 // Util Functions
 //*******************************************************************************
 private void addCommandBehaviour(string command, Action<ReceivedData> callBack)
 {
     CommandBehaviour messageBehaviour = new CommandBehaviour(command, callBack);
     commandBehaviours.Add(messageBehaviour);
 }