public void RemoveEventListener(EM_EventType type) { string key = Enum.GetName(type.GetType(), type); if (dict.ContainsKey(key)) { dict.Remove(key); } }
public void RaiseEvent(EM_EventType type, EventParm parm) { string key = Enum.GetName(type.GetType(), type); if (dict.ContainsKey(key)) { dict[key](parm); } }
public void RemoveEventListener(EventBase obj, EM_EventType type) { int key = GetDictKey(obj); if (dict.ContainsKey(key)) { dict[key].RemoveEventListener(type); } }
public void AddEventListener(EM_EventType type, Action <EventParm> action) { string key = Enum.GetName(type.GetType(), type); if (dict.ContainsKey(key)) { dict[key] += action; } else { dict.Add(key, action); } }
public void AddEventListener(EventBase obj, EM_EventType type, Action <EventParm> action) { int key = GetDictKey(obj); if (dict.ContainsKey(key)) { dict[key].AddEventListener(type, action); } else { dict.Add(key, obj); obj.AddEventListener(type, action); } }
public void RaiseEvent(EM_EventType type, EventParm parm) { var enumerator = dict.GetEnumerator(); while (enumerator.MoveNext()) { EventBase obj = enumerator.Current.Value; if (obj) { obj.RaiseEvent(type, parm); } } enumerator.Dispose(); }