123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- using UI.Login;
- using UnityEngine;
- using FairyGUI;
- namespace GFGGame
- {
- public class RoleInfoRegisterView : BaseWindow
- {
- private UI_RoleInfoRegisterUI _ui;
- public override void Dispose()
- {
- if (_ui != null)
- {
- _ui.Dispose();
- _ui = null;
- }
- base.Dispose();
- }
- protected override void OnInit()
- {
- base.OnInit();
- packageName = UI_RoleInfoRegisterUI.PACKAGE_NAME;
- _ui = UI_RoleInfoRegisterUI.Create();
- this.viewCom = _ui.target;
- this.viewCom.Center();
- this.modal = true;
- _ui.m_btnSubmit.onClick.Add(OnClickBtnSubmit);
- //_ui.m_btnSendCode.onClick.Add(OnBtnGetCode);
- //输入限制
- _ui.m_inputAccount.restrict = "[0-9A-Za-z_]";
- _ui.m_inputPassword2.restrict = _ui.m_inputPassword.restrict = "[0-9A-Za-z_]";
- _ui.m_inputName.restrict = "[\u4e00-\u9fa5a-zA-Z]";
- _ui.m_inputIDNumber.restrict = "[a-zA-Z0-9]";
- }
- protected override void OnShown()
- {
- base.OnShown();
- }
- protected override void OnHide()
- {
- base.OnHide();
- }
- private void OnClickBtnSubmit()
- {
- CheckToSubmit();
- }
- private async void OnBtnGetCode()
- {
- if (_ui.m_inputPhone.text == null || _ui.m_inputPhone.text == "")
- {
- PromptController.Instance.ShowFloatTextPrompt("麻烦输入手机号码!");
- return;
- }
- bool result = await RoleInfoSProxy.GetMobileVerification(_ui.m_inputPhone.text);
- }
- private void CheckToSubmit()
- {
- //账号
- string account = _ui.m_inputAccount.text.Trim();
- //密码
- string password = _ui.m_inputPassword.text;
- //确认密码
- string passwordSure = _ui.m_inputPassword2.text;
- //玩家姓名
- string realName = _ui.m_inputName.text;
- //玩家身份证号码
- string idNumberStr = _ui.m_inputIDNumber.text;
- //手机号码
- string phoneNumber = _ui.m_inputPhone.text;
- //验证码
- //string code = _ui.m_inputCode.text;
- if (string.IsNullOrEmpty(account))
- {
- PromptController.Instance.ShowFloatTextPrompt("请输入账号");
- return;
- }
-
- // if (string.IsNullOrEmpty(code))
- // {
- // PromptController.Instance.ShowFloatTextPrompt("请输入验证码");
- // return;
- // }
-
- if (account.Length < 6) //最长输入在UI编辑器中做了限制
- {
- PromptController.Instance.ShowFloatTextPrompt("账号长度最少需要6位");
- return;
- }
-
- if (string.IsNullOrEmpty(password))
- {
- PromptController.Instance.ShowFloatTextPrompt("请输入密码");
- return;
- }
-
- if (password.Length < 6) //最长输入在UI编辑器中做了限制
- {
- PromptController.Instance.ShowFloatTextPrompt("密码长度最少需要5位");
- return;
- }
-
- if (passwordSure != password)
- {
- PromptController.Instance.ShowFloatTextPrompt("确认密码不一致");
- return;
- }
- GameController.CheckSpecialAccount(account);
- if (GameGlobal.antiAddiction)
- {
- if (realName.Length <= 0)
- {
- PromptController.Instance.ShowFloatTextPrompt("请输入真实姓名");
- return;
- }
-
- if (idNumberStr.Length <= 0)
- {
- PromptController.Instance.ShowFloatTextPrompt("请输入身份证号");
- return;
- }
- }
- LoginController.RegisterRoleInfo(account, password, realName, idNumberStr, "", phoneNumber).Coroutine();
- }
- }
- }
|