public static void Dispatch(string type, AbstractMessage message = null) { ObjUnityEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(type, out thisEvent)) { thisEvent.Invoke(message); } }
public static void StopListening(string type, UnityAction <AbstractMessage> listener) { if (eventManager == null) { return; } ObjUnityEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(type, out thisEvent)) { thisEvent.RemoveListener(listener); } }
public static void Listen(string type, UnityAction <AbstractMessage> listener) { ObjUnityEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(type, out thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new ObjUnityEvent(); thisEvent.AddListener(listener); instance.eventDictionary.Add(type, thisEvent); } }