Пример #1
0
        public DPDesktopOverlay NewDPMonitorOverlay(UDDMonitor monitor)
        {
            int index = GetValidOverlayIndex();

            if (DemoManager.isDemo)
            {
                if (DPDesktopOverlay.overlays.Count >= 3)
                {
                    return(null);
                }
            }

            DPDesktopOverlay monitorDP = Instantiate(dpRenderWindowPF, _overlaysHolderTransform).GetComponentInChildren <DPDesktopOverlay>();

            monitorDP.PreInitialize();

            string key = "DPMonitor-" + index;

            monitorDP.dpAppParent.appKey = key;

            monitorDP.SetTargetCapture(monitor);

            monitorDP.dpAppParent.iconTex = desktopIcon;

            overlays.Add(monitorDP);

            TheBarManager.I.AddLoadedApp(monitorDP.dpAppParent);

            //OverlayInteractionManager.I.StartPreviewDrag(key);
            //TheBarManager.I.LaunchAppToMainSnap(key);

            //Debug.Log(monitorDP.overlay.handle + " : " + monitorDP.overlay.overlayKey + " : " + monitorDP.window.handle);

            return(monitorDP);
        }
Пример #2
0
        /// <summary>
        /// Used internally for making a new overlay.
        /// </summary>
        /// <param name="window"></param>
        /// <returns>The created overlay</returns>
        public DPDesktopOverlay NewDPWindowOverlay(UwcWindow window)
        {
            if (window == null)
            {
                return(null);
            }

            int index = GetValidOverlayIndex();

            if (DemoManager.isDemo)
            {
                if (DPDesktopOverlay.overlays.Count >= 3)
                {
                    return(null);
                }
            }


            DPDesktopOverlay dpWindow = Instantiate(dpRenderWindowPF, _overlaysHolderTransform).GetComponentInChildren <DPDesktopOverlay>();

            dpWindow.PreInitialize();

            string key = "DPWindow-" + index;

            dpWindow.dpAppParent.appKey = key;

            //dpWindow.InitWindow(window);


            if (WinNative.IsIconic(window.handle))
            {
                WinNative.ShowWindow(window.handle, ShowWindowCommands.Restore);
            }

            //WinNative.SetForegroundWindow(window.handle);

            dpWindow.SetTargetCapture(window);


            dpWindow.dpAppParent.iconTex = window.iconTexture;


            overlays.Add(dpWindow);

            TheBarManager.I.AddLoadedApp(dpWindow.dpAppParent);

            //OverlayInteractionManager.I.StartPreviewDrag(key);
            //TheBarManager.I.LaunchAppToMainSnap(key);

            Debug.Log(dpWindow.overlay.handle + " : " + dpWindow.overlay.overlayKey + " : " + dpWindow.window.handle);

            return(dpWindow);
        }
Пример #3
0
        private void OnInteractedWith(bool interacting)
        {
            if (!loaded)
            {
                return;
            }

            //Debug.Log("Interaction state: " + interacting);

            isInteractingVirtually = interacting;

            if (interacting && isTargetingWindow)
            {
                if (isTargetingWindow && window.isIconic)
                {
                    WinNative.ShowWindow(window.handle, ShowWindowCommands.Restore);
                }

                WinNative.SetForegroundWindow(window.handle);

                if (primaryWindowDP != this)
                {
                    //Clear the previous
                    if (primaryWindowDP != null)
                    {
                        primaryWindowDP.isPrimary = false;

                        //if (primaryWindowDP.isTargetingWindow) {

                        //}

                        primaryWindowDP.RequestRendering();
                        //primaryWindowDP.UpdateOverlayUVs();
                    }

                    //StartCoroutine(C_Lock());

                    primaryWindowDP = this;
                    isPrimary       = true;

                    UDDManager.instance.gameObject.SetActive(false);
                    UDDManager.instance.gameObject.SetActive(true);

                    //UpdateOverlayUVs();
                }
            }

            //Update the title
            if (interacting)
            {
                if (!isTargetingWindow)
                {
                    dpAppParent.title = monitor.name;
                }
                else
                {
                    dpAppParent.title = window.title;
                }
            }

            //This only runs when the bar is closed and the config option is enabled
            if (DPSettings.config.focusGameWhenNotInteracting && !interacting)
            {
                GamingManager.FocusActiveGame();
            }
        }