Beispiel #1
0
    public override void Run(string argString)
    {
        string[] args = GameConsoleUtility.SplitArgsAndTrim(argString);

        // We first need to make sure there is only one argument
        if (args.Length == 0)
        {
            DeveloperConsole.Instance.AddToTextLog("help: Please provide a command.");
        }
        else if (args.Length > 1)
        {
            DeveloperConsole.Instance.AddToTextLog("help: Please only enter one command argument.");
        }
        else
        {
            List <Command> commandList = DeveloperConsole.Instance.Console.CommandList;
            // Check whether the argument matches a keyword in the command list
            foreach (Command command in commandList)
            {
                foreach (string keyword in command.Keywords)
                {
                    if (args[0] == keyword)
                    {
                        DeveloperConsole.Instance.AddToTextLog(command.Help);
                        return;
                    }
                }
            }
            DeveloperConsole.Instance.AddToTextLog("help: The specified command was not found.");
        }
    }