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(); } } }