public static void StartListening <T0, T1>(string eventName, UnityAction <T0, T1> listener) { if (Instance == null) { return; } CustomEvent <T0, T1> thisEvent = null; object thisEventObject = null; if (Instance.eventDictionary.TryGetValue(eventName, out thisEventObject)) { thisEvent = thisEventObject as CustomEvent <T0, T1>; if (thisEvent == null) { thisEvent = new CustomEvent <T0, T1>(); thisEvent.AddListener(listener); Instance.eventDictionary[eventName] = thisEvent; } else { thisEvent.AddListener(listener); } } else { thisEvent = new CustomEvent <T0, T1>(); thisEvent.AddListener(listener); Instance.eventDictionary.Add(eventName, thisEvent); } }
public static void StartListening(string eventName, UnityAction <System.Object> listener) { CustomEvent thisEvent = null; if (Instance._eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new CustomEvent(); thisEvent.AddListener(listener); Instance._eventDictionary.Add(eventName, thisEvent); } }
public void StartListening(EventType eventType, UnityAction <EventInfo> listener) { CustomEvent thisEvent = null; if (eventDictionary.TryGetValue(eventType, out thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new CustomEvent(); thisEvent.AddListener(listener); eventDictionary.Add(eventType, thisEvent); } }
public static void StartListening(EventType eventType, UnityAction <string> listener) { CustomEvent thisEvent = null; if (Instance.m_EventMap.TryGetValue(eventType, out thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new CustomEvent(); thisEvent.AddListener(listener); Instance.m_EventMap.Add(eventType, thisEvent); } }
public void AddRightMouseDownListener(UnityAction <Event, bool> action) => onRightMouseDownEvent.AddListener(action);
public void AddLeftMouseUpListener(UnityAction <Event, bool> action) => onLeftMouseUpEvent.AddListener(action);
public void AddKeyUpListener(UnityAction <Event, bool> action) => onKeyUpEvent.AddListener(action);