コード例 #1
0
        private void SendNotifyToObject(NotifyParam notify)
        {
            if (dispatchList.ContainsKey(notify.key))
            {
                Dictionary <Action <NotifyParam>, uGaMaBehaviour> actions = dispatchList[notify.key];

                for (int i = 0; i < actions.Count; i++)
                {
                    uGaMaBehaviour tmpBehavior = actions.Values.ElementAt(i);
                    tmpBehavior.OnHandlerNotify(notify, actions.Keys.ElementAt(i));
                }
            }
        }
コード例 #2
0
 public void RemoveListener(uGaMaBehaviour obj, object dispatchKey, Action <NotifyParam> callback)
 {
     if (dispatchList.ContainsKey(dispatchKey))
     {
         Dictionary <Action <NotifyParam>, uGaMaBehaviour> actions = dispatchList[dispatchKey];
         for (int i = 0; i < actions.Count; i++)
         {
             if (actions.Keys.ElementAt(i) == callback && actions.Values.ElementAt(i) == obj)
             {
                 actions.Remove(actions.Keys.ElementAt(i));
             }
         }
     }
 }
コード例 #3
0
 public void AddListener(uGaMaBehaviour obj, object dispatchKey, Action <NotifyParam> callback)
 {
     if (!dispatchList.ContainsKey(dispatchKey))
     {
         Dictionary <Action <NotifyParam>, uGaMaBehaviour> actions = new Dictionary <Action <NotifyParam>, uGaMaBehaviour>();
         actions.Add(callback, obj);
         dispatchList.Add(dispatchKey, actions);
     }
     else
     {
         Dictionary <Action <NotifyParam>, uGaMaBehaviour> actions = dispatchList[dispatchKey];
         actions.Add(callback, obj);
     }
 }
コード例 #4
0
ファイル: Dispatcher.cs プロジェクト: CengizKuscu/uGaMa-v2.0
 public void RemoveListener(uGaMaBehaviour obj, object dispatchKey, Action<NotifyParam> callback)
 {
     if(dispatchList.ContainsKey(dispatchKey))
     {
         Dictionary<Action<NotifyParam>, uGaMaBehaviour> actions = dispatchList[dispatchKey];
         for (int i = 0; i < actions.Count; i++)
         {
             if(actions.Keys.ElementAt(i) == callback && actions.Values.ElementAt(i) == obj)
             {
                 actions.Remove(actions.Keys.ElementAt(i));
             }
         }
     }
 }
コード例 #5
0
ファイル: Dispatcher.cs プロジェクト: CengizKuscu/uGaMa-v2.0
 public void AddListener(uGaMaBehaviour obj, object dispatchKey, Action<NotifyParam> callback)
 {
     if(!dispatchList.ContainsKey(dispatchKey))
     {
         Dictionary<Action<NotifyParam>, uGaMaBehaviour> actions = new Dictionary<Action<NotifyParam>, uGaMaBehaviour>();
         actions.Add(callback, obj);
         dispatchList.Add(dispatchKey, actions);
     }
     else
     {
         Dictionary<Action<NotifyParam>, uGaMaBehaviour> actions = dispatchList[dispatchKey];
         actions.Add(callback, obj);
     }
 }
コード例 #6
0
 public void RemoveAllListeners(uGaMaBehaviour obj)
 {
     foreach (KeyValuePair <object, Dictionary <Action <NotifyParam>, uGaMaBehaviour> > item in dispatchList)
     {
         Dictionary <Action <NotifyParam>, uGaMaBehaviour> actions = item.Value;
         if (actions.ContainsValue(obj))
         {
             for (int i = 0; i < actions.Count; i++)
             {
                 if (actions.Values.ElementAt(i) == obj)
                 {
                     actions.Remove(actions.Keys.ElementAt(i));
                 }
             }
         }
     }
 }
コード例 #7
0
ファイル: Dispatcher.cs プロジェクト: CengizKuscu/uGaMa-v2.0
 public void RemoveAllListeners(uGaMaBehaviour obj)
 {
     foreach (KeyValuePair<object, Dictionary<Action<NotifyParam>, uGaMaBehaviour>> item in dispatchList)
     {
         Dictionary<Action<NotifyParam>, uGaMaBehaviour> actions = item.Value;
         if(actions.ContainsValue(obj))
         {
             for (int i = 0; i < actions.Count; i++)
             {
                 if(actions.Values.ElementAt(i) == obj)
                 {
                     actions.Remove(actions.Keys.ElementAt(i));
                 }
             }
         }
     }
 }