OptionPanel.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using UnityEngine;
  2. using System.Collections;
  3. public class OptionPanel : PopUpPanel
  4. {
  5. public GameObject muteBtn;
  6. public GameObject unmuteBtn;
  7. [System.NonSerialized]
  8. public BattleController battleController;
  9. void Start()
  10. {
  11. MuteToggle (SoundManager.GetInstatnce ().bgSound.GetVolume () == 0);
  12. }
  13. public void Mute()
  14. {
  15. MuteToggle (true);
  16. }
  17. public void Unmute()
  18. {
  19. MuteToggle (false);
  20. }
  21. private void MuteToggle(bool value)
  22. {
  23. if(value)
  24. {
  25. SoundManager.GetInstatnce ().bgSound.SetVolume (0);
  26. SoundManager.GetInstatnce ().effectSound.SetVolume (0);
  27. muteBtn.SetActive (false);
  28. unmuteBtn.SetActive (true);
  29. }
  30. else
  31. {
  32. SoundManager.GetInstatnce ().bgSound.SetVolume (1f);
  33. SoundManager.GetInstatnce ().effectSound.SetVolume (1f);
  34. muteBtn.SetActive (true);
  35. unmuteBtn.SetActive (false);
  36. }
  37. }
  38. public void Exit()
  39. {
  40. AlertPanel.Show (null, Language.GetStr("BattleUI", "exitTip"), AlertPanel.YES|AlertPanel.NO, OnExit);
  41. }
  42. private void OnExit(AlertCloseEvent evt)
  43. {
  44. if(evt.detail == AlertPanel.YES)
  45. {
  46. battleController.GetMessageManager().ExitBattle();
  47. }
  48. }
  49. public void Resume()
  50. {
  51. Close ();
  52. }
  53. }