public void UnSubscribeEvent(int uiEvent, ref EventProcessFunc processFunc) { List <EventProcessFunc> funcList; if (mEventMap.TryGetValue(uiEvent, out funcList)) { funcList.Remove(processFunc); } }
public void UnSubscribeEvent(int uiEvent, ref EventProcessFunc kProcessFunc) { if (mkEvent2ProcessMap.ContainsKey(uiEvent)) { mkEvent2ProcessMap[uiEvent] -= kProcessFunc; } else { Debug.LogError("未注册过的事件(" + uiEvent + ")"); } }
/// <summary> /// 沒用的函數 /// </summary> public static bool ContainProcess(ref EventProcessFunc funcList, ref EventProcessFunc processFunc) { foreach (EventProcessFunc func in funcList.GetInvocationList()) { if (func == processFunc) { return(true); } } return(false); }
public void SubscribeEvent(int uiEvent, ref EventProcessFunc processFunc) { List <EventProcessFunc> funcList; if (!mEventMap.TryGetValue(uiEvent, out funcList)) { funcList = new List <EventProcessFunc>(); mEventMap.Add(uiEvent, funcList); } if (!funcList.Contains(processFunc)) { funcList.Add(processFunc); } }
public void SubscribeEvent(int eventID, ref EventProcessFunc kProcessFunc) { EventProcessFunc kFuncList; if (mkEvent2ProcessMap.TryGetValue(eventID, out kFuncList)) { if (kFuncList != null && ContainProcess(ref kFuncList, ref kProcessFunc)) { Debug.LogError(string.Format("重复添加的处理函数[{0}+{1}]", kProcessFunc.Target, kProcessFunc.Method)); } else { mkEvent2ProcessMap[eventID] += kProcessFunc; } } else { mkEvent2ProcessMap.Add(eventID, kProcessFunc); } }
/// <summary> /// 沒用的函數 /// </summary> public bool ContainEvent(int eventId, ref EventProcessFunc fun) { return(false); }