diff --git a/meng_yao/Assets/communal/mount.cs b/meng_yao/Assets/communal/mount.cs index e063e5fe7..e6a5aa479 100644 --- a/meng_yao/Assets/communal/mount.cs +++ b/meng_yao/Assets/communal/mount.cs @@ -1,7 +1,12 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; - +[System.Serializable] +public struct Register +{ + public string Phone; + public string Code; +} public class mount : MonoBehaviour { // Start is called before the first frame update @@ -29,11 +34,11 @@ public class mount : MonoBehaviour boxTypes[1] = new BoxType { Name = "verification_code", textName = " 验证码 ", prompt = "请输入验证码", Type = 0, is_required = true }; boxTypes[2] = new BoxType { Name = "submit", textName = " 取消确定 ",Type = 2}; GameObject gameObject = add_pop_up(); - //测试输入框回调处理 - List gameObjects = gameObject.GetComponent().updateUI(boxTypes, "注册"); + List gameObjects = gameObject.GetComponent().updateUI(boxTypes, "注册");//测试输入框回调处理 + gameObjects[0].GetComponent().register_click((BoxType boxType,int type) =>//手机号获取验证码点击 { - if (string.IsNullOrWhiteSpace(boxType.content)) { + if (boxType.is_required && string.IsNullOrWhiteSpace(boxType.content)) { Promptmgr.Instance.PromptBubble("请不要" + boxType.textName + "为空"); return; } Debug.Log("获取验证码"); @@ -44,7 +49,11 @@ public class mount : MonoBehaviour Destroy(gameObject); } else if (type == 1){ - string response = await web.SendRequest("http://47.109.133.52/Player/Register", "POST"); + Register register = new Register(); + register.Phone = boxTypes[0].content; + register.Code = boxTypes[0].content; + string jsonString = JsonUtility.ToJson(register); + string response = await web.SendRequest("http://47.109.133.52/Player/Register", "POST", jsonString); Debug.Log(response); } }); diff --git a/meng_yao/Assets/communal/ugui/input_box_pop_up_window/input_box_pop_up_window.cs b/meng_yao/Assets/communal/ugui/input_box_pop_up_window/input_box_pop_up_window.cs index d66a4a2aa..3f3f9737f 100644 --- a/meng_yao/Assets/communal/ugui/input_box_pop_up_window/input_box_pop_up_window.cs +++ b/meng_yao/Assets/communal/ugui/input_box_pop_up_window/input_box_pop_up_window.cs @@ -52,31 +52,4 @@ public class input_box_pop_up_window : MonoBehaviour return gameObjects; } - public void onClikeAsync()//点击事件 - { - bool is_ret = true; - foreach (var boxType in boxTypes) - { - switch (boxType.Type) - { - case 0: - if (boxType.is_required && string.IsNullOrWhiteSpace(boxType.content)) - { - is_ret = false; - Promptmgr.Instance.PromptBubble("请不要"+boxType.textName+"为空"); - } - break; - case 1: - if (boxType.is_required && string.IsNullOrWhiteSpace(boxType.content)) - { - is_ret = false; - Promptmgr.Instance.PromptBubble("请不要" + boxType.textName + "为空"); - } - break; - } - } - - if (is_ret) OnClike.Invoke(boxTypes); - - } }