示例#1
0
    public static bool RunMessager <T, U, V>(int id, T t, U u, V v)
    {
        Delegate deleAll;

        if (mMessagerHandleDic.TryGetValue(id, out deleAll))
        {
            if (deleAll == null || deleAll.GetType() != typeof(CallBackClass.CallBack <T, U, V>))
            {
                return(false);
            }

            Delegate[] deleArray = deleAll.GetInvocationList();
            if (deleArray != null)
            {
                for (int i = 0; i < deleArray.Length; i++)
                {
                    CallBackClass.CallBack <T, U, V> callback = (CallBackClass.CallBack <T, U, V>)deleArray[i];
                    if (callback != null)
                    {
                        callback(t, u, v);
                    }
                }
            }
        }
        else
        {
            return(false);
        }
        return(true);
    }
示例#2
0
 public static bool RemoveMessager(int id, CallBackClass.CallBack callback)
 {
     if (mMessagerHandleDic.ContainsKey(id))
     {
         mMessagerHandleDic[id] = Delegate.Remove(mMessagerHandleDic[id], callback);
     }
     else
     {
         return(false);
     }
     return(true);
 }
示例#3
0
 public static void AddMessager <T, U, V>(int id, CallBackClass.CallBack <T, U, V> callback)
 {
     if (mMessagerHandleDic.ContainsKey(id))
     {
         if (CheakTypeEquality(mMessagerHandleDic[id], callback))
         {
             mMessagerHandleDic[id] = Delegate.Combine(mMessagerHandleDic[id], callback);
         }
     }
     else
     {
         mMessagerHandleDic.Add(id, callback);
     }
 }