123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using UnityEngine;
- using Rokid.UXR.Native;
- using Rokid.UXR.UI;
- using UnityEngine.SceneManagement;
- namespace Rokid.UXR.Module
- {
- /// <summary>
- /// Device diagnostic tool
- /// </summary>
- public class DFCheckBehaviour : MonoBehaviour
- {
- public float delayTime = 5;
- private bool checkValid;
- public FuncDeviceCheck.FuncEnum needCheckFunc;
- void Start()
- {
- #if !UNITY_EDITOR
- if (!CheckDevice())
- {
- //add tip
- string tipInfo = string.Format("当前设备{0},不支持{1}功能,{2}秒后退出场景", NativeInterface.NativeAPI.GetGlassName(), needCheckFunc.ToString(), delayTime);
- UIManager.Instance().CreatePanel<TipPanel>(true).Init(tipInfo, TipLevel.Error, delayTime, () =>
- {
- if (SceneManager.GetActiveScene().buildIndex == 0)
- {
- Quit();
- }
- else
- {
- SceneManager.LoadScene(0);
- }
- });
- }
- #endif
- }
- public void Quit()
- {
- Application.Quit();
- NativeInterface.NativeAPI.KillProcess();
- }
- public bool CheckDevice()
- {
- return FuncDeviceCheck.CheckFunc(needCheckFunc);
- }
- }
- }
|