コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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);
                }
            }
        }