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