Ejemplo n.º 1
0
        private void DoToolbarGUI()
        {
            ScriptableSingleton <GameViewSizes> .instance.RefreshStandaloneAndWebplayerDefaultSizes();

            if (ScriptableSingleton <GameViewSizes> .instance.GetChangeID() != this.m_SizeChangeID)
            {
                this.EnsureSelectedSizeAreValid();
                this.m_SizeChangeID = ScriptableSingleton <GameViewSizes> .instance.GetChangeID();
            }
            GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
            if (Display.MultiDisplayLicense())
            {
                this.m_TargetDisplay = EditorGUILayout.Popup(this.m_TargetDisplay, GameView.s_GameDisplays, EditorStyles.toolbarPopup, new GUILayoutOption[]
                {
                    GUILayout.Width(80f)
                });
            }
            EditorGUILayout.GameViewSizePopup(GameView.currentSizeGroupType, this.selectedSizeIndex, new Action <int, object>(this.SelectionCallback), EditorStyles.toolbarDropDown, new GUILayoutOption[]
            {
                GUILayout.Width(160f)
            });
            if (FrameDebuggerUtility.enabled)
            {
                GUILayout.FlexibleSpace();
                Color color = GUI.color;
                GUI.color *= AnimationMode.animatedPropertyColor;
                GUILayout.Label("Frame Debugger on", EditorStyles.miniLabel, new GUILayoutOption[0]);
                GUI.color = color;
                if (Event.current.type == EventType.Repaint)
                {
                    FrameDebuggerWindow.RepaintAll();
                }
            }
            GUILayout.FlexibleSpace();
            this.m_MaximizeOnPlay         = GUILayout.Toggle(this.m_MaximizeOnPlay, "Maximize on Play", EditorStyles.toolbarButton, new GUILayoutOption[0]);
            EditorUtility.audioMasterMute = GUILayout.Toggle(EditorUtility.audioMasterMute, "Mute audio", EditorStyles.toolbarButton, new GUILayoutOption[0]);
            this.m_Stats = GUILayout.Toggle(this.m_Stats, "Stats", EditorStyles.toolbarButton, new GUILayoutOption[0]);
            Rect rect     = GUILayoutUtility.GetRect(this.gizmosContent, GameView.s_GizmoButtonStyle);
            Rect position = new Rect(rect.xMax - (float)GameView.s_GizmoButtonStyle.border.right, rect.y, (float)GameView.s_GizmoButtonStyle.border.right, rect.height);

            if (EditorGUI.ButtonMouseDown(position, GUIContent.none, FocusType.Passive, GUIStyle.none))
            {
                Rect last = GUILayoutUtility.topLevel.GetLast();
                if (AnnotationWindow.ShowAtPosition(last, true))
                {
                    GUIUtility.ExitGUI();
                }
            }
            this.m_Gizmos = GUI.Toggle(rect, this.m_Gizmos, this.gizmosContent, GameView.s_GizmoButtonStyle);
            GUILayout.EndHorizontal();
        }
