1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- using System;
- using UnityEngine;
- namespace wf.ui
- {
- public abstract class NGUISlider<T> : AbstractSliderWrapper<UISlider>
- {
- public override UISlider slider
- {
- get
- {
- return this.slider_;
- }
- }
- public abstract T sliderValueToSrcValue { get; }
- public override void Initialize(UISlider set_slider)
- {
- base.Initialize(set_slider);
- this.slider.onChange.Clear();
- this.UpdateSlider();
- EventDelegate.Add(this.slider.onChange, new EventDelegate(new EventDelegate.Callback(this.OncChange)));
- }
- protected void OncChange()
- {
- this.OnChangeSliderValue();
- if (this.onChangeSliderValue != null)
- {
- this.onChangeSliderValue(this);
- }
- }
- public override void UpdateSlider()
- {
- if (this.slider == null)
- {
- return;
- }
- float srcValueToSliderValue = this.srcValueToSliderValue;
- if (!Mathf.Approximately(srcValueToSliderValue, this.slider.value))
- {
- this.slider.value = srcValueToSliderValue;
- }
- }
- protected T num_ = default(T);
- }
- }
|