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

            PropertyChangedAction = OnSrcUpdated;

            BindingMonitor.RegisterConnection(this);
        }
예제 #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();
        }
예제 #3
0
        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;
        }