public static void TriggerEvent(string eventName, object param) { ParamEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.Invoke(param); } }
public static void TriggerEvent(string eventName, string eventParam) { ParamEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.Invoke(eventParam); } else { Debug.LogWarning("event dictionary does not contain: " + eventName); } }
public static void StopListening(string eventName, ParamEvent listener) { ParamEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent -= listener; if (thisEvent == null) { instance.eventDictionary.Remove(eventName); } } }
public static void StopListening(string eventName, UnityAction <object> listener) { if (eventManager == null) { return; } ParamEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.RemoveListener(listener); } }
public static void StartListening(string eventName, ParamEvent listener) { ParamEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent += listener; } else { thisEvent = listener; instance.eventDictionary.Add(eventName, thisEvent); } }
public static void StartListening(string eventName, UnityAction <object> listener) { ParamEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new ParamEvent(); thisEvent.AddListener(listener); instance.eventDictionary.Add(eventName, thisEvent); } }