12345678910111213141516171819 |
- using System;
- using UnityEngine;
- [RequireComponent(typeof(UISlider))]
- [AddComponentMenu("NGUI/Interaction/Sound Volume")]
- public class UISoundVolume : MonoBehaviour
- {
- private void Awake()
- {
- UISlider component = base.GetComponent<UISlider>();
- component.value = NGUITools.soundVolume;
- EventDelegate.Add(component.onChange, new EventDelegate.Callback(this.OnChange));
- }
- private void OnChange()
- {
- NGUITools.soundVolume = UIProgressBar.current.value;
- }
- }
|