public static void RemoveEventListener(string _eventType, CustomEventHandler _listener) { CustomEventWrapper eWrapper = null; if (events.TryGetValue(_eventType, out eWrapper)) { eWrapper.OnHandler -= _listener; } }
public static void DispatchEvent(CustomEvent _event) { CustomEventWrapper eWrapper = null; if (events.TryGetValue(_event.EventType, out eWrapper)) { eWrapper.Invoke(_event); } }
public static void AddEventListener(string _eventType, CustomEventHandler _listener) { CustomEventWrapper eWrapper = null; if (!events.TryGetValue(_eventType, out eWrapper)) { eWrapper = new CustomEventWrapper(); eWrapper.OnHandler += _listener; events.Add(_eventType, eWrapper); } else { eWrapper.OnHandler += _listener; } }