public UnityEventWatcher(Component component, string eventName, Action action) { this.component = component; this.eventName = eventName; this.action = action; this.unityEventBinder = new UnityEventBinderFactory().Create(GetBoundEvent(eventName, component).UnityEvent, action); }
public void Dispose() { if (unityEventBinder != null) { unityEventBinder.Dispose(); unityEventBinder = null; } }
/// <summary> /// Create a new EventBinder /// </summary> public EventBinder(GameObject gameObject, string methodName, string eventName, string boundComponentType, IAdapter adapter, IViewModelBinding viewModel) { this.gameObject = gameObject; this.boundEventName = eventName; this.boundComponentType = boundComponentType; var boundEvent = GetBoundEvent(); if (adapter == null) { unityEventBinder = new UnityEventBinderFactory().Create(boundEvent.UnityEvent, viewModel, methodName); } else { unityEventBinder = new UnityEventBinderFactory().Create(boundEvent.UnityEvent, viewModel, methodName, adapter); } }