RoleInfoView.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using ET;
  2. using UI.Main;
  3. using static GFGGame.LauncherConfig;
  4. namespace GFGGame
  5. {
  6. public class RoleInfoView : BaseWindow
  7. {
  8. private UI_RoleInfoUI _ui;
  9. public override void Dispose()
  10. {
  11. if (_ui != null)
  12. {
  13. _ui.Dispose();
  14. }
  15. _ui = null;
  16. base.Dispose();
  17. }
  18. protected override void OnInit()
  19. {
  20. base.OnInit();
  21. _ui = UI_RoleInfoUI.Create();
  22. this.viewCom = _ui.target;
  23. this.viewCom.Center();
  24. this.modal = true;
  25. _ui.m_txtVersion.text = GameGlobal.version;
  26. _ui.m_btnExit.onClick.Add(OnClickBtnExit);
  27. _ui.m_btnLogout.onClick.Add(OnClickBtnLogout);
  28. _ui.m_btnSound.onClick.Add(OnClickBtnSound);
  29. _ui.m_btnMusic.onClick.Add(OnClickBtnMusic);
  30. _ui.m_btnHelp.onClick.Add(OnClickBtnHelp);
  31. }
  32. protected override void OnShown()
  33. {
  34. base.OnShown();
  35. _ui.m_txtRoleName.text = RoleDataManager.roleName;
  36. _ui.m_txtLvl.text = "" + GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
  37. RoleLevelCfg roleLevelCfg = RoleLevelCfgArray.Instance.GetCfg(GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl));
  38. if (roleLevelCfg.exp > 0)
  39. {
  40. _ui.m_proBarExp.value = GameGlobal.myNumericComponent.GetAsInt(NumericType.Exp);
  41. _ui.m_proBarExp.max = roleLevelCfg.exp;
  42. }
  43. else
  44. {
  45. _ui.m_proBarExp.text = "已满级";
  46. }
  47. _ui.m_btnSound.selected = SoundManager.Instance.isOn;
  48. _ui.m_btnMusic.selected = MusicManager.Instance.isOn;
  49. }
  50. protected override void OnHide()
  51. {
  52. base.OnHide();
  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. private void OnClickBtnHelp()
  81. {
  82. if (LauncherConfig.netType == EnumNetType.LOCAL)
  83. {
  84. ViewManager.Show(ViewName.GM_PANEL_VIEW);
  85. }
  86. else
  87. {
  88. ViewManager.Show(ViewName.LOG_VIEW);
  89. }
  90. }
  91. }
  92. }