示例#1
0
    public void UnSubscribeEvent(int uiEvent, ref EventProcessFunc processFunc)
    {
        List <EventProcessFunc> funcList;

        if (mEventMap.TryGetValue(uiEvent, out funcList))
        {
            funcList.Remove(processFunc);
        }
    }
示例#2
0
 public void UnSubscribeEvent(int uiEvent, ref EventProcessFunc kProcessFunc)
 {
     if (mkEvent2ProcessMap.ContainsKey(uiEvent))
     {
         mkEvent2ProcessMap[uiEvent] -= kProcessFunc;
     }
     else
     {
         Debug.LogError("未注册过的事件(" + uiEvent + ")");
     }
 }
示例#3
0
    /// <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);
    }
示例#4
0
    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);
        }
    }
示例#5
0
        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);
            }
        }
示例#6
0
 /// <summary>
 /// 沒用的函數
 /// </summary>
 public bool ContainEvent(int eventId, ref EventProcessFunc fun)
 {
     return(false);
 }