Пример #1
0
 public static void UnRegister(EventType2 eventType, TwoObjEventHandler handler)
 {
     if (EventMap2.ContainsKey(eventType))
     {
         EventMap2[eventType] -= handler;
     }
 }
Пример #2
0
 /// <summary>
 /// 触发事件;事件接受两个参数
 /// </summary>
 /// <param name="eventType">事件类型</param>
 /// <param name="obj1">传递给所有事件回调函数的第一个参数</param>
 /// <param name="obj2">传递给所有事件回调函数的第二个参数</param>
 public static void Send(EventType2 eventType, object obj1, object obj2)
 {
     if (EventMap2.ContainsKey(eventType) && EventMap2[eventType] != null)
     {
         try
         {
             EventMap2[eventType](obj1, obj2);
         }
         catch (Exception ex)
         {
             Debug.LogError($"An exception occured while event({eventType}) send. {ex}");
         }
     }
 }
Пример #3
0
 /// <summary>
 /// 触发事件;事件接受两个参数
 /// </summary>
 /// <param name="eventType">事件类型</param>
 /// <param name="obj1">传递给所有事件回调函数的第一个参数</param>
 /// <param name="obj2">传递给所有事件回调函数的第二个参数</param>
 public static void Send(EventType2 eventType, object obj1, object obj2)
 {
     if (EventMap2.ContainsKey(eventType) && EventMap2[eventType] != null)
     {
         try
         {
             EventMap2[eventType](obj1, obj2);
         }
         catch (Exception ex)
         {
             Debug.LogError("An exception occured while event(" + eventType.ToString() + ") send. " + ex.ToString());
         }
     }
 }