Ejemplo n.º 2
0
        private void DoToolbarGUI()
        {
            GameViewSizes.instance.RefreshStandaloneAndRemoteDefaultSizes();

            GUILayout.BeginHorizontal(EditorStyles.toolbar);
            {
                var availableTypes = GetAvailableWindowTypes();
                if (availableTypes.Count > 1)
                {
                    var typeNames = availableTypes.Values.ToList();
                    var types     = availableTypes.Keys.ToList();
                    int viewIndex = EditorGUILayout.Popup(typeNames.IndexOf(titleContent.text), typeNames.ToArray(),
                                                          EditorStyles.toolbarPopup,
                                                          GUILayout.Width(90));
                    EditorGUILayout.Space();
                    if (types[viewIndex] != typeof(GameView))
                    {
                        SwapMainWindow(types[viewIndex]);
                    }
                }

                if (ModuleManager.ShouldShowMultiDisplayOption())
                {
                    int display = EditorGUILayout.Popup(targetDisplay, DisplayUtility.GetDisplayNames(), EditorStyles.toolbarPopupLeft, GUILayout.Width(80));
                    if (display != targetDisplay)
                    {
                        targetDisplay = display;
                        UpdateZoomAreaAndParent();
                    }
                }
                EditorGUILayout.GameViewSizePopup(currentSizeGroupType, selectedSizeIndex, this, EditorStyles.toolbarPopup, GUILayout.Width(160f));

                DoZoomSlider();
                // If the previous platform and current does not match, update the scale
                if ((int)currentSizeGroupType != prevSizeGroupType)
                {
                    UpdateZoomAreaAndParent();
                    // Update the platform to the recent one
                    prevSizeGroupType = (int)currentSizeGroupType;
                }

                if (FrameDebuggerUtility.IsLocalEnabled())
                {
                    GUILayout.FlexibleSpace();
                    Color oldCol = GUI.color;
                    // This has nothing to do with animation recording.  Can we replace this color with something else?
                    GUI.color *= AnimationMode.recordedPropertyColor;
                    GUILayout.Label(Styles.frameDebuggerOnContent, EditorStyles.toolbarLabel);
                    GUI.color = oldCol;
                    // Make frame debugger windows repaint after each time game view repaints.
                    // We want them to always display the latest & greatest game view
                    // rendering state.
                    if (Event.current.type == EventType.Repaint)
                    {
                        FrameDebuggerWindow.RepaintAll();
                    }
                }

                GUILayout.FlexibleSpace();

                if (RenderDoc.IsLoaded())
                {
                    using (new EditorGUI.DisabledScope(!RenderDoc.IsSupported()))
                    {
                        if (GUILayout.Button(Styles.renderdocContent, EditorStyles.toolbarButton))
                        {
                            m_Parent.CaptureRenderDocScene();
                            GUIUtility.ExitGUI();
                        }
                    }
                }

                // Allow the user to select how the XR device will be rendered during "Play In Editor"
                if (PlayerSettings.virtualRealitySupported)
                {
                    int selectedRenderMode = EditorGUILayout.Popup(m_XRRenderMode, Styles.xrRenderingModes, EditorStyles.toolbarPopup, GUILayout.Width(80));
                    SetXRRenderMode(selectedRenderMode);
                }

                maximizeOnPlay = GUILayout.Toggle(maximizeOnPlay, Styles.maximizeOnPlayContent, EditorStyles.toolbarButton);

                EditorUtility.audioMasterMute = GUILayout.Toggle(EditorUtility.audioMasterMute, Styles.muteContent, EditorStyles.toolbarButton);

                m_Stats = GUILayout.Toggle(m_Stats, Styles.statsContent, EditorStyles.toolbarButton);

                if (EditorGUILayout.DropDownToggle(ref m_Gizmos, Styles.gizmosContent, EditorStyles.toolbarDropDownToggleRight))
                {
                    Rect rect = GUILayoutUtility.topLevel.GetLast();
                    if (AnnotationWindow.ShowAtPosition(rect, true))
                    {
                        GUIUtility.ExitGUI();
                    }
                }
            }
            GUILayout.EndHorizontal();
        }
