Пример #1
0
        private void ShowErrorTips(string msg)
        {
            var sessionbehaviour = GameObject.FindObjectOfType <NRSessionBehaviour>();

            if (sessionbehaviour != null)
            {
                GameObject.Destroy(sessionbehaviour.gameObject);
            }
            var input = GameObject.FindObjectOfType <NRInput>();

            if (input != null)
            {
                GameObject.Destroy(input.gameObject);
            }
            var virtualdisplay = GameObject.FindObjectOfType <NRVirtualDisplayer>();

            if (virtualdisplay != null)
            {
                GameObject.Destroy(virtualdisplay.gameObject);
            }
            GameObject.Instantiate <NRGlassesInitErrorTip>(Resources.Load <NRGlassesInitErrorTip>("NRErrorTips")).Init(msg, () =>
            {
                NRDevice.QuitApp();
            });
        }
Пример #2
0
        public void DisableSession()
        {
            if (SessionState != SessionState.Running)
            {
                return;
            }
            SessionState = SessionState.Paused;

            if (NRVirtualDisplayer.RunInBackground)
            {
                NRRenderer?.Pause();
                NativeAPI.NativeTracking?.Pause();
                VirtualDisplayer?.Pause();
                NRDevice.Instance.PauseGlassesController();
                NRDevice.Instance.PauseHMD();
            }
            else
            {
                NRDevice.ForceKill();
            }
        }
Пример #3
0
        public void DisableSession()
        {
            if (SessionState != SessionState.Running)
            {
                return;
            }

            // Do not put it in other thread...
            if (NRVirtualDisplayer.RunInBackground)
            {
                NRRenderer?.Pause();
                NativeAPI.NativeTracking?.Pause();
                VirtualDisplayer?.Pause();
                NRDevice.Instance.Pause();
                SessionState = SessionState.Paused;
            }
            else
            {
                NRDevice.ForceKill();
            }
        }
        public virtual void FillData(NRNotificationListener.Level level, float duration = 2f)
        {
            NotificationInfo info;

            switch (level)
            {
            case NRNotificationListener.Level.High:
                info = m_HighLevelInfo;
                break;

            case NRNotificationListener.Level.Middle:
                info = m_MiddleLevelInfo;
                m_ConfirmBtn?.gameObject.SetActive(false);
                break;

            case NRNotificationListener.Level.Low:
            default:
                GameObject.Destroy(gameObject);
                return;
            }

            m_Title.text   = info.title;
            m_Message.text = info.message;
            m_Duration     = duration;
            m_Icon.sprite  = info.sprite;

            m_ConfirmBtn?.onClick.AddListener(() =>
            {
                NRDevice.QuitApp();
            });

            if (m_Duration > 0)
            {
                Invoke("AutoDestroy", m_Duration);
            }
        }
Пример #5
0
        private void OnApplicationPause(bool pause)
        {
            // If NRSessionBehaviour is exist, do not oprate.
            if (NRSessionManager.Instance.NRSessionBehaviour != null)
            {
                return;
            }

            if (pause)
            {
                if (RunInBackground)
                {
                    this.Pause();
                }
                else
                {
                    NRDevice.ForceKill();
                }
            }
            else
            {
                this.Resume();
            }
        }