public DataBindingConnection(GameObject owner, BindTarget src, BindTarget dst, IValueConverter converter = null)
        {
            _gameObject = owner;
            _src        = src;
            _dst        = dst;
            _converter  = converter;

            PropertyChangedAction = OnSrcUpdated;

            BindingMonitor.RegisterConnection(this);
        }
Exemple #2
0
        // Use this for initialization
        protected virtual void Awake()
        {
            _dstViewModel = ViewModelProvider.Instance.GetViewModelBehaviour(ViewModelName);

            dst = new BindTarget(_dstViewModel, DstPropName);
            if (isProperty)
            {
                src = new BindTarget(_srcView, value);
            }

            BindEvent();
        }
        public override void RegisterDataBinding()
        {
            if (isBound)
            {
                return;
            }
            if (_viewModel == null)
            {
                Debug.LogErrorFormat("Binding Error | Could not Find ViewModel {0} for collection {1}", ViewModelName,
                                     SrcCollectionName);

                return;
            }

            src = SrcCollectionName.ToBindTarget(_viewModel, true);
            if (!(src is null))
            {
                _subscription = src.ReactiveCollectionBind(CollectionAdd, CollectionRemove, CollectionReplace,
                                                           CollectionMove, CollectionReset);
            }


            isBound = true;
        }