public void CreateBinding(GameObject obj)
        {
            _viewGameObject = obj;
            _viewCanvas     = _viewGameObject.GetComponent <Canvas>();

            bool bFirst = false;
            var  view   = obj.GetComponent <CommonNoticeView>();

            if (view == null)
            {
                bFirst = true;
                view   = obj.AddComponent <CommonNoticeView>();
                view.FillField();
            }
            DataInit(view);
            SpriteReset();
            view.BindingContext().DataContext = this;
            if (bFirst)
            {
                SaveOriData(view);
                ViewBind(view);
            }
            _view = view;

            view.GenerateTrigger();
            EventTriggerBind(view);
        }
 void SaveOriData(CommonNoticeView view)
 {
     view.orirootActive   = _rootActive;
     view.oriYesBtnActive = _yesBtnActive;
     view.oriyNameText    = _yNameText;
     view.oriNoBtnActive  = _noBtnActive;
     view.orinNameText    = _nNameText;
     view.oriTitleText    = _titleText;
 }
 void DataInit(CommonNoticeView view)
 {
     _rootActive   = view.rootActive.activeSelf;
     _yesBtnActive = view.YesBtnActive.activeSelf;
     _yNameText    = view.yNameText.text;
     _noBtnActive  = view.NoBtnActive.activeSelf;
     _nNameText    = view.nNameText.text;
     _titleText    = view.TitleText.text;
 }
 private void EventTriggerBind(CommonNoticeView view)
 {
     _onOnYesBtnHoverChanged     = (val) => view.OnYesBtnHover = val;
     _onOnYesBtnClickChanged     = (val) => view.OnYesBtnClick = val;
     _onOnYesBtnMouseDownChanged = (val) => view.OnYesBtnMouseDown = val;
     _onOnYesBtnMouseUpChanged   = (val) => view.OnYesBtnMouseUp = val;
     _onOnYesBtnHoverExitChanged = (val) => view.OnYesBtnHoverExit = val;
     _onOnNoBtnHoverChanged      = (val) => view.OnNoBtnHover = val;
     _onOnNoBtnClickChanged      = (val) => view.OnNoBtnClick = val;
     _onOnNoBtnMouseDownChanged  = (val) => view.OnNoBtnMouseDown = val;
     _onOnNoBtnMouseUpChanged    = (val) => view.OnNoBtnMouseUp = val;
     _onOnNoBtnHoverExitChanged  = (val) => view.OnNoBtnHoverExit = val;
 }
        void ViewBind(CommonNoticeView view)
        {
            BindingSet <CommonNoticeView, CommonNoticeViewModel> bindingSet =
                view.CreateBindingSet <CommonNoticeView, CommonNoticeViewModel>();

            bindingSet.Bind(view.rootActive).For(v => v.activeSelf).To(vm => vm.rootActive).OneWay();
            bindingSet.Bind(view.YesBtnActive).For(v => v.activeSelf).To(vm => vm.YesBtnActive).OneWay();
            bindingSet.Bind(view.yNameText).For(v => v.text).To(vm => vm.yNameText).OneWay();
            bindingSet.Bind(view.NoBtnActive).For(v => v.activeSelf).To(vm => vm.NoBtnActive).OneWay();
            bindingSet.Bind(view.nNameText).For(v => v.text).To(vm => vm.nNameText).OneWay();
            bindingSet.Bind(view.TitleText).For(v => v.text).To(vm => vm.TitleText).OneWay();

            bindingSet.Build();
        }