From c12df53c1804647f9cec0bb65bb532afaa9109ce Mon Sep 17 00:00:00 2001 From: CaiYanPeng Date: Thu, 27 Jan 2022 14:11:28 +0800 Subject: [PATCH] =?UTF-8?q?ios=E5=BF=AB=E6=8D=B7=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/AppleInfoController.cs | 159 ++ Assets/AppleInfoController.cs.meta | 11 + Assets/Editor/XCodePostProcessBuild.cs | 1 + .../Prefab/Panel/Mobile/AppleInfoModal.prefab | 1655 +++++++++++++++++ .../Panel/Mobile/AppleInfoModal.prefab.meta | 7 + .../Prefab/Panel/Mobile/UserInfoPanel.prefab | 171 ++ Assets/Resources/UI/language.json | 2 +- Assets/Scenes/Test2.unity | 710 ++----- Assets/Scripts/Apis/UserApi.cs | 13 + Assets/Scripts/Scenes/LoginController.cs | 19 +- .../UI/Prefab/Panel/UserInfoController.cs | 13 +- Assets/Scripts/UIManager.cs | 18 + ProjectSettings/EditorBuildSettings.asset | 4 +- ProjectSettings/ProjectSettings.asset | 2 +- 14 files changed, 2179 insertions(+), 606 deletions(-) create mode 100644 Assets/AppleInfoController.cs create mode 100644 Assets/AppleInfoController.cs.meta create mode 100644 Assets/Resources/UI/Prefab/Panel/Mobile/AppleInfoModal.prefab create mode 100644 Assets/Resources/UI/Prefab/Panel/Mobile/AppleInfoModal.prefab.meta diff --git a/Assets/AppleInfoController.cs b/Assets/AppleInfoController.cs new file mode 100644 index 00000000..6c84dc80 --- /dev/null +++ b/Assets/AppleInfoController.cs @@ -0,0 +1,159 @@ +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