Exemplo n.º 1
0
        public void RemoveEventListener <T0, T1> (EventId evtId, UnityAction <T0, T1> listener)
        {
            int eventId = (int)evtId;

            if (!_dicEvents.ContainsKey(eventId))
            {
                return;
            }
            else
            {
                EventTT <T0, T1> uEvent = _dicEvents[eventId] as EventTT <T0, T1>;
                if (uEvent != null)
                {
                    uEvent.RemoveListener(listener);
                }
                else
                {
                    LogTypeError(eventId, listener, EventSystemDefine.dicHandleType[1]);
                }
            }
        }
Exemplo n.º 2
0
        public void TriggerEvent <T0, T1> (EventId evtId, T0 p0, T1 p1)
        {
            int eventId = (int)evtId;

            if (!_dicEvents.ContainsKey(eventId))
            {
                return;
            }
            else
            {
                EventTT <T0, T1> uEvent = _dicEvents[eventId] as EventTT <T0, T1>;
                if (uEvent != null)
                {
                    uEvent.Invoke(p0, p1);
                }
                else
                {
                    Debug.LogError(string.Format("## Event Trigger need Type {0}", _dicEvents[eventId].GetType()));
                }
            }
        }
Exemplo n.º 3
0
        public void AddEventListener <T0, T1> (EventId evtId, UnityAction <T0, T1> listener)
        {
            int eventId = (int)evtId;

            if (!_dicEvents.ContainsKey(eventId))
            {
                EventTT <T0, T1> newEvent = new EventTT <T0, T1>();
                newEvent.AddListener(listener);
                _dicEvents[eventId] = newEvent;
            }
            else
            {
                EventTT <T0, T1> uEvent = _dicEvents[eventId] as EventTT <T0, T1>;
                if (uEvent != null)
                {
                    uEvent.AddListener(listener);
                }
                else
                {
                    LogTypeError(eventId, listener, EventSystemDefine.dicHandleType[0]);
                }
            }
        }