private static void CloseAll() { foreach (var fs in Fullscreen.GetAllFullscreen()) { fs.Close(); } }
/// <summary>Returns the parent <see cref="FullscreenContainer"/> for a given view or window, or null if it's not in fullscreen.</summary> /// <param name="rootView">Compare by the root view, otherwise compare by the container.</param> public static FullscreenContainer GetFullscreenFromView(ScriptableObject viewOrWindow, bool rootView = true) { if (!viewOrWindow) { return(null); } var pyramid = new ViewPyramid(viewOrWindow); return(Fullscreen .GetAllFullscreen() .FirstOrDefault(fullscreen => rootView ? fullscreen.ActualViewPyramid.View == pyramid.View : fullscreen.ActualViewPyramid.Container == pyramid.Container )); }
private static void SetIsPlaying(bool playing) { var fullscreens = Fullscreen.GetAllFullscreen() .Select(fullscreen => fullscreen as FullscreenWindow) .Where(fullscreen => fullscreen); // We close all the game views created on play, even if the option was disabled in the middle of the play mode // This is done to best reproduce the default behaviour of the maximize on play if (!playing) { foreach (var fs in fullscreens) { if (fs && fs.CreatedByFullscreenOnPlay) // fs might have been destroyed { fs.Close(); } } return; } if (!FullscreenPreferences.FullscreenOnPlayEnabled) { return; // Nothing to do here } var gameView = FullscreenUtility .GetGameViews() .FirstOrDefault(gv => gv && gv.GetPropertyValue <bool>("maximizeOnPlay")); if (!gameView && FullscreenUtility.GetGameViews().Length > 0) { return; } foreach (var fs in fullscreens) { if (fs && fs.Rect.Overlaps(gameView.position)) // fs might have been destroyed { return; // We have an open fullscreen where the new one would be, so let it there } } if (gameView && Fullscreen.GetFullscreenFromView(gameView)) { return; // The gameview is already in fullscreen } var gvfs = Fullscreen.MakeFullscreen(Types.GameView, gameView); gvfs.CreatedByFullscreenOnPlay = true; }
protected override void AfterOpening() { base.AfterOpening(); Focus(); if (m_src.Window) { m_dst.Window.titleContent = m_src.Window.titleContent; // Copy the title of the window to the placeholder } SetToolbarStatus(FullscreenPreferences.ToolbarVisible); // Hide/show the toolbar // macOS doesn't like fast things, so we'll wait a bit and do it again // Looks like Linux does not like it too After.Milliseconds(100d, () => SetToolbarStatus(FullscreenPreferences.ToolbarVisible)); var notificationWindow = ActualViewPyramid.Window; After.Milliseconds(50d, () => { if (!notificationWindow) // Might have been closed { return; } var menuItemPath = string.Empty; if (notificationWindow.IsOfType(Types.GameView)) { menuItemPath = Fullscreen .GetAllFullscreen() .Where(fs => fs.ActualViewPyramid.Window && fs.ActualViewPyramid.Window.IsOfType(Types.GameView)) .Count() > 1 ? Shortcut.MOSAIC_PATH : Shortcut.GAME_VIEW_PATH; } else if (notificationWindow is SceneView) { menuItemPath = Shortcut.SCENE_VIEW_PATH; } else { menuItemPath = Shortcut.CURRENT_VIEW_PATH; } FullscreenUtility.ShowFullscreenExitNotification(notificationWindow, menuItemPath); }); }
public static void BringWindowsAbove() { if (!FullscreenPreferences.KeepFullscreenBelow) { return; } var fullscreens = Fullscreen.GetAllFullscreen(); if (fullscreens.Length == 0) { return; } var methodName = "Internal_BringLiveAfterCreation"; var windows = GetAllContainerWindowsOrdered() .Where(w => !Fullscreen.GetFullscreenFromView(w)) .Where(w => { if (w.GetPropertyValue <int>("showMode") == (int)ShowMode.MainWindow) { return(false); // Main Window should be kept below everything } if (fullscreens.FirstOrDefault((f) => f.m_src.Container == w)) { return(false); // Keep other fullscreen containers below } return(true); }); foreach (var w in windows) { if (w.HasMethod(methodName, new Type[] { typeof(bool), typeof(bool), typeof(bool) })) { w.InvokeMethod(methodName, true, false, false); } else { w.InvokeMethod(methodName, true, false); } } }
private static void Init() { // Initial RenderingDisabled = Fullscreen.GetAllFullscreen().Length > 0; // On preferences change FullscreenPreferences.DisableSceneViewRendering.OnValueSaved += (v) => RenderingDisabled = v && Fullscreen.GetAllFullscreen().Length > 0; // On fullscreen open FullscreenCallbacks.afterFullscreenOpen += (f) => RenderingDisabled = true; // Disable the patching if we're the last fullscreen open FullscreenCallbacks.afterFullscreenClose += (f) => { if (Fullscreen.GetAllFullscreen().Length <= 1) { RenderingDisabled = false; } }; }
private static void MosaicMenuItem() { var openFullscreens = Fullscreen.GetAllFullscreen(); if (openFullscreens.Length > 0) { foreach (var fs in openFullscreens) { fs.Close(); } return; } var displays = DisplayInfo .GetDisplays() .Where(d => (d.displayDevice.StateFlags & DisplayDeviceStateFlags.AttachedToDesktop) != 0) .ToList(); for (var i = 0; i < displays.Count && i < 8; i++) { var candidate = FindCandidateForFullscreen(Types.GameView, FullscreenUtility.GetMainGameView()); if (candidate) { candidate = EditorWindow.Instantiate(candidate); candidate.Show(); } var fs = Fullscreen.MakeFullscreen(Types.GameView, candidate, true); var gameView = fs.ActualViewPyramid.Window; var targetDisplay = FullscreenPreferences.MosaicMapping.Value[i]; fs.Rect = displays[i].DpiCorrectedArea; FullscreenUtility.SetGameViewDisplayTarget(gameView, targetDisplay); } }
private static bool CloseAllValidate() { return(Fullscreen.GetAllFullscreen().Length > 0); }