private static string HelpConsoleCommand(string param) { if (string.IsNullOrEmpty(param)) { return("Type " + Color("help list [description]", "33EE33") + " for a list of possible commands, or " + Color("help <command>", "33EE33") + " for a description of a certain command."); } if (param == "list description" || param == "list [description]") { return(GetHelpList(true)); } else if (param == "list") { return(GetHelpList(false)); } else if (commands.ContainsKey(param)) { GConsoleCommand command = commands[param]; return(Color(param, "33EE33") + " " + command.description + "\n" + (command.helpText == null ? String.Empty : (Color(command.helpText, "DDDDDD")))); } else { return("Help not found for " + Color(param, "33EE33")); } }
public static bool AddCommand(string command, string description, Func <string, string> method, string helpText = null) { //Check for invalid command strings. if (string.IsNullOrEmpty(command)) { Debug.LogError("Could not add ConsoleCommand \"" + command + "\" because it is empty!"); return(false); } if (commands.ContainsKey(command)) { Debug.LogError("Could not add ConsoleCommand \"" + command + "\" because it already exists."); return(false); } //Add the command to the dictionary. GConsoleCommand consoleCommand = new GConsoleCommand(description, method, helpText); commands.Add(command, consoleCommand); SortCommands(); return(true); }
public static bool AddCommand(string command, string description, Func<string, string> method, string helpText = null) { //Check for invalid command strings. if (string.IsNullOrEmpty(command)) { Debug.LogError("Could not add ConsoleCommand \"" + command + "\" because it is empty!"); return false; } if (commands.ContainsKey(command)) { Debug.LogError("Could not add ConsoleCommand \"" + command + "\" because it already exists."); return false; } //Add the command to the dictionary. GConsoleCommand consoleCommand = new GConsoleCommand(description, method, helpText); commands.Add(command, consoleCommand); SortCommands(); return true; }