예제 #1
0
        void Unsub <T>(Action <T> action)
        {
            HandlerBase handler = null;

            if (_handlers.TryGetValue(typeof(T), out handler))
            {
                (handler as Handler <T>).Unsubscribe(action);
            }
        }
예제 #2
0
        bool HasWatchersDirect <T>() where T : struct
        {
            HandlerBase container = null;

            if (_handlers.TryGetValue(typeof(T), out container))
            {
                return(container.Watchers.Count > 0);
            }
            return(false);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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");
                }
            }
        }