Cute_demon_attacks/meng_yao/Assets/communal/mount.cs

62 lines
2.3 KiB
C#
Raw Normal View History

2024-10-29 16:00:02 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
2024-10-30 01:06:46 +08:00
[System.Serializable]
public struct Register
{
public string Phone;
public string Code;
}
2024-10-29 16:00:02 +08:00
public class mount : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
DontDestroyOnLoad(this);
2024-10-29 20:47:58 +08:00
login_screen();
}
public GameObject add_pop_up()//<2F><><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD>
{
GameObject prefab = Resources.Load<GameObject>("preform/gui/pop_up_ui");
GameObject ranking_list_item = Instantiate(prefab, this.transform);
return ranking_list_item;
}
//0 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť
//2 ȡ<><C8A1><EFBFBD><EFBFBD>ť ȷ<><C8B7><EFBFBD><EFBFBD>ť
public void login_screen()//ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
BoxType[] boxTypes = new BoxType[3];
boxTypes[0] = new BoxType { Name = "account_number", textName = " <20>ֻ<EFBFBD><D6BB><EFBFBD>", prompt = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>", Type = 1, is_required = true };
boxTypes[1] = new BoxType { Name = "verification_code", textName = " <20><>֤<EFBFBD><D6A4> ", prompt = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><D6A4>", Type = 0, is_required = true };
boxTypes[2] = new BoxType { Name = "submit", textName = " ȡ<><C8A1>ȷ<EFBFBD><C8B7> ",Type = 2};
GameObject gameObject = add_pop_up();
2024-10-30 01:06:46 +08:00
List<GameObject> gameObjects = gameObject.GetComponent<input_box_pop_up_window>().updateUI(boxTypes, <><D7A2>");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
2024-10-29 20:47:58 +08:00
gameObjects[0].GetComponent<input_box_pop_up_window_item>().register_click((BoxType boxType,int type) =>//<2F>ֻ<EFBFBD><D6BB>Ż<EFBFBD>ȡ<EFBFBD><C8A1>֤<EFBFBD><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
2024-10-30 01:06:46 +08:00
if (boxType.is_required && string.IsNullOrWhiteSpace(boxType.content)) {
2024-10-29 20:47:58 +08:00
Promptmgr.Instance.PromptBubble("<22>벻Ҫ" + boxType.textName + <><CEAA>");
return; }
Debug.Log("<22><>ȡ<EFBFBD><C8A1>֤<EFBFBD><D6A4>");
});
gameObjects[2].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//<2F><>¼ȷ<C2BC><C8B7><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>
{
if (type == 0){
Destroy(gameObject);
}
else if (type == 1){
2024-10-30 01:06:46 +08:00
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);
2024-10-29 20:47:58 +08:00
Debug.Log(response);
}
});
}
2024-10-29 16:00:02 +08:00
}