Example #1
0
        public bool DispatchEvent <T, T1>(GameObject _target, string _eventName, ref T _t, T1 _t1)
        {
            List <SuperFunctionUnit> unitList = DispatchEventReal <SuperFunctionCallBackV1 <T, T1> >(_target, _eventName);

            if (unitList != null)
            {
                for (int i = 0; i < unitList.Count; i++)
                {
                    SuperFunctionUnit unit = unitList[i];

                    if (unit.isOnce)
                    {
                        RemoveEventListener(unit.index);
                    }

                    SuperFunctionCallBackV1 <T, T1> cb = unit.callBack as SuperFunctionCallBackV1 <T, T1>;

                    cb(unit.index, ref _t, _t1);
                }

                unitList.Clear();

                ReleaseList(unitList);

                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        internal bool DispatchEvent <T, T1>(string _eventName, ref T t, T1 t1)
        {
            LinkedList <SuperEventListenerUnit> linkedList = DispatchEventReal <SuperFunctionCallBackV1 <T, T1> >(_eventName);

            if (linkedList != null)
            {
                while (linkedList.First != null)
                {
                    LinkedListNode <SuperEventListenerUnit> node = linkedList.First;

                    SuperEventListenerUnit unit = node.Value;

                    SuperFunctionCallBackV1 <T, T1> cb = unit.callBack as SuperFunctionCallBackV1 <T, T1>;

                    cb(unit.index, ref t, t1);

                    ReleaseLinkedListNode(node);

                    linkedList.RemoveFirst();
                }

                ReleaseLinkedList(linkedList);

                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
 public void RemoveEventListener <T, T1>(GameObject _target, string _eventName, SuperFunctionCallBackV1 <T, T1> _callBack)
 {
     RemoveEventListenerReal(_target, _eventName, _callBack);
 }
Example #4
0
 public int AddEventListener <T, T1>(GameObject _target, string _eventName, SuperFunctionCallBackV1 <T, T1> _callBack)
 {
     return(AddEventListener(_target, _eventName, _callBack, false));
 }
Example #5
0
 internal void RemoveListener <T, T1>(string _eventName, SuperFunctionCallBackV1 <T, T1> _callBack)
 {
     RemoveListenerReal(_eventName, _callBack);
 }
Example #6
0
 internal int AddListener <T, T1>(string _eventName, SuperFunctionCallBackV1 <T, T1> _callBack, int _priority)
 {
     return(AddListenerReal(_eventName, _callBack, _priority));
 }