void ViewBind(CommonRevengeTagView view) { BindingSet <CommonRevengeTagView, CommonRevengeTagViewModel> bindingSet = view.CreateBindingSet <CommonRevengeTagView, CommonRevengeTagViewModel>(); bindingSet.Bind(view.Show).For(v => v.activeSelf).To(vm => vm.Show).OneWay(); bindingSet.Bind(view.TagPos).For(v => v.anchoredPosition).To(vm => vm.TagPos).OneWay(); bindingSet.Build(); }
public void CreateBinding(GameObject obj) { _viewGameObject = obj; _viewCanvas = _viewGameObject.GetComponent <Canvas>(); bool bFirst = false; var view = obj.GetComponent <CommonRevengeTagView>(); if (view == null) { bFirst = true; view = obj.AddComponent <CommonRevengeTagView>(); view.FillField(); } DataInit(view); SpriteReset(); view.BindingContext().DataContext = this; if (bFirst) { SaveOriData(view); ViewBind(view); } _view = view; }
void SaveOriData(CommonRevengeTagView view) { view.oriShow = _show; view.oriTagPos = _tagPos; }
void DataInit(CommonRevengeTagView view) { _show = view.Show.activeSelf; _tagPos = view.TagPos.anchoredPosition; }
private void EventTriggerBind(CommonRevengeTagView view) { }