void Unsub <T>(Action <T> action) { HandlerBase handler = null; if (_handlers.TryGetValue(typeof(T), out handler)) { (handler as Handler <T>).Unsubscribe(action); } }
bool HasWatchersDirect <T>() where T : struct { HandlerBase container = null; if (_handlers.TryGetValue(typeof(T), out container)) { return(container.Watchers.Count > 0); } return(false); }
void FireEvent <T>(T args) { HandlerBase handler = null; if (!_handlers.TryGetValue(typeof(T), out handler)) { handler = _handlers.GetOrAdd(typeof(T), new Handler <T>()); } (handler as Handler <T>).Fire(args); }
void FillEvent(HandlerBase handler, EventData data) { data.MonoWatchers.Clear(); data.OtherWatchers.Clear(); var watchIter = handler.Watchers.GetEnumerator(); while (watchIter.MoveNext()) { var item = watchIter.Current; if (item is MonoBehaviour) { data.MonoWatchers.Add(item as MonoBehaviour); } else { data.OtherWatchers.Add(item != null ? GetTypeNameFromCache(item.GetType()) : "null"); } } }