示例#1
0
        public void AddCommand(BaseCommand command)
        {
            command.ValidateCommand(this);
            command.CommandId = CommandQueue.Count + 1;
            command.ExecuteCommand(this);
            CommandQueue.Enqueue(command);
            OnCommandExecuted(command);

            #region Invoke Command

            if (command.InvokedCommand != null)
            {
                try
                {
                    command.InvokedCommand.ValidateCommand(this);
                }
                catch (BaseException)
                {
                    return;
                }
                AddCommand(command.InvokedCommand);
            }

            #endregion
        }
示例#2
0
    //入栈   把命令压进  后退栈
    public void Execute(BaseCommand command)
    {
        if (cancleCommands.Count != 0)
        {
            cancleCommands.Clear();
        }

        backCommands.Push(command);
        command.ExecuteCommand();
    }
示例#3
0
    /// <summary>
    /// 执行新的命令
    /// </summary>
    public void ExecutiveCommand(BaseCommand command)
    {
        if (CloseCommandCompent)
        {
            return;
        }
        indexId++;
        CommandList db_command = new CommandList
        {
            id        = indexId,
            modelInfo = Vesal_DirFiles.Object2Bytes(new SceneModelState()),
        };

        local_db.DataService("Command.db");
        local_db.Insert(db_command);
        local_db.Close();
        DebugLog.DebugLogInfo("插入命令 " + indexId);
        command.ExecuteCommand();
        this.CanOperaCommand(true);
    }
示例#4
0
 protected override bool Execute(TBot bot, TMessage message, object arg = null)
 {
     BotConsole.Write(_logText);
     return(BaseCommand.ExecuteCommand(bot, message, arg));
 }