Ejemplo n.º 3
0
        private void DoToolbarGUI()
        {
            ScriptableSingleton <GameViewSizes> .instance.RefreshStandaloneAndRemoteDefaultSizes();

            GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
            if (ModuleManager.ShouldShowMultiDisplayOption())
            {
                int num = EditorGUILayout.Popup(this.m_TargetDisplay, DisplayUtility.GetDisplayNames(), EditorStyles.toolbarPopup, new GUILayoutOption[]
                {
                    GUILayout.Width(80f)
                });
                EditorGUILayout.Space();
                if (num != this.m_TargetDisplay)
                {
                    this.m_TargetDisplay = num;
                    this.UpdateZoomAreaAndParent();
                }
            }
            EditorGUILayout.GameViewSizePopup(GameView.currentSizeGroupType, this.selectedSizeIndex, this, EditorStyles.toolbarPopup, new GUILayoutOption[]
            {
                GUILayout.Width(160f)
            });
            this.DoZoomSlider();
            if (FrameDebuggerUtility.IsLocalEnabled())
            {
                GUILayout.FlexibleSpace();
                Color color = GUI.color;
                GUI.color *= AnimationMode.recordedPropertyColor;
                GUILayout.Label(GameView.Styles.frameDebuggerOnContent, EditorStyles.miniLabel, new GUILayoutOption[0]);
                GUI.color = color;
                if (Event.current.type == EventType.Repaint)
                {
                    FrameDebuggerWindow.RepaintAll();
                }
            }
            GUILayout.FlexibleSpace();
            if (RenderDoc.IsLoaded())
            {
                using (new EditorGUI.DisabledScope(!RenderDoc.IsSupported()))
                {
                    if (GUILayout.Button(GameView.Styles.renderdocContent, EditorStyles.toolbarButton, new GUILayoutOption[0]))
                    {
                        this.m_Parent.CaptureRenderDoc();
                        GUIUtility.ExitGUI();
                    }
                }
            }
            this.m_MaximizeOnPlay         = GUILayout.Toggle(this.m_MaximizeOnPlay, GameView.Styles.maximizeOnPlayContent, EditorStyles.toolbarButton, new GUILayoutOption[0]);
            EditorUtility.audioMasterMute = GUILayout.Toggle(EditorUtility.audioMasterMute, GameView.Styles.muteContent, EditorStyles.toolbarButton, new GUILayoutOption[0]);
            this.m_Stats = GUILayout.Toggle(this.m_Stats, GameView.Styles.statsContent, EditorStyles.toolbarButton, new GUILayoutOption[0]);
            Rect rect     = GUILayoutUtility.GetRect(GameView.Styles.gizmosContent, GameView.Styles.gizmoButtonStyle);
            Rect position = new Rect(rect.xMax - (float)GameView.Styles.gizmoButtonStyle.border.right, rect.y, (float)GameView.Styles.gizmoButtonStyle.border.right, rect.height);

            if (EditorGUI.DropdownButton(position, GUIContent.none, FocusType.Passive, GUIStyle.none))
            {
                Rect last = GUILayoutUtility.topLevel.GetLast();
                if (AnnotationWindow.ShowAtPosition(last, true))
                {
                    GUIUtility.ExitGUI();
                }
            }
            this.m_Gizmos = GUI.Toggle(rect, this.m_Gizmos, GameView.Styles.gizmosContent, GameView.Styles.gizmoButtonStyle);
            GUILayout.EndHorizontal();
        }
Ejemplo n.º 4
0
        private void DoToolbarGUI()
        {
            GameViewSizes.instance.RefreshStandaloneAndRemoteDefaultSizes();

            GUILayout.BeginHorizontal(EditorStyles.toolbar);
            {
                if (ModuleManager.ShouldShowMultiDisplayOption())
                {
                    int display = EditorGUILayout.Popup(m_TargetDisplay, DisplayUtility.GetDisplayNames(), EditorStyles.toolbarPopup, GUILayout.Width(80));
                    EditorGUILayout.Space();
                    if (display != m_TargetDisplay)
                    {
                        m_TargetDisplay = display;
                        UpdateZoomAreaAndParent();
                    }
                }
                EditorGUILayout.GameViewSizePopup(currentSizeGroupType, selectedSizeIndex, this, EditorStyles.toolbarPopup, GUILayout.Width(160f));

                DoZoomSlider();

                if (FrameDebuggerUtility.IsLocalEnabled())
                {
                    GUILayout.FlexibleSpace();
                    Color oldCol = GUI.color;
                    // This has nothing to do with animation recording.  Can we replace this color with something else?
                    GUI.color *= AnimationMode.recordedPropertyColor;
                    GUILayout.Label(Styles.frameDebuggerOnContent, EditorStyles.miniLabel);
                    GUI.color = oldCol;
                    // Make frame debugger windows repaint after each time game view repaints.
                    // We want them to always display the latest & greatest game view
                    // rendering state.
                    if (Event.current.type == EventType.Repaint)
                    {
                        FrameDebuggerWindow.RepaintAll();
                    }
                }

                GUILayout.FlexibleSpace();

                if (RenderDoc.IsLoaded())
                {
                    using (new EditorGUI.DisabledScope(!RenderDoc.IsSupported()))
                    {
                        if (GUILayout.Button(Styles.renderdocContent, EditorStyles.toolbarButton))
                        {
                            m_Parent.CaptureRenderDoc();
                            GUIUtility.ExitGUI();
                        }
                    }
                }

                m_MaximizeOnPlay = GUILayout.Toggle(m_MaximizeOnPlay, Styles.maximizeOnPlayContent, EditorStyles.toolbarButton);
                EditorUtility.audioMasterMute = GUILayout.Toggle(EditorUtility.audioMasterMute, Styles.muteContent, EditorStyles.toolbarButton);
                m_Stats = GUILayout.Toggle(m_Stats, Styles.statsContent, EditorStyles.toolbarButton);

                Rect r         = GUILayoutUtility.GetRect(Styles.gizmosContent, Styles.gizmoButtonStyle);
                Rect rightRect = new Rect(r.xMax - Styles.gizmoButtonStyle.border.right, r.y, Styles.gizmoButtonStyle.border.right, r.height);
                if (EditorGUI.DropdownButton(rightRect, GUIContent.none, FocusType.Passive, GUIStyle.none))
                {
                    Rect rect = GUILayoutUtility.topLevel.GetLast();
                    if (AnnotationWindow.ShowAtPosition(rect, true))
                    {
                        GUIUtility.ExitGUI();
                    }
                }
                m_Gizmos = GUI.Toggle(r, m_Gizmos, Styles.gizmosContent, Styles.gizmoButtonStyle);
            }
            GUILayout.EndHorizontal();
        }
