public bool DispatchEvent <T1>(GameObject _target, string _eventName, T1 t1) { List <SuperFunctionUnit> unitList = DispatchEventReal <SuperFunctionCallBack1 <T1> >(_target, _eventName); if (unitList != null) { for (int i = 0; i < unitList.Count; i++) { SuperFunctionUnit unit = unitList[i]; if (unit.isOnce) { RemoveEventListener(unit.index); } SuperFunctionCallBack1 <T1> cb = unit.callBack as SuperFunctionCallBack1 <T1>; cb(unit.index, t1); } unitList.Clear(); ReleaseList(unitList); return(true); } else { return(false); } }
internal bool DispatchEvent <T1>(string _eventName, T1 t1) { LinkedList <SuperEventListenerUnit> linkedList = DispatchEventReal <SuperFunctionCallBack1 <T1> >(_eventName); if (linkedList != null) { while (linkedList.First != null) { LinkedListNode <SuperEventListenerUnit> node = linkedList.First; SuperEventListenerUnit unit = node.Value; SuperFunctionCallBack1 <T1> cb = unit.callBack as SuperFunctionCallBack1 <T1>; cb(unit.index, t1); ReleaseLinkedListNode(node); linkedList.RemoveFirst(); } ReleaseLinkedList(linkedList); return(true); } else { return(false); } }
public void DispatchEvent <T1>(GameObject _target, string _eventName, T1 t1) { if (dic2.ContainsKey(_target)) { Dictionary <string, List <SuperFunctionUnit> > tmpDic = dic2[_target]; if (tmpDic.ContainsKey(_eventName)) { List <SuperFunctionUnit> tmpList = tmpDic[_eventName]; LinkedList <SuperFunctionUnit> unitList = null; for (int i = 0; i < tmpList.Count; i++) { SuperFunctionUnit unit = tmpList[i]; if (unit.callBack is SuperFunctionCallBack1 <T1> ) { if (unitList == null) { unitList = new LinkedList <SuperFunctionUnit>(); } unitList.AddLast(unit); } } if (unitList != null) { LinkedList <SuperFunctionUnit> .Enumerator enumerator = unitList.GetEnumerator(); while (enumerator.MoveNext()) { if (enumerator.Current.isOnce) { RemoveEventListener(enumerator.Current.index); } SuperFunctionCallBack1 <T1> cb = enumerator.Current.callBack as SuperFunctionCallBack1 <T1>; cb(enumerator.Current.index, t1); } } } } }
public int AddEventListener <T1>(GameObject _target, string _eventName, SuperFunctionCallBack1 <T1> _callBack) { return(AddEventListener(_target, _eventName, _callBack, false)); }
public void RemoveEventListener <T1>(GameObject _target, string _eventName, SuperFunctionCallBack1 <T1> _callBack) { RemoveEventListenerReal(_target, _eventName, _callBack); }
internal int AddListener <T1>(string _eventName, SuperFunctionCallBack1 <T1> _callBack, int _priority) { return(AddListenerReal(_eventName, _callBack, _priority)); }
internal void RemoveListener <T1>(string _eventName, SuperFunctionCallBack1 <T1> _callBack) { RemoveListenerReal(_eventName, _callBack); }