Example #1
0
        //Window bottom actions:

        public void Button_Close()
        {
            if (activeDP == null)
            {
                return;
            }

            if (!activeDP.hasDPAppParent)
            {
                DPUIManager.Animate(activeDP, DPAnimation.FadeOut);
            }
            else
            {
                TheBarManager.I.MinimizeApp(activeDP.dpAppParent.appKey);
            }


            if (activeDP.useLookHiding)
            {
                StartCoroutine(DisableDPDelayed(0.3f));
            }


            //Hide();
        }
Example #2
0
        public void EndCurrentDrag()
        {
            if (!isDragging)
            {
                return;
            }

            //Debug.Log("ending drag");


            if (draggingDP == null)
            {
                Debug.LogError("Dragging DP null");
                return;
            }

            draggingDP.onOverlayDragged?.Invoke(false);

            //If it was using a snap point in the past, clear it:
            draggingDP.ClearAllSnapData();

            //If we ended the drag on a new snap point
            if (isUsingSnapPoint)
            {
                draggingDP.TransitionOverlayPosition(activeSnapPoint.transform.localPosition, activeSnapPoint.transform.localEulerAngles, transitionSnapPointSpeed,
                                                     Ease.InOutCubic, false);

                //Remove any previous thing
                if (activeSnapPoint.dpApp != null)
                {
                    TheBarManager.I.MinimizeApp(activeSnapPoint.dpApp.appKey);
                }
                else if (activeSnapPoint.dpBase != null)
                {
                    DPUIManager.Animate(activeSnapPoint.dpBase, DPAnimation.FadeOut);
                    activeSnapPoint.ClearAllSnapData();
                }

                if (draggingDP.hasDPAppParent && draggingDP.dpAppParent.dpMain == draggingDP)
                {
                    activeSnapPoint.SetSnappedApp(draggingDP.dpAppParent);
                }
                else
                {
                    activeSnapPoint.SetSnappedDP(draggingDP);
                }
            }


            TheBarManager.I.ToggleSnapPointsVisible(false);

            isDragging = false;

            dummyDragChild.parent = null;

            draggingDP      = null;
            activeSnapPoint = null;

            draggingDPIsAutoCurving = false;
        }
Example #3
0
        /// <summary>
        /// Changes the visibility of a DPApp
        /// </summary>
        /// <param name="dpApp"></param>
        /// <param name="visible"></param>
        public void ToggleDPApp(DPApp dpApp, bool visible, bool instant = false)
        {
            if (dpApp == null)
            {
                return;
            }

            if (visible && !dpApp.isInitialized)
            {
                dpApp.OnInit();
            }

            dpApp.OnVisibilityChange(visible);

            if (visible)
            {
                if (instant)
                {
                    dpApp.dpMain.overlay.SetVisible(true);
                }
                else
                {
                    DPUIManager.Animate(dpApp.dpMain, "FadeIn");
                }
            }
            else
            {
                if (instant)
                {
                    dpApp.dpMain.overlay.SetVisible(false);
                }
                DPUIManager.Animate(dpApp.dpMain, "FadeOut");
            }
        }
        public void KillCurrentPopupNow()
        {
            hoverDP.KillTransitions();
            //hoverDP.TransitionOverlayOpacity(0f, 0.5f, false);
            DPUIManager.Animate(hoverDP, DPAnimation.FadeOut);

            _popupIsActive = false;
        }
Example #5
0
 public void ToggleBlackout(bool on)
 {
     if (on)
     {
         DPUIManager.Animate(blackoutDP, DPAnimation.FadeIn);
     }
     else
     {
         DPUIManager.Animate(blackoutDP, DPAnimation.FadeOut);
     }
 }
Example #6
0
        public void Button_Close()
        {
            DPUIManager.Animate(keyboardDP, DPAnimation.FadeOut);

            if (DPSettings.config.focusGameWhenNotInteracting)
            {
                GamingManager.FocusActiveGame();
            }


            //ResetPrevious();
        }
        public void Hide()
        {
            if (!isShowing)
            {
                return;
            }

            DPUIManager.Animate(detailsDP, DPAnimations.FadeOutDown);
            DPUIManager.Animate(detailsGameDP, DPAnimations.FadeOutDown);

            //SoundManager.I.PlaySoundOnDPCam(detailsGameDP, Vector2.zero, DPSoundEffect.Activation);
        }
Example #8
0
 private void SetVisibility(bool visible, bool force = false)
 {
     if (force && visible || visible && !isActive)
     {
         DPUIManager.Animate(toolbarDP, DPAnimation.FadeIn);
         isActive = true;
     }
     else if (force && !visible || !visible && isActive)
     {
         DPUIManager.Animate(toolbarDP, DPAnimation.FadeOut);
         isActive = false;
     }
 }
