121 lines
3.8 KiB
C#
121 lines
3.8 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
using static UnityEditor.PlayerSettings;
|
|
|
|
[System.Serializable]
|
|
public struct Register
|
|
{
|
|
public string Phone;
|
|
}
|
|
|
|
public struct AddGold
|
|
{
|
|
public int Gold;
|
|
}
|
|
|
|
public struct Login
|
|
{
|
|
public string Phone;
|
|
}
|
|
|
|
public struct GetListByPhone
|
|
{
|
|
public string Phone;
|
|
}
|
|
|
|
|
|
|
|
public class mount : MonoBehaviour
|
|
{
|
|
public static mount mountitem;
|
|
// Start is called before the first frame update
|
|
public virtual void Awake()
|
|
{
|
|
mountitem = this;
|
|
DontDestroyOnLoad(this);
|
|
|
|
|
|
//mountitem.login_screen();
|
|
|
|
}
|
|
private async void Start()
|
|
{
|
|
|
|
|
|
//AddGold AddGold = new AddGold();
|
|
//AddGold.Gold = 100;
|
|
//string jsonString1 = JsonUtility.ToJson(AddGold);
|
|
//string response_1 = await web.SendRequest(web.URL + "/Player/Login", "POST", jsonString1);
|
|
//de
|
|
|
|
|
|
|
|
//Login register = new Login();
|
|
//register.phonenumble = "13667637952";
|
|
//string jsonString = JsonUtility.ToJson(register);
|
|
//string response_1 = await web.SendRequest("http://47.109.133.52/Player/Login", "POST", jsonString);
|
|
|
|
//Register register = new Register();
|
|
//register.Phone = "13667637952";
|
|
//string jsonString = JsonUtility.ToJson(register);
|
|
|
|
//string response_1 = await web.SendRequest("http://47.109.133.52/Player/Login", "POST", jsonString);
|
|
//Debug.Log(response_1);
|
|
|
|
|
|
//string response_2 = await web.SendRequest("http://47.109.133.52/MinerElf/GetList", "POST");
|
|
//Debug.Log(response_2);
|
|
}
|
|
public GameObject add_pop_up(bool is_force = false)//Ìí¼Óµ¯´°
|
|
{
|
|
GameObject prefab = Resources.Load<GameObject>("preform/gui/pop_up_ui");
|
|
GameObject ranking_list_item = Instantiate(prefab, this.transform);
|
|
ranking_list_item.GetComponent<input_box_pop_up_window>().is_force = is_force;
|
|
return ranking_list_item;
|
|
}
|
|
//0 ÊäÈë¿ò
|
|
//1 ÊäÈë¿ò´ø°´Å¥
|
|
//2 È¡Ïû°´Å¥ È·¶¨°´Å¥
|
|
//3 ¹ºÂòÈ˲Åitem
|
|
//4 ¹ºÂòÈ˲ÅÎÄ×ÖÏûÏ¢
|
|
public void login_screen()//×¢²á½çÃæ
|
|
{
|
|
|
|
List<BoxType> boxTypes = new List<BoxType>();
|
|
boxTypes.Add(new BoxType { Name = "account_number", textName = " ÊÖ»úºÅ", prompt= "ÇëÊäÈëÊÖ»úºÅ", Type = 1, is_required = true });
|
|
boxTypes.Add(new BoxType { Name = "verification_code", textName = " ÑéÖ¤Âë ", prompt = "ÇëÊäÈëÑéÖ¤Âë", Type = 0, is_required = true });
|
|
boxTypes.Add(new BoxType { Name = "submit", textName = " È¡ÏûÈ·¶¨ ",Type = 2});
|
|
GameObject gameObject = add_pop_up(true);//Éú³Éµ¯´°Ä¸Ìå
|
|
List<GameObject> gameObjects = gameObject.GetComponent<input_box_pop_up_window>().updateUI(boxTypes, "×¢²á");//²âÊÔÊäÈë¿ò»Øµ÷´¦Àí
|
|
|
|
gameObjects[0].GetComponent<input_box_pop_up_window_item>().register_click((BoxType boxType,int type) =>//ÊÖ»úºÅ»ñÈ¡ÑéÖ¤Âëµã»÷
|
|
{
|
|
if (boxType.is_required && string.IsNullOrWhiteSpace(boxType.content)) {
|
|
Promptmgr.Instance.PromptBubble("Çë²»Òª" + boxType.textName + "Ϊ¿Õ");
|
|
return; }
|
|
Debug.Log("»ñÈ¡ÑéÖ¤Âë");
|
|
});
|
|
gameObjects[2].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//µÇ¼ȷ¶¨»òÈ¡Ïû
|
|
{
|
|
if (type == 0){
|
|
gameObject.GetComponent<input_box_pop_up_window>().destroy();
|
|
}
|
|
else if (type == 1){
|
|
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);
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|