コード例 #1
0
        internal static EditorWindow TryFocusAppropriateWindow(bool enteringPlaymode)
        {
            EditorWindow result;

            if (enteringPlaymode)
            {
                GameView gameView = (GameView)WindowLayout.FindEditorWindowOfType(typeof(GameView));
                if (gameView)
                {
                    WindowLayout.SaveCurrentFocusedWindowInSameDock(gameView);
                    gameView.Focus();
                }
                result = gameView;
            }
            else
            {
                EditorWindow editorWindow = WindowLayout.TryGetLastFocusedWindowInSameDock();
                if (editorWindow)
                {
                    editorWindow.ShowTab();
                }
                result = editorWindow;
            }
            return(result);
        }
コード例 #2
0
        static internal EditorWindow TryFocusAppropriateWindow(bool enteringPlaymode)
        {
            if (enteringPlaymode)
            {
                GameView gameView = (GameView)FindEditorWindowOfType(typeof(GameView));
                if (gameView)
                {
                    SaveCurrentFocusedWindowInSameDock(gameView);
                    gameView.Focus();
                }

                return(gameView);
            }
            else
            {
                // If we can retrieve what window type was active when we went into play mode,
                // go back to focus a window of that type.
                EditorWindow window = TryGetLastFocusedWindowInSameDock();
                if (window)
                {
                    window.ShowTab();
                }
                return(window);
            }
        }
コード例 #3
0
        internal static EditorWindow ShowAppropriateViewOnEnterExitPlaymode(bool entering)
        {
            if (WindowFocusState.instance.m_CurrentlyInPlayMode == entering)
            {
                return((EditorWindow)null);
            }
            WindowFocusState.instance.m_CurrentlyInPlayMode = entering;
            EditorWindow maximizedWindow = WindowLayout.GetMaximizedWindow();

            if (entering)
            {
                WindowFocusState.instance.m_WasMaximizedBeforePlay = (UnityEngine.Object)maximizedWindow != (UnityEngine.Object)null;
                if ((UnityEngine.Object)maximizedWindow != (UnityEngine.Object)null)
                {
                    return(maximizedWindow);
                }
            }
            else if (WindowFocusState.instance.m_WasMaximizedBeforePlay)
            {
                return(maximizedWindow);
            }
            if ((bool)((UnityEngine.Object)maximizedWindow))
            {
                WindowLayout.Unmaximize(maximizedWindow);
            }
            EditorWindow editorWindow = WindowLayout.TryFocusAppropriateWindow(entering);

            if ((bool)((UnityEngine.Object)editorWindow) || !entering)
            {
                return(editorWindow);
            }
            EditorWindow editorWindowOfType = WindowLayout.FindEditorWindowOfType(typeof(SceneView));

            if ((bool)((UnityEngine.Object)editorWindowOfType) && editorWindowOfType.m_Parent is DockArea)
            {
                DockArea parent = editorWindowOfType.m_Parent as DockArea;
                if ((bool)((UnityEngine.Object)parent))
                {
                    WindowFocusState.instance.m_LastWindowTypeInSameDock = editorWindowOfType.GetType().ToString();
                    GameView instance = ScriptableObject.CreateInstance <GameView>();
                    parent.AddTab((EditorWindow)instance);
                    return((EditorWindow)instance);
                }
            }
            GameView instance1 = ScriptableObject.CreateInstance <GameView>();

            instance1.Show(true);
            instance1.Focus();
            return((EditorWindow)instance1);
        }
コード例 #4
0
 internal static EditorWindow TryFocusAppropriateWindow(bool enteringPlaymode)
 {
     if (enteringPlaymode)
     {
         GameView windowToBeFocused = (GameView) FindEditorWindowOfType(typeof(GameView));
         if (windowToBeFocused != null)
         {
             SaveCurrentFocusedWindowInSameDock(windowToBeFocused);
             windowToBeFocused.Focus();
         }
         return windowToBeFocused;
     }
     EditorWindow window2 = TryGetLastFocusedWindowInSameDock();
     if (window2 != null)
     {
         window2.ShowTab();
     }
     return window2;
 }
コード例 #5
0
        internal static EditorWindow TryFocusAppropriateWindow(bool enteringPlaymode)
        {
            if (enteringPlaymode)
            {
                GameView editorWindowOfType = (GameView)WindowLayout.FindEditorWindowOfType(typeof(GameView));
                if ((bool)((UnityEngine.Object)editorWindowOfType))
                {
                    WindowLayout.SaveCurrentFocusedWindowInSameDock((EditorWindow)editorWindowOfType);
                    editorWindowOfType.Focus();
                }
                return((EditorWindow)editorWindowOfType);
            }
            EditorWindow windowInSameDock = WindowLayout.TryGetLastFocusedWindowInSameDock();

            if ((bool)((UnityEngine.Object)windowInSameDock))
            {
                windowInSameDock.ShowTab();
            }
            return(windowInSameDock);
        }
