private void InvokeEventCaller(UnityEventType type)
        {
            if (!eventCallers.ContainsKey(type))
            {
                return;
            }

            eventCallers[type].CallEventHanlder(null);
        }
 protected override void TriggerEvent(UnityEventType eventType)
 {
     foreach (var trigger in triggers)
     {
         if (eventType == trigger.eventType)
         {
             trigger.Raise();
         }
     }
 }
        /// <summary>
        /// 移除一个Unity类型的事件处理器。
        /// </summary>
        /// <param name="type">Type.</param>
        /// <param name="action">Action.</param>
        public void RemoveUnityEvent(UnityEventType type, Action action)
        {
            if (!eventCallers.ContainsKey(type))
            {
#if UNITY_EDITOR
                Debug.LogWarning(
                    $"尝试移除一个不存在的Unity事件类型,事件类型为{type}");
#endif
                return;
            }

            var caller = eventCallers[type];
            caller.RemoveHandler(action);
        }
 public void WatchUnityEvent(UnityEventType type, Action action)
 {
     if (!eventCallers.ContainsKey(type))
     {
         var newCaller = new EventHandlerList();
         newCaller.AddHandler(action);
         eventCallers.Add(type, newCaller);
     }
     else
     {
         var caller = eventCallers[type];
         caller.AddHandler(action);
     }
 }
Ejemplo n.º 5
0
 public void RemoveUnityEvent(UnityEventType type, Action action)
 {
     eventComponent.RemoveUnityEvent(type, action);
 }
Ejemplo n.º 6
0
 public void WatchUnityEvent(UnityEventType type, Action action)
 {
     eventComponent.WatchUnityEvent(type, action);
 }
Ejemplo n.º 7
0
 protected abstract void TriggerEvent(UnityEventType eventType);
Ejemplo n.º 8
0
 public UnityEventInfo(UnityEventType EventType, PointerEventData EventData)
 {
     this.EventType = EventType;
     this.EventData = EventData;
 }