123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using System;
- using wf.ui;
- namespace config.ui
- {
- public class IntegerSlider : NGUISlider<int>
- {
- protected int srcValue
- {
- get
- {
- return (this.onGetValue == null) ? 0 : this.onGetValue();
- }
- set
- {
- if (this.onSetValue != null)
- {
- this.onSetValue(value);
- }
- }
- }
- public override float srcValueToSliderValue
- {
- get
- {
- return (float)Math.Round((double)((float)this.srcValue / 100f), 2, MidpointRounding.AwayFromZero);
- }
- }
- public override int sliderValueToSrcValue
- {
- get
- {
- return (int)Math.Ceiling((double)(this.slider.value * 100f));
- }
- }
- protected override void OnChangeSliderValue()
- {
- this.srcValue = this.sliderValueToSrcValue;
- }
- public Func<int> onGetValue;
- public Action<int> onSetValue;
- }
- }
|