SettingView.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. AddEffect();
  38. }
  39. protected override void OnShown()
  40. {
  41. base.OnShown();
  42. AddEffect();
  43. }
  44. protected override void OnHide()
  45. {
  46. base.OnHide();
  47. }
  48. private void AddEffect()
  49. {
  50. //邊框左上角特效
  51. _effectUI1 = EffectUIPool.CreateEffectUI(_ui.m_holderLeftTop, "ui_Activity", "Com_window_L_up");
  52. //邊框右下角特效
  53. _effectUI2 = EffectUIPool.CreateEffectUI(_ui.m_holderRightDowm, "ui_Activity", "Com_window_R_Down");
  54. }
  55. private void OnClickBtnExit()
  56. {
  57. AlertSystem.Show("确认返回登录页吗?")
  58. .SetLeftButton(true)
  59. .SetRightButton(true, "确认", (object data) =>
  60. {
  61. GameController.QuitToLoginView(false);
  62. });
  63. }
  64. private void OnClickBtnLogout()
  65. {
  66. AlertSystem.Show("确认注销当前账号吗?")
  67. .SetLeftButton(true)
  68. .SetRightButton(true, "确认", (object data) =>
  69. {
  70. GameController.QuitToLoginView(true);
  71. });
  72. }
  73. private void OnClickBtnSound()
  74. {
  75. SoundManager.Instance.isOn = _ui.m_btnSound.selected;
  76. }
  77. private void OnClickBtnMusic()
  78. {
  79. MusicManager.Instance.isOn = _ui.m_btnMusic.selected;
  80. }
  81. }
  82. }