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]); } } }
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())); } } }
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]); } } }