private static void OpenPreferences() { #if UNITY_2018_3_OR_NEWER var windowType = ReflectionUtility.FindClass("UnityEditor.SettingsWindow"); windowType.InvokeMethod("Show", SettingsScope.User, "Preferences/Fullscreen Editor"); #else var windowType = ReflectionUtility.FindClass("UnityEditor.PreferencesWindow"); windowType.InvokeMethod("ShowPreferencesWindow"); After.Frames(3, () => { var window = EditorWindow.GetWindow(windowType); var sections = window.GetFieldValue <IList>("m_Sections").Cast <object>().ToList(); var index = sections.FindIndex(section => section.GetFieldValue <GUIContent>("content").text == "Fullscreen"); window.SetPropertyValue("selectedSectionIndex", index); }); #endif }
/// <summary>Method that will be called after the creation of the ContainerWindow for this fullscreen.</summary> protected virtual void AfterOpening() { After.Frames(2, () => UnityEditorInternal.InternalEditorUtility.RepaintAllViews()); Logger.Debug(this, "{6}\n\nSRC\nWindow: {0}\nView: {1}\nContainer: {2}\n\nDST\nWindow: {3}\nView: {4}\nContainer: {5}\n", m_src.Window, m_src.View, m_src.Container, m_dst.Window, m_dst.View, m_dst.Container, name ); FullscreenCallbacks.afterFullscreenOpen(this); }
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); }); }
static GlobalToolbarHiding() { defaultToolbarHeight = FullscreenUtility.GetToolbarHeight(); FullscreenPreferences.UseGlobalToolbarHiding.OnValueSaved += v => { if (!v) { FullscreenUtility.SetToolbarHeight(defaultToolbarHeight); } }; FullscreenPreferences.ToolbarVisible.OnValueSaved += v => UpdateGlobalToolbarStatus(); UpdateGlobalToolbarStatus(); After.Frames(2, () => // Why? IDK UpdateGlobalToolbarStatus() ); FullscreenCallbacks.afterFullscreenClose += fs => UpdateGlobalToolbarStatus(); FullscreenCallbacks.afterFullscreenOpen += fs => UpdateGlobalToolbarStatus(); }
protected virtual void OnEnable() { if (m_ourIndex == -1) { m_ourIndex = CurrentIndex++; name = string.Format("Fullscreen #{0}", m_ourIndex); hideFlags = HideFlags.HideAndDontSave; } #if UNITY_2018_1_OR_NEWER EditorApplication.wantsToQuit += WantsToQuit; #endif if (m_old && !m_dst.Container) { Logger.Warning("{0} wasn't properly closed", name); // After 1 frame to prevent OnDisable and OnDestroy from being called before this methods returns After.Frames(1, () => DestroyImmediate(this, true)); } m_old = true; }