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); } }
public void RemoveUnityEvent(UnityEventType type, Action action) { eventComponent.RemoveUnityEvent(type, action); }
public void WatchUnityEvent(UnityEventType type, Action action) { eventComponent.WatchUnityEvent(type, action); }
protected abstract void TriggerEvent(UnityEventType eventType);
public UnityEventInfo(UnityEventType EventType, PointerEventData EventData) { this.EventType = EventType; this.EventData = EventData; }