public static void StartListening(string eventName, UnityAction <Hashtable> listener) { if (Instance.eventDictionary.TryGetValue(eventName, out ThisEvent thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new ThisEvent(); thisEvent.AddListener(listener); Instance.eventDictionary.Add(eventName, thisEvent); } }
public static void StartListening(string eventName, UnityAction <string> listener) { ThisEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new ThisEvent(); thisEvent.AddListener(listener); instance.eventDictionary.Add(eventName, thisEvent); } }
/// <summary> /// function called to insert an event in the dictionary. /// </summary> /// <param name="eventName"> Event to listen to. </param> /// <param name="listener"> Callback action to be called on event. </param> public static void StartListening(string eventName, UnityAction <string> listener) { //print("EventManager:StartListening eventName = " + eventName); ThisEvent thisEvent = null; if (Instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new ThisEvent(); thisEvent.AddListener(listener); Instance.eventDictionary.Add(eventName, thisEvent); } }