/// <summary>
        /// Makes a copy of this event arg set
        /// </summary>
        /// <returns>An independent copy of this event argument set</returns>
        public EventArgSet Copy()
        {
            EventArgSet copy = new EventArgSet(Strict, Event, new object[] { });

            copy.m_args = m_args.ToDictionary(p => p.Key, q => new Queue <object>(q.Value));
            return(copy);
        }
Exemple #2
0
        /// <summary>
        /// Executes this event executor. Returns true if the event execution was successful,
        /// or false if the given arg set is missing any values required for this event listener
        /// to execute
        /// </summary>
        /// <param name="args">ArgSet containing all arguments the event was executed with</param>
        /// <returns>True if the event listener executed successfully, or false otherwise</returns>
        public bool Execute(EventArgSet args)
        {
            var values = ArgTypes.Select(p => args.GetArg(p)).ToArray();

            if (values.Contains(null))
            {
                return(false);
            }
            else if (values.Length == 0)
            {
                Listener.Invoke(Controller, null);
            }
            else
            {
                Listener.Invoke(Controller, values);
            }
            return(true);
        }
Exemple #3
0
 /// <summary>
 /// Queues an event to be executed
 /// </summary>
 /// <param name="ev">The event to execute</param>
 public void QueueEvent(EventArgSet ev)
 {
     m_events.Enqueue(ev);
 }