예제 #1
0
 public void PubCustomEvent(string eventName, object ud)
 {
     try {
         if (_customSub.ContainsKey(eventName))
         {
             List <EventListenerCustom> li = _customSub[eventName];
             if (li.Count > 0)
             {
                 for (int i = 0; i < li.Count; i++)
                 {
                     EventListenerCustom listener = li[i];
                     if (listener.Enable)
                     {
                         EventCustom e = new EventCustom(_ctx, eventName, listener.Addition, ud);
                         listener.Handler(e);
                     }
                 }
             }
         }
         else
         {
             throw new KeyNotFoundException(string.Format("custom not contains {0}", eventName));
         }
     } catch (Exception ex) {
         UnityEngine.Debug.LogException(ex);
     }
 }
예제 #2
0
 private void DispatchCustomEvent(string eventName, object ud)
 {
     try {
         if (_custom.ContainsKey(eventName))
         {
             EventListenerCustom listener = _custom[eventName];
             if (listener.Enable)
             {
                 EventCustom e = new EventCustom(_ctx, eventName, listener.Addition, ud);
                 listener.Handler(e);
             }
         }
         else
         {
             throw new KeyNotFoundException(string.Format("custom not contains {0}", eventName));
         }
     } catch (Exception ex) {
         UnityEngine.Debug.LogException(ex);
     }
 }