Esempio n. 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();
            });
        }
        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);
            }
        }