public override void RegisterDataBinding() { base.RegisterDataBinding(); var propInfo = _dstView.GetType().GetProperty(_dstChangedEventName); var type = propInfo.PropertyType.BaseType; var args = type.GetGenericArguments(); var evn = propInfo.GetValue(_dstView); var addListenerMethod = UnityEventBinder.GetAddListener(propInfo.GetValue(_dstView)); changeDelegate = UnityEventBinder.GetDelegate(_binder, args); var p = new object[] { changeDelegate }; _binder.OnChange += _connection.DstUpdated; addListenerMethod.Invoke(propInfo.GetValue(_dstView), p); }
private void BindDstChangedHandler() { //Debug.Log($"Bind DstChangedHandler {_gameObject}"); var owner = DstTarget.propertyOwner; var propInfo = owner.GetType().GetProperty(DstTarget.eventName); var type = propInfo.PropertyType.BaseType; var args = type.GetGenericArguments(); var evn = propInfo.GetValue(owner); var addListenerMethod = UnityEventBinder.GetAddListener(propInfo.GetValue(owner)); changeDelegate = UnityEventBinder.GetDelegate(_eventBinder, args); var p = new object[] { changeDelegate }; _eventBinder.OnChange += DstUpdated; addListenerMethod.Invoke(propInfo.GetValue(owner), p); }