Ejemplo n.º 1
0
        public void RemoveListener <TParam>(EventDefineEnum eventID, TDelegate <TParam> eventHandle)
        {
            int index = (int)eventID;

            if (CheckValid(index, eventHandle, true))
            {
                listenerTarget[index].Remove(eventHandle);
            }
        }
Ejemplo n.º 2
0
        public void AddListener(EventDefineEnum eventID, TDelegate eventHandle)
        {
            int index = (int)eventID;

            if (CheckValid(index, eventHandle))
            {
                listenerTarget[index].Add(eventHandle);
            }
        }
Ejemplo n.º 3
0
        public void SendEvent(EventDefineEnum eventID)
        {
            int index = (int)eventID;

            if (index > listenerTarget.Length)
            {
                DebugHelper.LogError("EventDefine Error :" + eventID);
                return;
            }
            for (int i = 0; i < listenerTarget[index].Count; i++)
            {
                TDelegate tempDelegate = listenerTarget[index][i] as TDelegate;
                if (tempDelegate != null)
                {
                    tempDelegate();
                }
            }
        }
Ejemplo n.º 4
0
        public void SendEvent <TParam>(EventDefineEnum eventID, TParam param)
        {
            int index = (int)eventID;

            if (index > listenerTarget.Length)
            {
                UnityEngine.Debug.LogError("EventDefine Error : " + eventID);
            }

            for (int i = 0; i < listenerTarget[index].Count; i++)
            {
                TDelegate <TParam> tempDelegate = listenerTarget[index][i] as TDelegate <TParam>;

                if (tempDelegate != null)
                {
                    tempDelegate(param);
                }
            }
        }