示例#1
0
 /// <summary>
 /// Adds a Single Command to the System.
 /// </summary>
 /// <param name="cmd"></param>
 public static void AddCommand(AbstractCommand cmd)
 {
     if (IsInterfering(cmd))
     {
         Console.WriteLine("Command:" + cmd.GetType().FullName + " is interfering with other Commands.");
     }
     _commands.Add(cmd);
 }
示例#2
0
        public bool IsInterfering(AbstractCommand other)
        {
            for (int i = 0; i < CommandKeys.Length; i++)
            {
                if (other.CommandKeys.Contains(CommandKeys[i]))
                {
                    return(true);
                }
            }

            return(false);
        }
示例#3
0
        /// <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 static bool IsInterfering(AbstractCommand cmd)
        {
            for (int i = 0; i < _commands.Count; i++)
            {
                if (cmd.IsInterfering(_commands[i]))
                {
                    return(true);
                }
            }

            return(false);
        }