60 lines
1.8 KiB
C#
60 lines
1.8 KiB
C#
using Newtonsoft.Json;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class CancelAccount : Base
|
|
{
|
|
public TMP_InputField account;
|
|
public TMP_InputField YanzhengmaInput;
|
|
public Button ConfirmBtn;
|
|
public Button CancelBtn;
|
|
// Start is called before the first frame update
|
|
async void Start()
|
|
{
|
|
RealPlayerInfo realPlayerInfo = new RealPlayerInfo();
|
|
queryPlayerInfo queryPlayerInfo = new queryPlayerInfo();
|
|
realPlayerInfo = await queryPlayerInfo.QueryPlayerInfoPro();
|
|
account.text = "" + realPlayerInfo.data.userName;
|
|
ConfirmBtn.onClick.AddListener(ConfirmClick);
|
|
CancelBtn.onClick.AddListener((() => {Destroy(gameObject);}));
|
|
}
|
|
async void ConfirmClick()
|
|
{
|
|
string response = "";//测试
|
|
string body = "{\"verifyCode\":" + int.Parse(YanzhengmaInput.text) + "}";
|
|
Debug.Log(body);
|
|
response = await web.SendRequest(web.URL + "/snail/user/cancel", "POST", body, Global.global.CreateHeaders());
|
|
Debug.Log(response);
|
|
ChangepassRt cpr = JsonConvert.DeserializeObject<ChangepassRt>(response);
|
|
addEventPopUp(cpr.message);
|
|
if (cpr.code == 200)
|
|
{
|
|
Destroy(this.gameObject);
|
|
#if UNITY_EDITOR
|
|
// 在编辑器模式下停止播放
|
|
if (EditorApplication.isPlaying)
|
|
{
|
|
EditorApplication.isPlaying = false;
|
|
}
|
|
else
|
|
{
|
|
Debug.Log("正在测试环境中退出");
|
|
}
|
|
#else
|
|
// 在打包后的环境中退出
|
|
Debug.Log("正在打包环境中退出");
|
|
Application.Quit();
|
|
#endif
|
|
}
|
|
}
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|