12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- using UnityEngine;
- using System.Collections;
- public class OptionPanel : PopUpPanel
- {
- public GameObject muteBtn;
- public GameObject unmuteBtn;
- [System.NonSerialized]
- public BattleController battleController;
- void Start()
- {
- MuteToggle (SoundManager.GetInstatnce ().bgSound.GetVolume () == 0);
- }
- public void Mute()
- {
- MuteToggle (true);
- }
- public void Unmute()
- {
- MuteToggle (false);
- }
- private void MuteToggle(bool value)
- {
- if(value)
- {
- SoundManager.GetInstatnce ().bgSound.SetVolume (0);
- SoundManager.GetInstatnce ().effectSound.SetVolume (0);
- muteBtn.SetActive (false);
- unmuteBtn.SetActive (true);
- }
- else
- {
- SoundManager.GetInstatnce ().bgSound.SetVolume (1f);
- SoundManager.GetInstatnce ().effectSound.SetVolume (1f);
- muteBtn.SetActive (true);
- unmuteBtn.SetActive (false);
- }
- }
- public void Exit()
- {
- AlertPanel.Show (null, Language.GetStr("BattleUI", "exitTip"), AlertPanel.YES|AlertPanel.NO, OnExit);
- }
- private void OnExit(AlertCloseEvent evt)
- {
- if(evt.detail == AlertPanel.YES)
- {
- battleController.GetMessageManager().ExitBattle();
- }
- }
- public void Resume()
- {
- Close ();
- }
- }
|