Ejemplo n.º 5
0
        private void DoToolbarGUI()
        {
            ScriptableSingleton <GameViewSizes> .instance.RefreshStandaloneAndRemoteDefaultSizes();

            if (ScriptableSingleton <GameViewSizes> .instance.GetChangeID() != this.m_SizeChangeID)
            {
                this.EnsureSelectedSizeAreValid();
                this.m_SizeChangeID = ScriptableSingleton <GameViewSizes> .instance.GetChangeID();
            }
            GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
            if (this.ShouldShowMultiDisplayOption())
            {
                GUILayoutOption[] optionArray1 = new GUILayoutOption[] { GUILayout.Width(80f) };
                int num = EditorGUILayout.Popup(this.m_TargetDisplay, DisplayUtility.GetDisplayNames(), EditorStyles.toolbarPopup, optionArray1);
                EditorGUILayout.Space();
                if (num != this.m_TargetDisplay)
                {
                    this.m_TargetDisplay = num;
                    this.UpdateZoomAreaAndParent();
                }
            }
            GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(160f) };
            EditorGUILayout.GameViewSizePopup(currentSizeGroupType, this.selectedSizeIndex, this, EditorStyles.toolbarPopup, options);
            this.DoZoomSlider();
            if (FrameDebuggerUtility.IsLocalEnabled())
            {
                GUILayout.FlexibleSpace();
                Color color = GUI.color;
                GUI.color *= UnityEditor.AnimationMode.animatedPropertyColor;
                GUILayout.Label(Styles.frameDebuggerOnContent, EditorStyles.miniLabel, new GUILayoutOption[0]);
                GUI.color = color;
                if (Event.current.type == EventType.Repaint)
                {
                    FrameDebuggerWindow.RepaintAll();
                }
            }
            GUILayout.FlexibleSpace();
            if (RenderDoc.IsLoaded())
            {
                using (new EditorGUI.DisabledScope(!RenderDoc.IsSupported()))
                {
                    if (GUILayout.Button(Styles.renderdocContent, EditorStyles.toolbarButton, new GUILayoutOption[0]))
                    {
                        base.m_Parent.CaptureRenderDoc();
                        GUIUtility.ExitGUI();
                    }
                }
            }
            this.m_MaximizeOnPlay         = GUILayout.Toggle(this.m_MaximizeOnPlay, Styles.maximizeOnPlayContent, EditorStyles.toolbarButton, new GUILayoutOption[0]);
            EditorUtility.audioMasterMute = GUILayout.Toggle(EditorUtility.audioMasterMute, Styles.muteContent, EditorStyles.toolbarButton, new GUILayoutOption[0]);
            this.m_Stats = GUILayout.Toggle(this.m_Stats, Styles.statsContent, EditorStyles.toolbarButton, new GUILayoutOption[0]);
            Rect position = GUILayoutUtility.GetRect(Styles.gizmosContent, Styles.gizmoButtonStyle);
            Rect rect2    = new Rect(position.xMax - Styles.gizmoButtonStyle.border.right, position.y, (float)Styles.gizmoButtonStyle.border.right, position.height);

            if (EditorGUI.ButtonMouseDown(rect2, GUIContent.none, FocusType.Passive, GUIStyle.none) && AnnotationWindow.ShowAtPosition(GUILayoutUtility.topLevel.GetLast(), true))
            {
                GUIUtility.ExitGUI();
            }
            this.m_Gizmos = GUI.Toggle(position, this.m_Gizmos, Styles.gizmosContent, Styles.gizmoButtonStyle);
            GUILayout.EndHorizontal();
        }
