Ejemplo n.º 1
0
 /// <summary>
 /// Adds a Single Command to the System.
 /// </summary>
 /// <param name="cmd"></param>
 public static void AddCommand(AbstractCommand cmd)
 {
     if (IsInterfering(cmd))
     {
         Logger.Log(LogType.Log, "Command:" + cmd.GetType().FullName + " is interfering with other Commands.");
     }
     Commands.Add(cmd);
 }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        public bool IsInterfering(AbstractCommand other)
        {
            for (int i = 0; i < CommandKeys.Length; i++)
            {
                if (other.CommandKeys.Contains(CommandKeys[i]))
                {
                    return(true);
                }
            }

            return(false);
        }