RoleInfoRegisterView.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. using UI.Login;
  2. using UnityEngine;
  3. using FairyGUI;
  4. namespace GFGGame
  5. {
  6. public class RoleInfoRegisterView : BaseWindow
  7. {
  8. private UI_RoleInfoRegisterUI _ui;
  9. public override void Dispose()
  10. {
  11. if (_ui != null)
  12. {
  13. _ui.Dispose();
  14. _ui = null;
  15. }
  16. base.Dispose();
  17. }
  18. protected override void OnInit()
  19. {
  20. base.OnInit();
  21. packageName = UI_RoleInfoRegisterUI.PACKAGE_NAME;
  22. _ui = UI_RoleInfoRegisterUI.Create();
  23. this.viewCom = _ui.target;
  24. this.viewCom.Center();
  25. this.modal = true;
  26. _ui.m_btnSubmit.onClick.Add(OnClickBtnSubmit);
  27. _ui.m_btnSendCode.onClick.Add(OnBtnGetCode);
  28. //输入限制
  29. _ui.m_inputAccount.restrict = "[0-9A-Za-z_]";
  30. _ui.m_inputPassword2.restrict = _ui.m_inputPassword.restrict = "[0-9A-Za-z_]";
  31. _ui.m_inputName.restrict = "[\u4e00-\u9fa5a-zA-Z]";
  32. _ui.m_inputIDNumber.restrict = "[a-zA-Z0-9]";
  33. }
  34. protected override void OnShown()
  35. {
  36. base.OnShown();
  37. }
  38. protected override void OnHide()
  39. {
  40. base.OnHide();
  41. }
  42. private void OnClickBtnSubmit()
  43. {
  44. CheckToSubmit();
  45. }
  46. private async void OnBtnGetCode()
  47. {
  48. if (_ui.m_inputPhone.text == null || _ui.m_inputPhone.text == "")
  49. {
  50. PromptController.Instance.ShowFloatTextPrompt("麻烦输入手机号码!");
  51. return;
  52. }
  53. bool result = await RoleInfoSProxy.GetMobileVerification(_ui.m_inputPhone.text);
  54. }
  55. private void CheckToSubmit()
  56. {
  57. //账号
  58. string account = _ui.m_inputAccount.text.Trim();
  59. //密码
  60. string password = _ui.m_inputPassword.text;
  61. //确认密码
  62. string passwordSure = _ui.m_inputPassword2.text;
  63. //玩家姓名
  64. string realName = _ui.m_inputName.text;
  65. //玩家身份证号码
  66. string idNumberStr = _ui.m_inputIDNumber.text;
  67. //手机号码
  68. string phoneNumber = _ui.m_inputPhone.text;
  69. //验证码
  70. string code = _ui.m_inputCode.text;
  71. if (string.IsNullOrEmpty(account))
  72. {
  73. PromptController.Instance.ShowFloatTextPrompt("请输入账号");
  74. return;
  75. }
  76. if (string.IsNullOrEmpty(code))
  77. {
  78. PromptController.Instance.ShowFloatTextPrompt("请输入验证码");
  79. return;
  80. }
  81. if (account.Length < 8) //最长输入在UI编辑器中做了限制
  82. {
  83. PromptController.Instance.ShowFloatTextPrompt("账号长度最少需要8位");
  84. return;
  85. }
  86. if (string.IsNullOrEmpty(password))
  87. {
  88. PromptController.Instance.ShowFloatTextPrompt("请输入密码");
  89. return;
  90. }
  91. if (password.Length < 8) //最长输入在UI编辑器中做了限制
  92. {
  93. PromptController.Instance.ShowFloatTextPrompt("密码长度最少需要8位");
  94. return;
  95. }
  96. if (passwordSure != password)
  97. {
  98. PromptController.Instance.ShowFloatTextPrompt("确认密码不一致");
  99. return;
  100. }
  101. GameController.CheckSpecialAccount(account);
  102. if (GameGlobal.antiAddiction)
  103. {
  104. if (realName.Length <= 0)
  105. {
  106. PromptController.Instance.ShowFloatTextPrompt("请输入真实姓名");
  107. return;
  108. }
  109. if (idNumberStr.Length <= 0)
  110. {
  111. PromptController.Instance.ShowFloatTextPrompt("请输入身份证号");
  112. return;
  113. }
  114. }
  115. LoginController.RegisterRoleInfo(account, password, realName, idNumberStr, code, phoneNumber).Coroutine();
  116. }
  117. }
  118. }