RoleInfoView.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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_txtSlogan.maxLength = GlobalCfgArray.globalCfg.maxSloganWordsCount;
  27. _ui.m_btnExit.onClick.Add(OnClickBtnExit);
  28. _ui.m_btnLogout.onClick.Add(OnClickBtnLogout);
  29. _ui.m_btnSound.onClick.Add(OnClickBtnSound);
  30. _ui.m_btnMusic.onClick.Add(OnClickBtnMusic);
  31. _ui.m_btnHelp.onClick.Add(OnClickBtnHelp);
  32. _ui.m_txtSlogan.onFocusOut.Add(OnFocuseOut);
  33. }
  34. protected override void OnShown()
  35. {
  36. base.OnShown();
  37. _ui.m_txtRoleName.text = RoleDataManager.roleName;
  38. _ui.m_txtLvl.text = "" + GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
  39. RoleLevelCfg roleLevelCfg = RoleLevelCfgArray.Instance.GetCfg(GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl));
  40. if (roleLevelCfg.exp > 0)
  41. {
  42. _ui.m_proBarExp.value = GameGlobal.myNumericComponent.GetAsInt(NumericType.Exp);
  43. _ui.m_proBarExp.max = roleLevelCfg.exp;
  44. }
  45. else
  46. {
  47. _ui.m_proBarExp.text = "已满级";
  48. }
  49. _ui.m_btnSound.selected = SoundManager.Instance.isOn;
  50. _ui.m_btnMusic.selected = MusicManager.Instance.isOn;
  51. _ui.m_txtSlogan.text = RoleDataManager.slogan;
  52. }
  53. protected override void OnHide()
  54. {
  55. base.OnHide();
  56. }
  57. private void OnClickBtnExit()
  58. {
  59. AlertSystem.Show("确认返回登录页吗?")
  60. .SetLeftButton(true)
  61. .SetRightButton(true, "确认", (object data) =>
  62. {
  63. GameController.QuitToLoginView(false);
  64. });
  65. }
  66. private void OnClickBtnLogout()
  67. {
  68. AlertSystem.Show("确认注销当前账号吗?")
  69. .SetLeftButton(true)
  70. .SetRightButton(true, "确认", (object data) =>
  71. {
  72. GameController.QuitToLoginView(true);
  73. });
  74. }
  75. private void OnClickBtnSound()
  76. {
  77. SoundManager.Instance.isOn = _ui.m_btnSound.selected;
  78. }
  79. private void OnClickBtnMusic()
  80. {
  81. MusicManager.Instance.isOn = _ui.m_btnMusic.selected;
  82. }
  83. private void OnClickBtnHelp()
  84. {
  85. if (GameConfig.showGM >= 1)
  86. {
  87. ViewManager.Show(ViewName.GM_PANEL_VIEW);
  88. }
  89. else
  90. {
  91. ViewManager.Show(ViewName.LOG_VIEW);
  92. }
  93. }
  94. private async void OnFocuseOut()
  95. {
  96. _ui.m_txtSlogan.text = await RoleInfoSProxy.ReqModifySlogan(_ui.m_txtSlogan.text);
  97. }
  98. }
  99. }