You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.6 KiB
73 lines
1.6 KiB
using System; |
|
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
using UnityEngine.Events; |
|
|
|
/// <summary> |
|
/// 程序关闭提示处理 |
|
/// </summary> |
|
public class ApplicationClose : MonoBehaviour |
|
{ |
|
private bool isSure = false;//是否点击确定(退出)按钮 |
|
public string SignOutApi = "/api/Account/SignOut"; |
|
|
|
public bool isSmartX1Exit = false;//是否是检测到没有加密狗而自动退出程序 |
|
|
|
private void Awake() |
|
{ |
|
DontDestroyOnLoad(this); |
|
} |
|
|
|
//private void OnApplicationQuit() |
|
//{ |
|
// if (!isSmartX1Exit) |
|
// { |
|
// if (!isSure) |
|
// { |
|
// Application.CancelQuit(); |
|
|
|
// MessageBox.Show("确定退出程序?", |
|
// Sure, |
|
// null |
|
// ); |
|
// } |
|
// } |
|
//} |
|
|
|
//private void Sure() |
|
//{ |
|
// if (!string.IsNullOrEmpty(WebRequestManager.Instance.userName)) |
|
// { |
|
// WebRequestManager.Instance.PostJson(WebRequestManager.Instance.httpUrl + SignOutApi, SignOuted, SignOutError); |
|
// } |
|
// else |
|
// { |
|
// isSure = true; |
|
// Application.Quit(); |
|
// } |
|
//} |
|
|
|
private void SignOuted() |
|
{ |
|
isSure = true; |
|
Application.Quit(); |
|
} |
|
|
|
private void SignOutError(int errorCode, string errorMsg) |
|
{ |
|
//MessageBox.Show($"退出程序错误:{errorCode},{errorMsg}", 20); |
|
} |
|
|
|
// Start is called before the first frame update |
|
void Start() |
|
{ |
|
|
|
} |
|
|
|
// Update is called once per frame |
|
void Update() |
|
{ |
|
|
|
} |
|
}
|
|
|