RegisterView.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. using UI.Login;
  2. using UnityEngine;
  3. using FairyGUI;
  4. namespace GFGGame
  5. {
  6. public class RegisterView : BaseWindow
  7. {
  8. private UI_RegisterUI _ui;
  9. private const string CODE = "1818168";
  10. public override void Dispose()
  11. {
  12. if (_ui != null)
  13. {
  14. _ui.Dispose();
  15. _ui = null;
  16. }
  17. base.Dispose();
  18. }
  19. protected override void OnInit()
  20. {
  21. base.OnInit();
  22. packageName = UI_RegisterUI.PACKAGE_NAME;
  23. _ui = UI_RegisterUI.Create();
  24. this.viewCom = _ui.target;
  25. this.viewCom.Center();
  26. this.modal = true;
  27. _ui.m_btnSubmit.onClick.Add(OnClickBtnSubmit);
  28. // _ui.m_richTextAgree.onClickLink.Add(OnClickRichTextAgreeLink);
  29. _ui.m_loaEventa.onClick.Add(() => { FullScreenTextController.Show("event:a"); });
  30. _ui.m_loaEventb.onClick.Add(() => { FullScreenTextController.Show("event:b"); });
  31. _ui.m_loaEventc.onClick.Add(() => { FullScreenTextController.Show("event:c"); });
  32. // _ui.m_btnSendCode.onClick.Add(() => {
  33. //
  34. // _ui.m_btnSendCode.enabled = false;
  35. // _ui.m_inputCode.text = CODE;
  36. // float endTime = Time.time + 60;
  37. // Timers.inst.Add(1,0, timerCallback, endTime);
  38. // timerCallback(endTime);
  39. // });
  40. }
  41. private void timerCallback(object param)
  42. {
  43. float endTime = (float)param;
  44. float remainTime = endTime - Time.time;
  45. if (remainTime <= 0)
  46. {
  47. // _ui.m_btnSendCode.text = "发送验证码";
  48. // _ui.m_btnSendCode.enabled = true;
  49. Timers.inst.Remove(timerCallback);
  50. }
  51. else
  52. {
  53. // _ui.m_btnSendCode.text = (int)remainTime + "s后重发";
  54. }
  55. }
  56. protected override void OnShown()
  57. {
  58. base.OnShown();
  59. LogServerHelperHttp.SendNodeLog((int)LogNode.ShowRegister);
  60. }
  61. protected override void OnHide()
  62. {
  63. base.OnHide();
  64. }
  65. private void OnClickBtnSubmit()
  66. {
  67. CheckToSubmit();
  68. }
  69. private void CheckToSubmit()
  70. {
  71. string account = _ui.m_inputAccount.text.Trim();
  72. string password = _ui.m_inputPassword.text;
  73. string passwordSure = _ui.m_inputPassword2.text;
  74. string realName = _ui.m_inputName.text;
  75. string idNumberStr = _ui.m_inputIDNumber.text;
  76. if (string.IsNullOrEmpty(account))
  77. {
  78. PromptController.Instance.ShowFloatTextPrompt("请输入账号");
  79. return;
  80. }
  81. if (string.IsNullOrEmpty(password))
  82. {
  83. PromptController.Instance.ShowFloatTextPrompt("请输入密码");
  84. return;
  85. }
  86. if (passwordSure != password)
  87. {
  88. PromptController.Instance.ShowFloatTextPrompt("确认密码不一致");
  89. return;
  90. }
  91. GameController.CheckSpecialAccount(account);
  92. if (GameGlobal.antiAddiction)
  93. {
  94. if (realName.Length <= 0)
  95. {
  96. PromptController.Instance.ShowFloatTextPrompt("请输入真实姓名");
  97. return;
  98. }
  99. if (idNumberStr.Length <= 0)
  100. {
  101. PromptController.Instance.ShowFloatTextPrompt("请输入身份证号");
  102. return;
  103. }
  104. if (!_ui.m_btnAgree.selected)
  105. {
  106. PromptController.Instance.ShowFloatTextPrompt("请仔细阅读并同意服务协议、隐私政策、保护规则");
  107. return;
  108. }
  109. }
  110. LoginController.Register(account, password, realName, idNumberStr, CODE).Coroutine();
  111. }
  112. }
  113. }