void ViewBind(CommonMCountDownView view) { BindingSet <CommonMCountDownView, CommonMCountDownViewModel> bindingSet = view.CreateBindingSet <CommonMCountDownView, CommonMCountDownViewModel>(); bindingSet.Bind(view.rootActive).For(v => v.activeSelf).To(vm => vm.rootActive).OneWay(); bindingSet.Bind(view.countNumText).For(v => v.text).To(vm => vm.countNumText).OneWay(); bindingSet.Bind(view.numBgFillAmount).For(v => v.fillAmount).To(vm => vm.numBgFillAmount).OneWay(); bindingSet.Build(); }
public void CreateBinding(GameObject obj) { _viewGameObject = obj; _viewCanvas = _viewGameObject.GetComponent <Canvas>(); bool bFirst = false; var view = obj.GetComponent <CommonMCountDownView>(); if (view == null) { bFirst = true; view = obj.AddComponent <CommonMCountDownView>(); view.FillField(); } DataInit(view); SpriteReset(); view.BindingContext().DataContext = this; if (bFirst) { SaveOriData(view); ViewBind(view); } _view = view; }
void SaveOriData(CommonMCountDownView view) { view.orirootActive = _rootActive; view.oricountNumText = _countNumText; view.orinumBgFillAmount = _numBgFillAmount; }
void DataInit(CommonMCountDownView view) { _rootActive = view.rootActive.activeSelf; _countNumText = view.countNumText.text; _numBgFillAmount = view.numBgFillAmount.fillAmount; }
private void EventTriggerBind(CommonMCountDownView view) { }