public void StartListenEvent(string eKey, UnityAction <System.Object> listener) { if (_eventDictionary == null) { Debug.Log("Event Dic is null"); return; } ETOEvent uEvent = null; if (_eventDictionary.TryGetValue(eKey, out uEvent)) { if (uEvent != null) { uEvent.AddListener(listener); } else { uEvent = new ETOEvent(); uEvent.AddListener(listener); _eventDictionary.Add(eKey, uEvent); } } }
public void TriggerEvent(string eKey, System.Object param) { if (_eventDictionary == null) { Debug.Log("Event Dic is null"); return; } ETOEvent uEvent = null; if (_eventDictionary.TryGetValue(eKey, out uEvent)) { uEvent.Invoke(param); } }
public void StopListenEvent(string eKey) { if (_eventDictionary == null) { Debug.Log("Event Dic is null"); return; } ETOEvent uEvent = null; if (_eventDictionary.TryGetValue(eKey, out uEvent)) { if (uEvent != null) { uEvent.RemoveAllListeners(); _eventDictionary.Remove(eKey); } } }