SettingView.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. using UI.RoleInfo;
  2. using System.Text.RegularExpressions;
  3. using UnityEngine;
  4. using FairyGUI;
  5. namespace GFGGame
  6. {
  7. public class SettingView : BaseWindow
  8. {
  9. private UI_SettingUI _ui;
  10. private EffectUI _effectUI1;
  11. private EffectUI _effectUI2;
  12. public override void Dispose()
  13. {
  14. EffectUIPool.Recycle(_effectUI1);
  15. _effectUI1 = null;
  16. EffectUIPool.Recycle(_effectUI2);
  17. _effectUI2 = null;
  18. if (_ui != null)
  19. {
  20. _ui.Dispose();
  21. _ui = null;
  22. }
  23. base.Dispose();
  24. }
  25. protected override void OnInit()
  26. {
  27. base.OnInit();
  28. packageName = UI_SettingUI.PACKAGE_NAME;
  29. _ui = UI_SettingUI.Create();
  30. this.viewCom = _ui.target;
  31. this.viewCom.Center();
  32. this.modal = true;
  33. _ui.m_btnExit.onClick.Add(OnClickBtnExit);
  34. _ui.m_btnLogout.onClick.Add(OnClickBtnLogout);
  35. _ui.m_btnSound.onClick.Add(OnClickBtnSound);
  36. _ui.m_btnMusic.onClick.Add(OnClickBtnMusic);
  37. }
  38. protected override void OnShown()
  39. {
  40. base.OnShown();
  41. AddEffect();
  42. }
  43. protected override void OnHide()
  44. {
  45. base.OnHide();
  46. }
  47. private void AddEffect()
  48. {
  49. //邊框左上角特效
  50. _effectUI1 = EffectUIPool.CreateEffectUI(_ui.m_holderLeftTop, "ui_Activity", "Com_window_L_up");
  51. //邊框右下角特效
  52. _effectUI2 = EffectUIPool.CreateEffectUI(_ui.m_holderRightDowm, "ui_Activity", "Com_window_R_Down");
  53. }
  54. private void OnClickBtnExit()
  55. {
  56. AlertSystem.Show("确认返回登录页吗?")
  57. .SetLeftButton(true)
  58. .SetRightButton(true, "确认", (object data) =>
  59. {
  60. GameController.QuitToLoginView(false);
  61. });
  62. }
  63. private void OnClickBtnLogout()
  64. {
  65. AlertSystem.Show("确认注销当前账号吗?")
  66. .SetLeftButton(true)
  67. .SetRightButton(true, "确认", (object data) =>
  68. {
  69. GameController.QuitToLoginView(true);
  70. });
  71. }
  72. private void OnClickBtnSound()
  73. {
  74. SoundManager.Instance.isOn = _ui.m_btnSound.selected;
  75. }
  76. private void OnClickBtnMusic()
  77. {
  78. MusicManager.Instance.isOn = _ui.m_btnMusic.selected;
  79. }
  80. }
  81. }