protected override void OnVmChange() { vm = ViewModel as SetupViewModel; if (binding == null) { binding = new UIBindFactory <SetupView, SetupViewModel>(this, vm); } binding.UpdateVm(vm); binding.Bind(nameMessageText, vm.Visible); binding.Bind(nameMessageText, vm.Process, process => $"进度为:{process}"); binding.Bind(mulBindText, vm.Name, vm.ATK, (name, atk) => $"name = {name} atk = {atk.ToString()}", (str) => mulBindText.text = $"111{str}"); binding.BindCommand(joinInButton, vm.OnButtonClick, wrapFunc: click => () => { click(); print("Wrap Button"); }); binding.BindCommand(joinInButton, () => vm.OnInputChanged("a")); binding.RevertBind(slider, vm.Process); binding.Bind(img, vm.Path); binding.BindData(vm.Visible, vm.OnToggleChanged); binding.RevertBind(joinToggle, vm.Visible); binding.RevertBind(atkInputField, vm.ATK, (string str) => int.Parse(str)); binding.BindDropDown(dropDown, vm.SelectedIndex, vm.Datas); }
protected override void OnVmChange() { vm = ViewModel as ListBindViewModel; if (binding == null) { binding = new UIBindFactory <ListBindView, ListBindViewModel>(this, vm); } dropdown.options = vm.DropdownData; binding.RevertBind(dropdown, vm.SelectedDropDownIndex); binding.BindList(vm.Items, item); binding.BindCommand(addBtn, vm.AddItem); binding.BindCommand(deleteBtn, vm.DeleteSelectedItem); binding.BindCommand(updateBtn, vm.UpdateItem); }