/// <summary> /// Add new command for this console. /// </summary> /// <param name="prefix">Prefix of the command.</param> /// <param name="execution">Execution callback function.</param> public void AddCommand(string prefix, LuviCommandExecution execution) { if (!commandData.ContainsKey(prefix)) commandData.Add(prefix, execution); else throw new InvalidOperationException($"Already have {prefix} command."); }
public CommandData(string name, string description, LuviCommandExecution execution, bool executeImmediately = false, string group = null) { this.name = name; this.description = description; this.execution = execution; this.executeImmediately = executeImmediately; this.group = group; }
public void AddCommand(string prefix, string name, string description, LuviCommandExecution execution, bool executeImmediately = false, string group = null) { if (!commandData.ContainsKey(prefix)) { commandData.Add(prefix, new CommandData(name, description, execution, executeImmediately, group)); commandData.OrderBy(member => member.Value.group); } else { Debug.LogWarning($"Luvi Console already have {prefix} command, Disposed."); } }