SettingView.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 GameObject _gameObject1;
  11. private GameObject _gameObject2;
  12. private GoWrapper _wrapper1;
  13. private GoWrapper _wrapper2;
  14. public override void Dispose()
  15. {
  16. if (_ui != null)
  17. {
  18. _ui.Dispose();
  19. _ui = null;
  20. }
  21. base.Dispose();
  22. }
  23. protected override void OnInit()
  24. {
  25. base.OnInit();
  26. packageName = UI_SettingUI.PACKAGE_NAME;
  27. _ui = UI_SettingUI.Create();
  28. this.viewCom = _ui.target;
  29. this.viewCom.Center();
  30. this.modal = true;
  31. _ui.m_btnExit.onClick.Add(OnClickBtnExit);
  32. _ui.m_btnLogout.onClick.Add(OnClickBtnLogout);
  33. _ui.m_btnSound.onClick.Add(OnClickBtnSound);
  34. _ui.m_btnMusic.onClick.Add(OnClickBtnMusic);
  35. }
  36. protected override void OnShown()
  37. {
  38. base.OnShown();
  39. AddEffect();
  40. }
  41. protected override void OnHide()
  42. {
  43. SceneController.DestroyObjectFromView(_gameObject1, _wrapper1);
  44. SceneController.DestroyObjectFromView(_gameObject2, _wrapper2);
  45. base.OnHide();
  46. }
  47. private void AddEffect()
  48. {
  49. //邊框左上角特效
  50. string resPath1 = ResPathUtil.GetViewEffectPath("ui_Activity", "Com_window_L_up");
  51. SceneController.AddObjectToView(null, null, _ui.m_holderLeftTop, resPath1,
  52. out _gameObject1, out _wrapper1);
  53. //邊框右下角特效
  54. string resPath2 = ResPathUtil.GetViewEffectPath("ui_Activity", "Com_window_R_Down");
  55. SceneController.AddObjectToView(null, null, _ui.m_holderRightDowm, resPath2,
  56. out _gameObject2, out _wrapper2);
  57. }
  58. private void OnClickBtnExit()
  59. {
  60. AlertSystem.Show("确认返回登录页吗?")
  61. .SetLeftButton(true)
  62. .SetRightButton(true, "确认", (object data) =>
  63. {
  64. GameController.QuitToLoginView(false);
  65. });
  66. }
  67. private void OnClickBtnLogout()
  68. {
  69. AlertSystem.Show("确认注销当前账号吗?")
  70. .SetLeftButton(true)
  71. .SetRightButton(true, "确认", (object data) =>
  72. {
  73. GameController.QuitToLoginView(true);
  74. });
  75. }
  76. private void OnClickBtnSound()
  77. {
  78. SoundManager.Instance.isOn = _ui.m_btnSound.selected;
  79. }
  80. private void OnClickBtnMusic()
  81. {
  82. MusicManager.Instance.isOn = _ui.m_btnMusic.selected;
  83. }
  84. }
  85. }