コード例 #1
0
ファイル: Console.cs プロジェクト: Kingofhearts102/CUDLR
        private void _add(string[] commands, int command_index, CommandAttribute cmd)
        {
            if (commands.Length == command_index) {
            m_command = cmd;
            return;
              }

              string token = commands[command_index];
              if (!m_subcommands.ContainsKey(token)){
            m_subcommands[token] = new CommandTree();
              }
              m_subcommands[token]._add(commands, command_index + 1, cmd);
        }
コード例 #2
0
ファイル: Console.cs プロジェクト: Kingofhearts102/CUDLR
 public void Add(CommandAttribute cmd)
 {
     _add(cmd.m_command.ToLower().Split(' '), 0, cmd);
 }
コード例 #3
0
ファイル: Console.cs プロジェクト: Kingofhearts102/CUDLR
 /* Queue a command to be executed on update on the main thread */
 public static void Queue(CommandAttribute command, string[] args)
 {
     QueuedCommand queuedCommand = new QueuedCommand();
       queuedCommand.command = command;
       queuedCommand.args = args;
       Instance.m_commandQueue.Enqueue( queuedCommand );
 }
コード例 #4
0
ファイル: Console.cs プロジェクト: Kingofhearts102/CUDLR
        /* Register a new console command */
        public static void RegisterCommand(string command, string desc, CommandAttribute.Callback callback, bool runOnMainThread = true)
        {
            if (command == null || command.Length == 0) {
            throw new Exception("Command String cannot be empty");
              }

              CommandAttribute cmd = new CommandAttribute(command, desc, runOnMainThread);
              cmd.m_callback = callback;

              Instance.m_commands.Add(cmd);
              Instance.m_help += string.Format("\n{0} : {1}", command, desc);
        }
コード例 #5
0
 public void Add(CommandAttribute cmd)
 {
     _add(cmd.m_command.ToLower().Split(' '), 0, cmd);
 }