Ejemplo n.º 6
0
        private void DoToolbarGUI()
        {
            ScriptableSingleton <GameViewSizes> .instance.RefreshStandaloneAndWebplayerDefaultSizes();

            if (ScriptableSingleton <GameViewSizes> .instance.GetChangeID() != this.m_SizeChangeID)
            {
                this.EnsureSelectedSizeAreValid();
                this.m_SizeChangeID = ScriptableSingleton <GameViewSizes> .instance.GetChangeID();
            }
            GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
            if (this.ShouldShowMultiDisplayOption())
            {
                int num = EditorGUILayout.Popup(this.m_TargetDisplay, DisplayUtility.GetDisplayNames(), EditorStyles.toolbarPopup, new GUILayoutOption[1] {
                    GUILayout.Width(80f)
                });
                EditorGUILayout.Space();
                if (num != this.m_TargetDisplay)
                {
                    this.m_TargetDisplay = num;
                    this.GameViewAspectWasChanged();
                }
            }
            EditorGUILayout.GameViewSizePopup(GameView.currentSizeGroupType, this.selectedSizeIndex, new System.Action <int, object>(this.SelectionCallback), EditorStyles.toolbarDropDown, GUILayout.Width(160f));
            if (FrameDebuggerUtility.IsLocalEnabled())
            {
                GUILayout.FlexibleSpace();
                Color color = GUI.color;
                GUI.color *= AnimationMode.animatedPropertyColor;
                GUILayout.Label("Frame Debugger on", EditorStyles.miniLabel, new GUILayoutOption[0]);
                GUI.color = color;
                if (Event.current.type == EventType.Repaint)
                {
                    FrameDebuggerWindow.RepaintAll();
                }
            }
            GUILayout.FlexibleSpace();
            if (RenderDoc.IsLoaded())
            {
                EditorGUI.BeginDisabledGroup(!RenderDoc.IsSupported());
                if (GUILayout.Button(this.renderdocContent, EditorStyles.toolbarButton, new GUILayoutOption[0]))
                {
                    this.m_Parent.CaptureRenderDoc();
                    GUIUtility.ExitGUI();
                }
                EditorGUI.EndDisabledGroup();
            }
            this.m_MaximizeOnPlay         = GUILayout.Toggle(this.m_MaximizeOnPlay, "Maximize on Play", EditorStyles.toolbarButton, new GUILayoutOption[0]);
            EditorUtility.audioMasterMute = GUILayout.Toggle(EditorUtility.audioMasterMute, "Mute audio", EditorStyles.toolbarButton, new GUILayoutOption[0]);
            this.m_Stats = GUILayout.Toggle(this.m_Stats, "Stats", EditorStyles.toolbarButton, new GUILayoutOption[0]);
            Rect rect = GUILayoutUtility.GetRect(this.gizmosContent, GameView.s_GizmoButtonStyle);

            if (EditorGUI.ButtonMouseDown(new Rect(rect.xMax - (float)GameView.s_GizmoButtonStyle.border.right, rect.y, (float)GameView.s_GizmoButtonStyle.border.right, rect.height), GUIContent.none, FocusType.Passive, GUIStyle.none) && AnnotationWindow.ShowAtPosition(GUILayoutUtility.topLevel.GetLast(), true))
            {
                GUIUtility.ExitGUI();
            }
            this.m_Gizmos = GUI.Toggle(rect, this.m_Gizmos, this.gizmosContent, GameView.s_GizmoButtonStyle);
            GUILayout.EndHorizontal();
        }