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); } } }
public void Remove <T>(string eventName, Action <T> listener) { if (Warnings.Null(listener)) { return; } if (Warnings.Null(eventName)) { return; } _globalListeners.Remove(eventName, listener); }
public void Invoke <T>(string eventName, T sender) { if (Warnings.Null(sender)) { return; } if (Warnings.Null(eventName)) { return; } _globalListeners.Invoke(eventName, sender); }
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); }
// 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); } }
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); }
public virtual bool Check() { return(!(Warnings.Null(PawnTypes) || Warnings.Null(TerrainFlags))); }