123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- using UI.Login;
- using UnityEngine;
- using FairyGUI;
- using VEngine;
- namespace GFGGame
- {
- public class RegisterView : BaseWindow
- {
- private UI_RegisterUI _ui;
- private const string CODE = "1818168";
- public override void Dispose()
- {
- GFGAsset.Release(ResPathUtil.GetTxtPath("serviceProtocal"));
- GFGAsset.Release(ResPathUtil.GetTxtPath("privacyPolicy"));
- GFGAsset.Release(ResPathUtil.GetTxtPath("privacyPolicyChildren"));
- base.Dispose();
- }
- protected override void OnInit()
- {
- base.OnInit();
- _ui = UI_RegisterUI.Create();
- this.viewCom = _ui.target;
- this.viewCom.Center();
- this.modal = true;
- _ui.m_btnSubmit.onClick.Add(OnClickBtnSubmit);
- // _ui.m_richTextAgree.onClickLink.Add(OnClickRichTextAgreeLink);
- _ui.m_loaEventa.onClick.Add(() => { OnClickRichTextAgreeLink("event:a"); });
- _ui.m_loaEventb.onClick.Add(() => { OnClickRichTextAgreeLink("event:b"); });
- _ui.m_loaEventc.onClick.Add(() => { OnClickRichTextAgreeLink("event:c"); });
- // _ui.m_btnSendCode.onClick.Add(() => {
- //
- // _ui.m_btnSendCode.enabled = false;
- // _ui.m_inputCode.text = CODE;
- // float endTime = Time.time + 60;
- // Timers.inst.Add(1,0, timerCallback, endTime);
- // timerCallback(endTime);
- // });
- }
- private void timerCallback(object param)
- {
- float endTime = (float)param;
- float remainTime = endTime - Time.time;
- if (remainTime <= 0)
- {
- // _ui.m_btnSendCode.text = "发送验证码";
- // _ui.m_btnSendCode.enabled = true;
- Timers.inst.Remove(timerCallback);
- }
- else
- {
- // _ui.m_btnSendCode.text = (int)remainTime + "s后重发";
- }
- }
- protected override void OnShown()
- {
- base.OnShown();
- LogServerHelperHttp.SendNodeLog((int)LogNode.ShowRegister);
- }
- protected override void OnHide()
- {
- base.OnHide();
- }
- private void OnClickBtnSubmit()
- {
- CheckToSubmit();
- }
- 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;
- if (string.IsNullOrEmpty(account))
- {
- PromptController.Instance.ShowFloatTextPrompt("请输入账号");
- return;
- }
- if (string.IsNullOrEmpty(password))
- {
- PromptController.Instance.ShowFloatTextPrompt("请输入密码");
- 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;
- }
- if (!_ui.m_btnAgree.selected)
- {
- PromptController.Instance.ShowFloatTextPrompt("请仔细阅读并同意服务协议、隐私政策、保护规则");
- return;
- }
- }
- LoginController.Register(account, password, realName, idNumberStr, CODE).Coroutine();
- }
- private void OnClickRichTextAgreeLink(string eventname)
- {
- Debug.Log("link target " + eventname);
- string content = null;
- switch (eventname)
- {
- case "event:a":
- content = GFGAsset.Load<TextAsset>(ResPathUtil.GetTxtPath("serviceProtocal")).text;
- break;
- case "event:b":
- content = GFGAsset.Load<TextAsset>(ResPathUtil.GetTxtPath("privacyPolicy")).text;
- break;
- case "event:c":
- content = GFGAsset.Load<TextAsset>(ResPathUtil.GetTxtPath("privacyPolicyChildren")).text;
- break;
- }
- if (!string.IsNullOrEmpty(content))
- {
- ViewManager.Show<FullScreenTextView>(content);
- }
- }
- }
- }
|