Cute_demon_attacks/meng_yao/Assets/communal/mount.cs

75 lines
2.7 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
{
2024-10-30 04:21:58 +08:00
public static mount mountitem;
2024-10-29 16:00:02 +08:00
// Start is called before the first frame update
2024-10-30 04:21:58 +08:00
void Awake()
2024-10-29 16:00:02 +08:00
{
2024-10-30 04:21:58 +08:00
mountitem = this;
2024-10-29 16:00:02 +08:00
DontDestroyOnLoad(this);
2024-10-29 20:47:58 +08:00
2024-10-30 04:21:58 +08:00
//mountitem.login_screen();
2024-10-29 20:47:58 +08:00
}
2024-10-30 04:21:58 +08:00
public GameObject add_pop_up(bool is_force = false)//<2F><><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD>
2024-10-29 20:47:58 +08:00
{
GameObject prefab = Resources.Load<GameObject>("preform/gui/pop_up_ui");
GameObject ranking_list_item = Instantiate(prefab, this.transform);
2024-10-30 04:21:58 +08:00
ranking_list_item.GetComponent<input_box_pop_up_window>().is_force = is_force;
2024-10-29 20:47:58 +08:00
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>ť
2024-10-30 04:21:58 +08:00
//3 <20><><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD>item
//4 <20><><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
2024-10-29 20:47:58 +08:00
public void login_screen()//ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
2024-10-30 03:42:06 +08:00
List<BoxType> boxTypes = new List<BoxType>();
boxTypes.Add(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.Add(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.Add(new BoxType { Name = "submit", textName = " ȡ<><C8A1>ȷ<EFBFBD><C8B7> ",Type = 2});
2024-10-30 04:21:58 +08:00
GameObject gameObject = add_pop_up(true);//<2F><><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD>ĸ<EFBFBD><C4B8>
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);
2024-10-30 03:42:06 +08:00
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-30 06:22:08 +08:00
2024-10-30 12:27:47 +08:00
//string response = await web.SendRequest("http://47.109.133.52/MinerElf/GetList", "POST");
//Debug.Log(response);
2024-10-30 06:22:08 +08:00
2024-10-29 20:47:58 +08:00
}
});
2024-10-30 03:42:06 +08:00
}
2024-10-30 04:46:20 +08:00
2024-10-29 16:00:02 +08:00
}