/// <summary>
 /// 注册事件
 /// </summary>
 /// <param name="type"> 事件类型 </param>
 /// <param name="listener"> 回调函数 </param>
 public void AddListener(string type, listenerBack listener)
 {
     if (!listeners.ContainsKey(type))
     {
         listeners.Add(type, new ArrayList());
     }
     listeners[type].Add(listener);
 }
 /// <summary>
 /// 移除事件
 /// </summary>
 /// <param name="type"> 事件类型 </param>
 /// <param name="listener"> 回调函数 </param>
 public void RemoveListener(string type, listenerBack listener)
 {
     if (listeners.ContainsKey(type))
     {
         ArrayList list = listeners[type];
         foreach (listenerBack item in list)
         {
             if (item == listener)
             {
                 list.Remove(item);
                 break;
             }
         }
     }
 }
Beispiel #3
0
 public void RemoveListener(string type, listenerBack listener)
 {
     dispatcher.RemoveListener(type, listener);
 }
Beispiel #4
0
 public void AddListener(string type, listenerBack listener)
 {
     dispatcher.AddListener(type, listener);
 }