123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System;
- using config.ui;
- using UnityEngine;
- public class ConfigIntegerSlider : MonoBehaviour
- {
- public void Initialize()
- {
- this.slider.onGetValue = new Func<int>(this.OnGetValue);
- this.slider.onSetValue = new Action<int>(this.OnSetValue);
- this.slider.Initialize(this.uiSlider);
- }
- public void UpdateSlider()
- {
- this.slider.UpdateSlider();
- }
- private int OnGetValue()
- {
- return (this.onGetValue == null) ? 0 : this.onGetValue();
- }
- private void OnSetValue(int value)
- {
- if (this.onSetValue != null)
- {
- this.onSetValue(value);
- }
- }
- public Action<int> onSetValue;
- public Func<int> onGetValue;
- [ReadOnly]
- [SerializeField]
- private UISlider uiSlider;
- [NonSerialized]
- public IntegerSlider slider = new IntegerSlider();
- }
|