Example #1
0
        public static void SendEventToRoots <T>(T sender, string eventID, string name = null)
        {
            if (Warnings.Null(sender))
            {
                return;
            }
            if (Warnings.Null(eventID))
            {
                return;
            }

            var contexts = GetRootContexts <UIContext>();

            if (name == null)
            {
                foreach (var context in contexts)
                {
                    context.HandleEvent(eventID, sender, name);
                }
            }
            else
            {
                foreach (var context in contexts)
                {
                    context.HandleEvent(eventID, sender);
                }
            }
        }
Example #2
0
        public void Remove <T>(string eventName, Action <T> listener)
        {
            if (Warnings.Null(listener))
            {
                return;
            }
            if (Warnings.Null(eventName))
            {
                return;
            }

            _globalListeners.Remove(eventName, listener);
        }
Example #3
0
        public void Invoke <T>(string eventName, T sender)
        {
            if (Warnings.Null(sender))
            {
                return;
            }
            if (Warnings.Null(eventName))
            {
                return;
            }

            _globalListeners.Invoke(eventName, sender);
        }
Example #4
0
        public void Remove <T>(string eventName, Action <T> listener, string objectName)
        {
            if (Warnings.Null(objectName))
            {
                return;
            }
            if (Warnings.Null(listener))
            {
                return;
            }
            if (Warnings.Null(eventName))
            {
                return;
            }

            _listeners.Remove(new EventID(objectName, eventName), listener);
        }
Example #5
0
        // TODO: provide a mechanism for contexts not usually in scope to peek at events

        public static void SendEventToParents <T>(T sender, string eventID, string name = null) where T : Component
        {
            if (Warnings.Null(sender))
            {
                return;
            }
            if (Warnings.Null(eventID))
            {
                return;
            }

            var contexts = GetParentContexts(sender);

            foreach (var context in contexts)
            {
                context.HandleEvent(eventID, sender, name);
            }
        }
Example #6
0
        public void Invoke <T>(string eventName, T sender, string objectName)
        {
            if (Warnings.Null(objectName))
            {
                return;
            }
            if (Warnings.Null(sender))
            {
                return;
            }
            if (Warnings.Null(eventName))
            {
                return;
            }

            _listeners.Invoke(new EventID(objectName, eventName), sender);
            _globalListeners.Invoke(eventName, sender);
        }
Example #7
0
 public virtual bool Check()
 {
     return(!(Warnings.Null(PawnTypes) || Warnings.Null(TerrainFlags)));
 }