using Assets.Scripts; using Newtonsoft.Json.Linq; using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class AppleInfoController : PFUIPanel { public Action afterClose = null; private SignForm signForm; private Dictionary signFormDict; public bool startCaptcha = false; protected override void Awake() { UIManager.AddEvent(transform.Find("FormContainer-Sign/btnClose").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b => { Close(); //if (afterClose != null) //{ // afterClose.Invoke(); //} }); signForm = new SignForm() { email = transform.Find("FormContainer-Sign/FirstPage/Email").GetComponent(), captcha = transform.Find("FormContainer-Sign/FirstPage/Captcha").GetComponent(), password = transform.Find("FormContainer-Sign/FirstPage/Password").GetComponent(), cpassword = transform.Find("FormContainer-Sign/FirstPage/CPassword").GetComponent(), }; signFormDict = new Dictionary { { "Phone",signForm.email}, { "Captcha",signForm.captcha}, { "Pwd",signForm.password}, { "CPwd",signForm.cpassword}, }; signPage1 = transform.Find("FormContainer-Sign/FirstPage"); UIManager.AddEvent(signPage1.Find("Captcha").Find("BtnGet").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b => { GetCaptcha(); }); UIManager.AddEvent(signPage1.Find("next").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b => { Submit(); }); } private async void Submit() { if (signForm.password.text != signForm.cpassword.text) { Utils.SetValidate(signFormDict, JArray.FromObject(new object[] { new { Field="Pwd"}, new { Field="CPwd"}, })); Utils.showToast(gameObject, "Two password entries are inconsistent");//两次密码输入不一致 return; } var res = await ConfigHelper.userApi.AppleCompleteInfo(signForm.email.text, signForm.captcha.text, signForm.password.text); if (res.result) { Utils.showToast(null, App.GetLocalString("Success"), type: 1); App.CurrentUser.Phone = signForm.email.text; if (afterClose != null) { afterClose.Invoke(); } Close(); } else { Utils.SetValidate(signFormDict, JArray.FromObject(res.data)); Utils.showToast(null, res.errMsg); } } float timer = 1f; int time = 60; Transform signPage1; async void GetCaptcha() { var btn = signPage1.Find("Captcha").Find("BtnGet"); btn.GetComponent