/// <summary> /// 双选 /// </summary> /// <param name="Binder"></param> /// <param name="toggle"></param> /// <param name="sourceName"></param> public static void BindingToggle(this UIPanelBinder Binder, Toggle toggle, byte sourceName) { Binder.RegistValueChange <bool>(x => toggle.isOn = x, sourceName); Binder.RegistValueEvent(toggle.onValueChanged, sourceName); }
/// <summary> /// 滑动条 /// </summary> /// <param name="Binder"></param> /// <param name="sliderComponent"></param> /// <param name="sourceName"></param> public static void BindingSlider(this UIPanelBinder Binder, Slider sliderComponent, byte sourceName) { Binder.RegistValueChange <float>(x => sliderComponent.value = x, sourceName); Binder.RegistValueEvent(sliderComponent.onValueChanged, sourceName); }
/// <summary> /// 下拉框 /// </summary> /// <param name="Binder"></param> /// <param name="dropdown"></param> /// <param name="sourceName"></param> public static void BindingDropdown(this UIPanelBinder Binder, Dropdown dropdown, byte sourceName) { Binder.RegistValueChange <int>(x => dropdown.value = x, sourceName); Binder.RegistValueEvent(dropdown.onValueChanged, sourceName); }
/// <summary> /// 输入框 /// </summary> /// <param name="Binder"></param> /// <param name="inputField"></param> /// <param name="sourceName"></param> public static void BindingInputField(this UIPanelBinder Binder, InputField inputField, byte sourceName) { Binder.RegistValueChange <string>(x => inputField.text = x, sourceName); Binder.RegistValueEvent(inputField.onValueChanged, sourceName); }