/// <summary> /// Checks if the system is already containing a command with the same command keys /// </summary> /// <param name="cmd">The Command</param> /// <returns>Returns true when interfering with other commands.</returns> private bool _IsInterfering(AbstractCommand cmd) { for (int i = 0; i < Commands.Count; i++) { if (cmd.IsInterfering(Commands[i])) { return(true); } } return(false); }
public bool IsInterfering(AbstractCommand other) { for (int i = 0; i < CommandKeys.Length; i++) { if (other.CommandKeys.Contains(CommandKeys[i])) { return(true); } } return(false); }
/// <summary> /// Adds a Single Command to the System. /// </summary> /// <param name="cmd"></param> public void _AddCommand(AbstractCommand cmd) { Logger.Log(LogType.Log, "Adding Command: " + cmd.GetType().FullName, 2); if (_IsInterfering(cmd)) { Logger.Log( LogType.Log, "Command:" + cmd.GetType().FullName + " is interfering with other Commands.", 1 ); } Commands.Add(cmd); }
public static void AddCommand(AbstractCommand cmd) { instance._AddCommand(cmd); }
public static bool IsInterfering(AbstractCommand cmd) { return(instance._IsInterfering(cmd)); }