private DPOverlayBase ShowNotFoundError(DPAppSerialized state, bool isTargetingWindow) { NotFoundErrorApp error = Instantiate(notFoundError); if (isTargetingWindow) { error.Init(state, state.partialWindowTitle, state.exePath); } else { error.Init(state, state.displayName, ""); } return(error.dpMain); }
/// <summary> /// Handles if a manually spawned DPApp should actually be visible or not /// </summary> /// <param name="state"></param> /// <param name="dpBase"></param> public static void SyncNewDPAppVisibility(DPAppSerialized state, DPOverlayBase dpBase, bool forceVisible = false) { //Show if (forceVisible || !state.isMinimized && (TheBarManager.isOpened || (!TheBarManager.isOpened && state.isPinned))) { TheBarManager.I.ToggleDPApp(dpBase.dpAppParent, true, true); dpBase.dpAppParent.OnTheBarToggled(true); dpBase.dpAppParent.OnOpen(); } //Hide else { TheBarManager.I.ToggleDPApp(dpBase.dpAppParent, false, true); dpBase.dpAppParent.OnTheBarToggled(false); //dpBase.dpAppParent.OnMinimize(); } }
/// <summary> /// Gets the current state of a DPApp and puts it in a serializable form /// </summary> /// <param name="dpApp">The DPApp to get the state of</param> /// <returns></returns> public static DPAppSerialized GetState(DPApp dpApp) { var dpBase = dpApp.dpMain; DPAppSerialized state = new DPAppSerialized() { isVisible = dpApp.isVisible, isMinimized = dpApp.isMinimized, pos = dpBase.transform.localPosition, rot = dpBase.transform.localEulerAngles, width = dpBase.overlay.width, curvature = dpBase.overlay.curvature, trackedDevice = dpBase.overlay.trackedDevice, smoothAnchoringTrackedDevice = dpBase.smoothAnchoringTrackedDevice, snapAnchoringTrackedDevice = dpBase.snapAnchoringTrackedDevice, isAnchoredToTheBar = dpBase.isAnchoredToTheBar, useSmoothAnchoring = dpBase.useSmoothAnchoring, smoothAnchoringStrength = dpBase.smoothAnchoringStrength, useSnapAnchoring = dpBase.useSnapAnchoring, snapAnchoringDistance = dpBase.snapAnchoringDistance, isPinned = dpBase.isPinned, captureFPS = dpBase.fpsToCaptureAt, forceCaptureRate = dpBase.forceHighCaptureFramerate, opacity = dpBase.overlay.targetOpacity, useLookHiding = dpBase.useLookHiding, lookHidingStrength = dpBase.lookHidingStrength, lookHidingHideOpacity = dpBase.lookHidingOpacity, useDistanceHiding = dpBase.useDistanceHiding, distanceHidingDistance = dpBase.distanceHidingDistance, distanceHidingOpacity = dpBase.distanceHidingOpacity, useWindowCropping = dpBase.useWindowCropping, cropAmount = dpBase.cropAmount, useSBS = dpBase.overlay.useSBS, sbsCrossedMode = dpBase.overlay.sbsCrossedMode, useTouchInput = dpBase.useTouchInput, alwaysInteract = dpBase.alwaysInteract, alwaysInteractBlockInput = dpBase.alwaysInteractBlockInput, disableInteraction = dpBase.isInteractable, disableDragging = dpBase.isDraggable }; //If it's smooth/snap anchored, get the position of the target object instead if (state.useSmoothAnchoring) { state.pos = dpApp.dpMain.smoothAnchoringDummyObject.transform.localPosition; state.rot = dpApp.dpMain.smoothAnchoringDummyObject.transform.localEulerAngles; } else if (state.useSnapAnchoring) { state.pos = dpApp.dpMain.snapAnchoringDummyObject.transform.localPosition; state.rot = dpApp.dpMain.snapAnchoringDummyObject.transform.localEulerAngles; } //Special code if it's a desktop capture if (dpApp.isCapture && dpBase is DPDesktopOverlay desktopDP) { state.isCapture = true; if (desktopDP.isTargetingWindow) { //If the title is long enough, store the last characters if (desktopDP.window.title.Length > I.partialWindowTitleCharacters) { state.partialWindowTitle = desktopDP.window.title.Substring(desktopDP.window.title.Length - I.partialWindowTitleCharacters); } else { state.partialWindowTitle = desktopDP.window.title; } state.exePath = WinNative.GetFilePath(desktopDP.window.handle); } else { //Store the name of the display state.displayName = desktopDP.monitor.name; } } else { state.isCapture = false; } return(state); }
public static void ApplyState(DPOverlayBase dpBase, DPAppSerialized state) { dpBase.overlay.SetWidthInMeters(state.width); dpBase.overlay.SetCurvature(state.curvature); dpBase.useSmoothAnchoring = state.useSmoothAnchoring; dpBase.smoothAnchoringStrength = state.smoothAnchoringStrength; dpBase.useSnapAnchoring = state.useSnapAnchoring; dpBase.snapAnchoringDistance = state.snapAnchoringDistance; dpBase.SetOverlayTransform(state.pos, state.rot); if (state.isAnchoredToTheBar) { TheBarManager.AddAnchoredDP(dpBase); //Apply the position in case the bar hasn't been opened //if (!TheBarManager.hasBeenOpened) dpBase.SetOverlayTransform(state., state.theBarWorldRot, true, true, false); dpBase.SetOverlayTransform(state.pos, state.rot); } else if (state.useSmoothAnchoring) { dpBase.SetOverlayTrackedDevice(state.smoothAnchoringTrackedDevice); } else if (state.useSnapAnchoring) { dpBase.SetOverlayTrackedDevice(state.snapAnchoringTrackedDevice); } else { dpBase.SetOverlayTrackedDevice(state.trackedDevice); } dpBase.isPinned = state.isPinned; dpBase.fpsToCaptureAt = state.captureFPS; dpBase.forceHighCaptureFramerate = state.forceCaptureRate; dpBase.SetOverlayOpacity(state.opacity); dpBase.useLookHiding = state.useLookHiding; dpBase.lookHidingStrength = state.lookHidingStrength; dpBase.lookHidingOpacity = state.lookHidingHideOpacity; dpBase.useDistanceHiding = state.useDistanceHiding; dpBase.distanceHidingDistance = state.distanceHidingDistance; dpBase.distanceHidingOpacity = state.distanceHidingOpacity; dpBase.useWindowCropping = state.useWindowCropping; dpBase.cropAmount = state.cropAmount; dpBase.overlay.SetSBS(state.useSBS, state.sbsCrossedMode); dpBase.useTouchInput = state.useTouchInput; dpBase.alwaysInteract = state.alwaysInteract; dpBase.alwaysInteractBlockInput = state.alwaysInteractBlockInput; dpBase.isInteractable = state.disableInteraction; dpBase.isDraggable = state.disableDragging; dpBase.dpAppParent.isMinimized = state.isMinimized; }