using UnityEngine; using System.Collections; using AX.DevelopEngine; using AX.Timer; public class UniqueIdentifier : MonoSingleton { private Timer timer_quit; /// /// 只需调用一下初始化即可 /// 无需其他逻辑 /// 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()); } } }