Exemple #1
0
 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);
 }
Exemple #2
0
 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);
 }
Exemple #3
0
        protected override void OnVmChange()
        {
            vm = ViewModel as ItemViewModel;
            UIBindFactory <ItemView, ItemViewModel> binding = new UIBindFactory <ItemView, ItemViewModel>(this, this.vm);

            binding.Bind(itemImg, vm.Path);
            binding.Bind(nameTxt, vm.Path);
            binding.BindData(vm.Last, (last) => breakLine.SetActive(!last));
            //binding.BindData(vm.Selected, (value) => selected.SetActive(value));
            binding.BindData(vm.Selected, CC);
            binding.BindCommand(selfBtn, vm.OnItemClick);
        }