示例#1
0
        public virtual void OnTrackableStateChanged(TrackableBehaviour.Status previousStatus, TrackableBehaviour.Status newStatus)
        {
            Debug.Log("tracking " + Identifier +
                      " curr=" + IsTracking +
                      " state=" + newStatus);

            /*
             * if (m_trackableBehaviour && m_trackableBehaviour.VuMarkTarget != null && m_trackableBehaviour.VuMarkTarget.InstanceId != null)
             * {
             * Debug.Log("tracking " + m_trackableBehaviour.VuMarkTarget.InstanceId +
             *  " curr=" + IsTracking +
             *  " state=" + newStatus);
             * }
             */

            if (newStatus == TrackableBehaviour.Status.DETECTED ||
                newStatus == TrackableBehaviour.Status.TRACKED ||
                newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED)
            {
                if (m_trackingTimer != null)
                {
                    m_trackingTimer.Cancel();
                    m_trackingTimer = null;
                }

                if (!IsTracking)
                {
                    StartExtendedTracking();

                    OnTrackingFound();
                }
                else if (newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED)
                {
                    if (m_trackingTimer != null)
                    {
                        m_trackingTimer.Cancel();
                        m_trackingTimer = null;
                    }

                    m_trackingTimer = UnityTimer.Call(3, StopExtendedTracking);
                }
            }
            else
            {
                if (IsTracking)
                {
                    OnTrackingLost();
                }
            }

            /*
             * if (VuforiaWorld.Instance.TrackingConditionMonitor != null)
             * {
             *  VuforiaWorld.Instance.TrackingConditionMonitor.TrackingMarkersUpdated();
             * }
             */
        }
示例#2
0
        public void SetVisible(float duration, bool startState)
        {
            gameObject.SetActive(startState);

            UnityTimer.Call(duration, () =>
            {
                gameObject.SetActive(!startState);
            });
        }
示例#3
0
        public override void DidShow()
        {
            if (m_timer != null)
            {
                m_timer.Cancel();
            }

            m_timer = UnityTimer.Call(Time, () =>
            {
                if (Panel)
                {
                    Panel.Back();
                }
            });

            base.DidShow();
        }
        public override void Populate(ResourcePanelData <Notification> data)
        {
            CancelTimer();

            base.Populate(data);

            var imageUrl = data.Resource.ImageUrl;

            if (ImagePane)
            {
                ImagePane.SetActive(imageUrl != null);
            }

            if (NoImagePane)
            {
                NoImagePane.SetActive(imageUrl == null);
            }

            Text titleText;
            Text messageText;

            // Supports different layout for notifications with and without images.
            if (imageUrl != null && Image)
            {
                titleText   = ImageTitle ?? NoImageTitle;
                messageText = ImageMessage ?? NoImageMessage;

                ImageLoader.LoadImageOnThread(imageUrl, Image);
            }
            else
            {
                titleText   = NoImageTitle ?? ImageTitle;
                messageText = NoImageMessage ?? ImageMessage;
            }

            if (titleText)
            {
                titleText.text = data.Resource.Title;
            }

            if (messageText)
            {
                messageText.text = data.Resource.Message;
            }

            if (Vibrate || data.Resource.Vibrate)
            {
                Handheld.Vibrate();
            }

            if (Data.Resource.Sound != null)
            {
                var localUrl = WebServices.Instance.MediaDownloadManager.GetPathForItem(Data.Resource.Sound.Url);

                Platform.Instance.ForegroundAudioChannel.Play(new Uri(localUrl));
            }

            if (AutoDismiss)
            {
                m_timer = UnityTimer.Call(DismissTime, Back);
            }
        }