コード例 #6
0
        private void BuiltinCustomSplashScreenGUI()
        {
            EditorGUILayout.LabelField(PlayerSettingsSplashScreenEditor.k_Texts.splashTitle, EditorStyles.boldLabel, new GUILayoutOption[0]);
            using (new EditorGUI.DisabledScope(!PlayerSettingsSplashScreenEditor.licenseAllowsDisabling))
            {
                EditorGUILayout.PropertyField(this.m_ShowUnitySplashScreen, PlayerSettingsSplashScreenEditor.k_Texts.showSplash, new GUILayoutOption[0]);
                if (!this.m_ShowUnitySplashScreen.boolValue)
                {
                    return;
                }
            }
            Rect rect = GUILayoutUtility.GetRect(PlayerSettingsSplashScreenEditor.k_Texts.previewSplash, "button");

            rect = EditorGUI.PrefixLabel(rect, new GUIContent(" "));
            if (GUI.Button(rect, PlayerSettingsSplashScreenEditor.k_Texts.previewSplash))
            {
                SplashScreen.Begin();
                GameView mainGameView = GameView.GetMainGameView();
                if (mainGameView)
                {
                    mainGameView.Focus();
                }
                GameView.RepaintAll();
            }
            EditorGUILayout.PropertyField(this.m_SplashScreenLogoStyle, PlayerSettingsSplashScreenEditor.k_Texts.splashStyle, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_SplashScreenAnimation, PlayerSettingsSplashScreenEditor.k_Texts.animate, new GUILayoutOption[0]);
            this.m_ShowAnimationControlsAnimator.target = (this.m_SplashScreenAnimation.intValue == 2);
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowAnimationControlsAnimator.faded))
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.Slider(this.m_SplashScreenLogoAnimationZoom, 0f, 1f, PlayerSettingsSplashScreenEditor.k_Texts.logoZoom, new GUILayoutOption[0]);
                EditorGUILayout.Slider(this.m_SplashScreenBackgroundAnimationZoom, 0f, 1f, PlayerSettingsSplashScreenEditor.k_Texts.backgroundZoom, new GUILayoutOption[0]);
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.EndFadeGroup();
            EditorGUILayout.Space();
            EditorGUILayout.LabelField(PlayerSettingsSplashScreenEditor.k_Texts.logosTitle, EditorStyles.boldLabel, new GUILayoutOption[0]);
            using (new EditorGUI.DisabledScope(!Application.HasProLicense()))
            {
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(this.m_ShowUnitySplashLogo, PlayerSettingsSplashScreenEditor.k_Texts.showLogo, new GUILayoutOption[0]);
                if (EditorGUI.EndChangeCheck())
                {
                    if (!this.m_ShowUnitySplashLogo.boolValue)
                    {
                        this.RemoveUnityLogoFromLogosList();
                    }
                    else if (this.m_SplashScreenDrawMode.intValue == 1)
                    {
                        this.AddUnityLogoToLogosList();
                    }
                }
                this.m_ShowLogoControlsAnimator.target = this.m_ShowUnitySplashLogo.boolValue;
            }
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowLogoControlsAnimator.faded))
            {
                EditorGUI.indentLevel++;
                EditorGUI.BeginChangeCheck();
                int intValue = this.m_SplashScreenDrawMode.intValue;
                EditorGUILayout.PropertyField(this.m_SplashScreenDrawMode, PlayerSettingsSplashScreenEditor.k_Texts.drawMode, new GUILayoutOption[0]);
                if (intValue != this.m_SplashScreenDrawMode.intValue)
                {
                    if (this.m_SplashScreenDrawMode.intValue == 0)
                    {
                        this.RemoveUnityLogoFromLogosList();
                    }
                    else
                    {
                        this.AddUnityLogoToLogosList();
                    }
                }
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.EndFadeGroup();
            this.m_LogoList.DoLayoutList();
            EditorGUILayout.Space();
            EditorGUILayout.LabelField(PlayerSettingsSplashScreenEditor.k_Texts.backgroundTitle, EditorStyles.boldLabel, new GUILayoutOption[0]);
            EditorGUILayout.Slider(this.m_SplashScreenOverlayOpacity, (!Application.HasProLicense()) ? PlayerSettingsSplashScreenEditor.k_MinPersonalEditionOverlayOpacity : PlayerSettingsSplashScreenEditor.k_MinProEditionOverlayOpacity, 1f, PlayerSettingsSplashScreenEditor.k_Texts.overlayOpacity, new GUILayoutOption[0]);
            this.m_ShowBackgroundColorAnimator.target = (this.m_SplashScreenBackgroundLandscape.objectReferenceValue == null);
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowBackgroundColorAnimator.faded))
            {
                EditorGUILayout.PropertyField(this.m_SplashScreenBackgroundColor, PlayerSettingsSplashScreenEditor.k_Texts.backgroundColor, new GUILayoutOption[0]);
            }
            EditorGUILayout.EndFadeGroup();
            PlayerSettingsSplashScreenEditor.ObjectReferencePropertyField <Sprite>(this.m_SplashScreenBackgroundLandscape, PlayerSettingsSplashScreenEditor.k_Texts.backgroundImage);
            if (GUI.changed && this.m_SplashScreenBackgroundLandscape.objectReferenceValue == null)
            {
                this.m_SplashScreenBackgroundPortrait.objectReferenceValue = null;
            }
            using (new EditorGUI.DisabledScope(this.m_SplashScreenBackgroundLandscape.objectReferenceValue == null))
            {
                PlayerSettingsSplashScreenEditor.ObjectReferencePropertyField <Sprite>(this.m_SplashScreenBackgroundPortrait, PlayerSettingsSplashScreenEditor.k_Texts.backgroundPortraitImage);
            }
        }