45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
using Assets.Scripts;
|
|
using Assets.Scripts.UI.Control;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
public class DeleteAccount : PFUIPanel
|
|
{
|
|
protected override void Awake()
|
|
{
|
|
PFUIInputField password = transform.Find("Content/Password").GetComponent<PFUIInputField>();
|
|
UIManager.AddEvent(transform.Find("Content/Delete").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
|
{
|
|
Delete(password.Text);
|
|
});
|
|
UIManager.AddEvent(transform.Find("Content/Cancel").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
|
{
|
|
Close();
|
|
});
|
|
}
|
|
async void Delete(string pwd)
|
|
{
|
|
var res = await ConfigHelper.userApi.DeleteAccount(pwd);
|
|
if (res.result)
|
|
{
|
|
#if !(UNITY_ANDROID || UNITY_IOS)
|
|
SceneManager.LoadScene("Login");
|
|
#else
|
|
SceneManager.LoadScene("Login-Mobile");
|
|
#endif
|
|
Close();
|
|
}
|
|
else
|
|
{
|
|
Utils.showToast(null, res.errMsg);
|
|
}
|
|
}
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
}
|