예제 #1
0
 public static void UnRegister(EventType1 eventType, OneObjEventHandler handler)
 {
     if (EventMap1.ContainsKey(eventType))
     {
         EventMap1[eventType] -= handler;
     }
 }
예제 #2
0
 /// <summary>
 /// 触发事件;事件接受一个参数
 /// </summary>
 /// <param name="eventType">事件类型</param>
 /// <param name="obj">传递给所有事件回调函数的参数</param>
 public static void Send(EventType1 eventType, object obj)
 {
     if (EventMap1.ContainsKey(eventType) && EventMap1[eventType] != null)
     {
         try
         {
             EventMap1[eventType](obj);
         }
         catch (Exception ex)
         {
             Debug.LogError($"An exception occured while event({eventType}) send. {ex}");
         }
     }
 }
예제 #3
0
 /// <summary>
 /// 触发事件;事件接受一个参数
 /// </summary>
 /// <param name="eventType">事件类型</param>
 /// <param name="obj">传递给所有事件回调函数的参数</param>
 public static void Send(EventType1 eventType, object obj)
 {
     if (EventMap1.ContainsKey(eventType) && EventMap1[eventType] != null)
     {
         try
         {
             EventMap1[eventType](obj);
         }
         catch (Exception ex)
         {
             Debug.LogError("An exception occured while event(" + eventType.ToString() + ") send. " + ex.ToString());
         }
     }
 }