using UI.RoleInfo; using System.Text.RegularExpressions; using UnityEngine; using FairyGUI; namespace GFGGame { public class SettingView : BaseWindow { private UI_SettingUI _ui; private EffectUI _effectUI1; private EffectUI _effectUI2; public override void Dispose() { EffectUIPool.Recycle(_effectUI1); _effectUI1 = null; EffectUIPool.Recycle(_effectUI2); _effectUI2 = null; if (_ui != null) { _ui.Dispose(); _ui = null; } base.Dispose(); } protected override void OnInit() { base.OnInit(); packageName = UI_SettingUI.PACKAGE_NAME; _ui = UI_SettingUI.Create(); this.viewCom = _ui.target; this.viewCom.Center(); this.modal = true; _ui.m_btnExit.onClick.Add(OnClickBtnExit); _ui.m_btnLogout.onClick.Add(OnClickBtnLogout); _ui.m_btnSound.onClick.Add(OnClickBtnSound); _ui.m_btnMusic.onClick.Add(OnClickBtnMusic); } protected override void OnShown() { base.OnShown(); AddEffect(); } protected override void OnHide() { base.OnHide(); } private void AddEffect() { //邊框左上角特效 _effectUI1 = EffectUIPool.CreateEffectUI(_ui.m_holderLeftTop, "ui_Activity", "Com_window_L_up"); //邊框右下角特效 _effectUI2 = EffectUIPool.CreateEffectUI(_ui.m_holderRightDowm, "ui_Activity", "Com_window_R_Down"); } private void OnClickBtnExit() { AlertSystem.Show("确认返回登录页吗?") .SetLeftButton(true) .SetRightButton(true, "确认", (object data) => { GameController.QuitToLoginView(false); }); } private void OnClickBtnLogout() { AlertSystem.Show("确认注销当前账号吗?") .SetLeftButton(true) .SetRightButton(true, "确认", (object data) => { GameController.QuitToLoginView(true); }); } private void OnClickBtnSound() { SoundManager.Instance.isOn = _ui.m_btnSound.selected; } private void OnClickBtnMusic() { MusicManager.Instance.isOn = _ui.m_btnMusic.selected; } } }