Exemple #1
0
        public void OnPointerClick(PointerEventData eventData)
        {
            switch (eventType)
            {
            case Event.ExitMedia:
                MediaPlayerEventDispatcher.RaiseExitMedia();
                break;

            case Event.NextFile:
                MediaPlayerEventDispatcher.RaiseNextFile();
                break;

            case Event.PreviousFile:
                MediaPlayerEventDispatcher.RaisePreviousFile();
                break;

            default:
                Debug.LogError("Unsupported Event: " + eventType);
                break;
            }
        }
        void Update()
        {
            if (playbackControls == null)
            {
                return;
            }

            bool isManipulatingScreen = ConditionsManager.Instance.IsConditionTrue(ManipulatingScreenCondition.IDENTIFIER);

            if (isManipulatingScreen)
            {
                return;
            }

            if (GvrControllerInput.ClickButtonUp && !playbackControls.IsPointerHovering)
            {
                TogglePlaybackControls();
            }

            bool isControllerIdle        = ConditionsManager.Instance.IsConditionTrue(ControllerIdleCondition.IDENTIFIER);
            bool shouldAutoCloseControls = isControllerIdle && !playbackControls.IsPointerHovering;

            if (shouldAutoCloseControls && closeAfterDelayCoroutine == null)
            {
                closeAfterDelayCoroutine = StartCoroutine(CloseAfterDelay(closeOnIdleDelaySeconds));
            }

            if (!shouldAutoCloseControls && closeAfterDelayCoroutine != null)
            {
                StopCoroutine(closeAfterDelayCoroutine);
                closeAfterDelayCoroutine = null;
            }

            if (GvrControllerInput.AppButtonUp)
            {
                MediaPlayerEventDispatcher.RaiseExitMedia();
            }
        }