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.
44 lines
1.1 KiB
44 lines
1.1 KiB
4 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using AX.DevelopEngine;
|
||
|
using AX.Timer;
|
||
|
public class UniqueIdentifier : MonoSingleton<UniqueIdentifier>
|
||
|
{
|
||
|
private Timer timer_quit;
|
||
|
/// <summary>
|
||
|
/// 只需调用一下初始化即可
|
||
|
/// 无需其他逻辑
|
||
|
/// </summary>
|
||
|
public void Init()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
// Use this for initialization
|
||
|
void Start()
|
||
|
{
|
||
|
string original_filepath = Application.dataPath + @"/xml/UniqueIdentifier.xml";
|
||
|
XmlProcess xmlProcess = new XmlProcess(original_filepath);
|
||
|
var flag = xmlProcess.CheckUnique("assets", "id");
|
||
|
timer_quit = new Timer(5.0f);
|
||
|
if (!flag)
|
||
|
{
|
||
|
timer_quit.AddTimeOutEvent(() =>
|
||
|
{
|
||
|
QuitApplicationManager.Instance.SureQuit();
|
||
|
});
|
||
|
timer_quit.StartTimer();
|
||
|
}
|
||
|
}
|
||
|
void Update()
|
||
|
{
|
||
|
timer_quit.UpdateTimer();
|
||
|
}
|
||
|
private void OnGUI()
|
||
|
{
|
||
|
if (timer_quit.IsTimering)
|
||
|
{
|
||
|
QuitApplicationManager.Instance.SetGuiTip("机器码验证校验失败,程序即将退出! " + timer_quit.GetRemainingTime());
|
||
|
}
|
||
|
}
|
||
|
}
|