Example #9
0
        public void Show(DPOverlayBase dpBase, Vector3 pos, string name, Texture2D icon)
        {
            //if (currentDP == dpBase) return;

            //Unsub from events:
            if (currentDP != null)
            {
                currentDP.onOverlayDragged -= dragAction;
            }


            currentDP = dpBase;

            //Sub to events
            dragAction = currentDP.onOverlayDragged += delegate(bool b) {
                if (!b)
                {
                    InitUI(currentDP);
                }
            };

            InitUI(dpBase);

            textCurrent.SetText(name);
            iconCurrent.texture = icon;


            /*transCalcHMDDir.position = SteamVRManager.I.hmdTrans.position;
             * transCalcHMDDir.LookAt(dpBase.transform);*/


            //windowSettingsDP.OrphanOverlay();

            windowSettingsTopDP.SetOverlayTransform(new Vector3(0f, 0.36f, 0f), new Vector3(0f, 0f, 15f), true, true, true);

            windowSettingsDP.KillTransitions();

            windowSettingsDP.transform.position = pos;
            windowSettingsDP.transform.LookAt(2 * windowSettingsDP.transform.position - SteamVRManager.I.hmdTrans.position);

            windowSettingsDP.SyncTransform();

            windowSettingsCurrentDP.SetOverlayTransform(new Vector3(0f, 0.36f, 0), Vector3.zero);

            //dpBase.AddChildOverlay(windowSettingsDP);


            DPUIManager.Animate(windowSettingsDP, DPAnimations.FadeIn);

            isActive = true;
        }
Example #10
0
        /// <summary>
        /// Used internally to toggle the visibility of the bar, it's children, and the DPApps
        /// </summary>
        /// <param name="visible"></param>
        private void ToggleVisible(bool visible)
        {
            isOpened = visible;


            if (!visible)
            {
                OverlayInteractionManager.I.EndCurrentDrag();

                TheBarManager.I.ToggleSnapPointsVisible(false);

                //Return focus to the active game if that's on
                if (DPSettings.config.focusGameWhenNotInteracting)
                {
                    GamingManager.FocusActiveGame();
                }


                DPUIManager.Animate(theBarDP, DPAnimation.FadeOut);
            }
            else
            {
                Vector3 goodRotBar = new Vector3(45, activatedRotation.eulerAngles.y, 0);
                theBarDP.SetOverlayTransform(GetPosFromOriginOffset(new Vector3(0, -0.45f, 0f)), goodRotBar);


                DPUIManager.Animate(theBarDP, DPAnimation.FadeInUp);
            }

            OverlayInteractionManager.I.TryEnableInteraction(visible, true);

            ToggleBlackout(visible);

            onBarOpened?.Invoke(visible);


            //Handle all the DPApps
            if (visible)
            {
                UpdateAnchoredAppsTransform();
            }

            ToggleApps(visible);
        }
        private IEnumerator Show()
        {
            //Vector3 posDetails = LibraryApp.I.dpMain.transform.position + LibraryApp.I.dpMain.transform.forward * -0.06f + LibraryApp.I.dpMain.transform.right * 0.13f;
            //Vector3 posDetailsGame = LibraryApp.I.dpMain.transform.position + LibraryApp.I.dpMain.transform.forward * -0.06f + LibraryApp.I.dpMain.transform.right * -0.13f;


            //detailsDP.SetOverlayTransform(posDetails, LibraryApp.I.dpMain.transform.eulerAngles, true, true, false);
            //detailsGameDP.SetOverlayTransform(posDetailsGame, LibraryApp.I.dpMain.transform.eulerAngles, true, true, false);

            detailsDP.SetOverlayTransform(new Vector3(0.17f, 0f, -0.07f), Vector3.zero, true);
            detailsGameDP.SetOverlayTransform(new Vector3(-0.17f, 0f, -0.07f), Vector3.zero, true);

            DPUIManager.Animate(detailsDP, DPAnimations.FadeInUp);
            DPUIManager.Animate(detailsGameDP, DPAnimations.FadeInUp);


            isShowing = true;

            yield break;
        }
