UISoundVolume.cs 469 B

12345678910111213141516171819
  1. using System;
  2. using UnityEngine;
  3. [RequireComponent(typeof(UISlider))]
  4. [AddComponentMenu("NGUI/Interaction/Sound Volume")]
  5. public class UISoundVolume : MonoBehaviour
  6. {
  7. private void Awake()
  8. {
  9. UISlider component = base.GetComponent<UISlider>();
  10. component.value = NGUITools.soundVolume;
  11. EventDelegate.Add(component.onChange, new EventDelegate.Callback(this.OnChange));
  12. }
  13. private void OnChange()
  14. {
  15. NGUITools.soundVolume = UIProgressBar.current.value;
  16. }
  17. }