void ViewBind(CommonHurtedView view) { BindingSet <CommonHurtedView, CommonHurtedViewModel> bindingSet = view.CreateBindingSet <CommonHurtedView, CommonHurtedViewModel>(); bindingSet.Bind(view.hurtedRootActive).For(v => v.activeSelf).To(vm => vm.hurtedRootActive).OneWay(); bindingSet.Build(); }
public void CreateBinding(GameObject obj) { _viewGameObject = obj; _viewCanvas = _viewGameObject.GetComponent <Canvas>(); bool bFirst = false; var view = obj.GetComponent <CommonHurtedView>(); if (view == null) { bFirst = true; view = obj.AddComponent <CommonHurtedView>(); view.FillField(); } DataInit(view); SpriteReset(); view.BindingContext().DataContext = this; if (bFirst) { SaveOriData(view); ViewBind(view); } _view = view; }
void SaveOriData(CommonHurtedView view) { view.orihurtedRootActive = _hurtedRootActive; }
void DataInit(CommonHurtedView view) { _hurtedRootActive = view.hurtedRootActive.activeSelf; }
private void EventTriggerBind(CommonHurtedView view) { }