Example #12
0
        public void ToggleSnapPointsVisible(bool visible)
        {
            if (snapPointsVisible == visible)
            {
                return;
            }

            if (visible && !DPSettings.config.snapPointsEnabled)
            {
                return;
            }

            foreach (DPSnapPoint snapPoint in snapPoints)
            {
                if (visible)
                {
                    snapPoint.iconDP.overlay.SetWidthInMeters(0.05f, true);

                    //if (snapPoint.isOccupied) snapPoint.iconDP.overlay.SetOpacity(0.5f);
                    snapPoint.iconDP.SetOverlayOpacity(0.9f, true);

                    snapPoint.iconDP.transform.SetParent(snapPoint.transform);
                    snapPoint.iconDP.transform.localEulerAngles = Vector3.zero;
                    snapPoint.iconDP.transform.localPosition    = new Vector3(0, 0, -0.03f);
                    snapPoint.iconDP.SyncTransform();
                    DPUIManager.Animate(snapPoint.iconDP, DPAnimation.FadeIn);
                    //snapPoint.iconDP.overlay.SetVisible(true);
                }
                else
                {
                    DPUIManager.Animate(snapPoint.iconDP, DPAnimation.FadeOut);
                    //snapPoint.iconDP.overlay.SetVisible(false);
                }
            }

            snapPointsVisible = visible;
        }
Example #13
0
        /// <summary>
        /// Main function to launch and display an app.
        /// </summary>
        /// <param name="appKey">The key of the app to launch</param>
        /// <param name="snapPoint">The snap point to launch the app on, if any</param>
        /// <param name="spawnPos">The spawn pos for the app, if not using snap points</param>
        /// <param name="spawnRot">The spawn rot for the app, if not using snap points</param>
        /// <param name="device">The device it should be anchored to</param>
        public DPApp LaunchApp(string appKey, DPSnapPoint snapPoint = null, Vector3 spawnPos = new Vector3(), Vector3 spawnRot = new Vector3(),
                               DPOverlayTrackedDevice device        = DPOverlayTrackedDevice.None, bool isAnchoredToTheBar = true)
        {
            DPApp dpApp;

            //Check if the app is already open:
            if (openApps.ContainsKey(appKey))
            {
                dpApp = openApps[appKey];

                //Check if the snap point is the same as the one it's on already:
                if (snapPoint != null && snapPoint.dpApp == dpApp)
                {
                    snapPoint.CancelPreviewAndRestore();
                    return(dpApp);
                }

                //Don't make a new button since it's already open
            }
            else
            {
                dpApp = loadedApps[appKey];

                if (dpApp == null)
                {
                    Debug.LogError("Tried to open not-loaded DPApp :/ " + appKey);
                }

                AddOpenApp(dpApp);
            }


            dpApp.dpMain.KillTransitions();


            //If the app was previously on a snap point, clear the data of that snap point:
            if (dpApp.snapPoint != null)
            {
                dpApp.snapPoint.ClearAllSnapData();
            }

            //If the new snap point has an app on it, minimize that app:
            if (snapPoint != null && snapPoint.isOccupied)
            {
                if (snapPoint.dpApp != null)
                {
                    MinimizeApp(snapPoint.dpApp.appKey);
                }
                else
                {
                    DPUIManager.Animate(snapPoint.dpBase, DPAnimation.FadeOut);
                    snapPoint.ClearAllSnapData();
                }
            }


            //Disable look hiding
            dpApp.dpMain.useLookHiding      = false;
            dpApp.dpMain.useDistanceHiding  = false;
            dpApp.dpMain.useSnapAnchoring   = false;
            dpApp.dpMain.useSmoothAnchoring = false;
            dpApp.dpMain.isInteractable     = true;

            //Clear the anchor:
            dpApp.dpMain.SetOverlayTrackedDevice(DPOverlayTrackedDevice.None);


            if (isAnchoredToTheBar)
            {
                AddAnchoredDP(dpApp.dpMain);
            }

            //If it's launching onto a snap point:
            if (snapPoint != null)
            {
                snapPoint.SetSnappedApp(dpApp);

                dpApp.dpMain.overlay.SetWidthInMeters(snapPoint.maxOverlayWidth, false);
                dpApp.dpMain.overlay.SetCurvature(snapPoint.overlayCurvature, false);
                dpApp.dpMain.SetOverlayTransform(snapPoint.transform.localPosition, snapPoint.transform.localEulerAngles, true, false);

                if (dpApp.dpMain.isResponsive && snapPoint.useWindowResizing && DPSettings.config.snapPointsResize)
                {
                    dpApp.dpMain.ResizeForRatio(snapPoint.resizeRatioX, snapPoint.resizeRatioY);
                }

                dpApp.dpMain.snapPointQueuedToResize = true;
            }
            //Else, we're launching it somewhere in the world:
            else
            {
                dpApp.dpMain.SetOverlayTransform(spawnPos, spawnRot, true, false);
                dpApp.dpMain.overlay.SetCurvature(0f, false);
            }

            ToggleDPApp(dpApp, true);
            dpApp.OnTheBarToggled(true);
            dpApp.OnOpen();


            return(dpApp);
        }
Example #14
0
 public void Hide()
 {
     DPUIManager.Animate(windowSettingsDP, "FadeOut");
     currentDP = null;
     isActive  = false;
 }