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);
 }
Ejemplo n.º 2
0
 public void Dispose()
 {
     if (unityEventBinder != null)
     {
         unityEventBinder.Dispose();
         unityEventBinder = null;
     }
 }
Ejemplo n.º 3
0
        /// <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);
            }
        }