private void DrawTopSection(float topSectionHeight) { GUI.Label(new Rect(1f, 0.0f, this.position.width - 2f, topSectionHeight), string.Empty, EditorStyles.inspectorBig); float num1 = 7f; float num2 = 11f; float y1 = num1; Rect position = new Rect(num2 - 2f, y1, 80f, 20f); AnnotationUtility.use3dGizmos = GUI.Toggle(position, AnnotationUtility.use3dGizmos, this.icon3dGizmoContent); float iconSize = AnnotationUtility.iconSize; if (AnnotationWindow.s_Debug) { GUI.Label(new Rect(0.0f, y1 + 10f, this.position.width - num2, 20f), AnnotationWindow.ConvertTexelWorldSizeToString(iconSize), AnnotationWindow.m_Styles.texelWorldSizeStyle); } EditorGUI.BeginDisabledGroup(!AnnotationUtility.use3dGizmos); float width = 160f; float num3 = AnnotationWindow.ConvertTexelWorldSizeTo01(iconSize); float num4 = GUI.HorizontalSlider(new Rect(this.position.width - num2 - width, y1, width, 20f), num3, 0.0f, 1f); if (GUI.changed) { AnnotationUtility.iconSize = AnnotationWindow.Convert01ToTexelWorldSize(num4); SceneView.RepaintAll(); } EditorGUI.EndDisabledGroup(); float y2 = y1 + 20f; EditorGUI.BeginDisabledGroup(this.m_IsGameView); position = new Rect(num2 - 2f, y2, 80f, 20f); AnnotationUtility.showGrid = GUI.Toggle(position, AnnotationUtility.showGrid, this.showGridContent); EditorGUI.EndDisabledGroup(); }
private void DoButton(GUIContent content, Texture2D selectedIcon, bool labelIcon) { int controlID = GUIUtility.GetControlID(s_HashIconSelector, FocusType.Keyboard); if (content.image == selectedIcon) { Rect position = GUILayoutUtility.topLevel.PeekNext(); float num2 = 2f; position.x -= num2; position.y -= num2; position.width = selectedIcon.width + (2f * num2); position.height = selectedIcon.height + (2f * num2); GUI.Label(position, GUIContent.none, !labelIcon ? m_Styles.selection : m_Styles.selectionLabel); } if (EditorGUILayout.IconButton(controlID, content, GUIStyle.none, new GUILayoutOption[0])) { Texture2D icon = this.ConvertSmallIconToLargeIcon((Texture2D)content.image, labelIcon); EditorGUIUtility.SetIconForObject(this.m_TargetObject, icon); EditorUtility.ForceReloadInspectors(); AnnotationWindow.IconChanged(); if (Event.current.clickCount == 2) { this.CloseWindow(); } } }
private void DoButton(GUIContent content, Texture2D selectedIcon, bool labelIcon) { int controlId = GUIUtility.GetControlID(IconSelector.s_HashIconSelector, FocusType.Keyboard); if ((UnityEngine.Object)content.image == (UnityEngine.Object)selectedIcon) { Rect position = GUILayoutUtility.topLevel.PeekNext(); float num = 2f; position.x -= num; position.y -= num; position.width = (float)selectedIcon.width + 2f * num; position.height = (float)selectedIcon.height + 2f * num; GUI.Label(position, GUIContent.none, !labelIcon ? IconSelector.m_Styles.selection : IconSelector.m_Styles.selectionLabel); } if (!EditorGUILayout.IconButton(controlId, content, GUIStyle.none)) { return; } EditorGUIUtility.SetIconForObject(this.m_TargetObject, this.ConvertSmallIconToLargeIcon((Texture2D)content.image, labelIcon)); EditorUtility.ForceReloadInspectors(); AnnotationWindow.IconChanged(); if (Event.current.clickCount != 2) { return; } this.CloseWindow(); }
internal static bool ShowAtPosition(Rect buttonRect, bool isGameView) { // We could not use realtimeSinceStartUp since it is set to 0 when entering/exitting playmode, we assume an increasing time when comparing time. long nowMilliSeconds = System.DateTime.Now.Ticks / System.TimeSpan.TicksPerMillisecond; bool justClosed = nowMilliSeconds < s_LastClosedTime + 50; if (!justClosed) { Event.current.Use(); if (s_AnnotationWindow == null) { s_AnnotationWindow = ScriptableObject.CreateInstance <AnnotationWindow>(); } else { // We are treating AnnotationWindow like a PopupWindow which has logic to reclose it when opened, // AuxWindows derived from EditorWindow reset/reopen when repeatedly clicking the open button by design. // Call Cancel() here if it is already open. s_AnnotationWindow.Cancel(); return(false); } s_AnnotationWindow.Init(buttonRect, isGameView); return(true); } return(false); }
private void DrawTopSection(float topSectionHeight) { GUI.Label(new Rect(1f, 0f, base.position.width - 2f, topSectionHeight), string.Empty, EditorStyles.inspectorBig); float num = 7f; float num2 = 11f; float num3 = num; Rect position = new Rect(num2 - 2f, num3, 80f, 20f); AnnotationUtility.use3dGizmos = GUI.Toggle(position, AnnotationUtility.use3dGizmos, this.icon3dGizmoContent); float iconSize = AnnotationUtility.iconSize; if (AnnotationWindow.s_Debug) { Rect position2 = new Rect(0f, num3 + 10f, base.position.width - num2, 20f); GUI.Label(position2, AnnotationWindow.ConvertTexelWorldSizeToString(iconSize), AnnotationWindow.m_Styles.texelWorldSizeStyle); } using (new EditorGUI.DisabledScope(!AnnotationUtility.use3dGizmos)) { float num4 = 160f; float num5 = AnnotationWindow.ConvertTexelWorldSizeTo01(iconSize); Rect position3 = new Rect(base.position.width - num2 - num4, num3, num4, 20f); num5 = GUI.HorizontalSlider(position3, num5, 0f, 1f); if (GUI.changed) { AnnotationUtility.iconSize = AnnotationWindow.Convert01ToTexelWorldSize(num5); SceneView.RepaintAll(); } } num3 += 20f; using (new EditorGUI.DisabledScope(this.m_IsGameView)) { position = new Rect(num2 - 2f, num3, 80f, 20f); AnnotationUtility.showGrid = GUI.Toggle(position, AnnotationUtility.showGrid, this.showGridContent); } }
private void OnDisable() { foreach (MonoScript current in this.m_MonoScriptIconsChanged) { MonoImporter.CopyMonoScriptIconToImporters(current); } AnnotationWindow.s_LastClosedTime = DateTime.Now.Ticks / 10000L; AnnotationWindow.s_AnnotationWindow = null; }
private void OnDisable() { AssemblyReloadEvents.beforeAssemblyReload -= new AssemblyReloadEvents.AssemblyReloadCallback(base.Close); foreach (MonoScript current in this.m_MonoScriptIconsChanged) { MonoImporter.CopyMonoScriptIconToImporters(current); } AnnotationWindow.s_LastClosedTime = DateTime.Now.Ticks / 10000L; AnnotationWindow.s_AnnotationWindow = null; }
void OnDisable() { AssemblyReloadEvents.beforeAssemblyReload -= Close; // When window closes we copy all changes to monoimporters (reimport monoScripts) foreach (MonoScript monoScript in m_MonoScriptIconsChanged) { MonoImporter.CopyMonoScriptIconToImporters(monoScript); } s_LastClosedTime = System.DateTime.Now.Ticks / System.TimeSpan.TicksPerMillisecond; s_AnnotationWindow = null; }
private void DoTopSection(bool anySelected) { GUI.Label(new Rect(6f, 4f, 110f, 20f), "Select Icon"); EditorGUI.BeginDisabledGroup(!anySelected); if (GUI.Button(new Rect(93f, 6f, 43f, 12f), this.m_NoneButtonContent, IconSelector.m_Styles.noneButton)) { EditorGUIUtility.SetIconForObject(this.m_TargetObject, (Texture2D)null); EditorUtility.ForceReloadInspectors(); AnnotationWindow.IconChanged(); } EditorGUI.EndDisabledGroup(); }
void SetIconForSelectedObjects(Texture2D icon) { Undo.RecordObjects(m_TargetObjectList, "Set Icon On GameObject"); foreach (var target in m_TargetObjectList) { EditorGUIUtility.SetIconForObject(target, icon); } SetMultipleSelectedIcons(); EditorUtility.ForceReloadInspectors(); AnnotationWindow.IconChanged(); }
private void OnDisable() { using (List <MonoScript> .Enumerator enumerator = this.m_MonoScriptIconsChanged.GetEnumerator()) { while (enumerator.MoveNext()) { MonoImporter.CopyMonoScriptIconToImporters(enumerator.Current); } } AnnotationWindow.s_LastClosedTime = DateTime.Now.Ticks / 10000L; AnnotationWindow.s_AnnotationWindow = (AnnotationWindow)null; }
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(); }
internal static bool ShowAtPosition(Rect buttonRect, bool isGameView) { if (DateTime.Now.Ticks / 10000L < AnnotationWindow.s_LastClosedTime + 50L) { return(false); } Event.current.Use(); if ((UnityEngine.Object)AnnotationWindow.s_AnnotationWindow == (UnityEngine.Object)null) { AnnotationWindow.s_AnnotationWindow = ScriptableObject.CreateInstance <AnnotationWindow>(); } AnnotationWindow.s_AnnotationWindow.Init(buttonRect, isGameView); return(true); }
private void DoTopSection(bool anySelected) { Rect position = new Rect(6f, 4f, 110f, 20f); GUI.Label(position, "Select Icon"); using (new EditorGUI.DisabledScope(!anySelected)) { Rect rect2 = new Rect(93f, 6f, 43f, 12f); if (GUI.Button(rect2, this.m_NoneButtonContent, m_Styles.noneButton)) { EditorGUIUtility.SetIconForObject(this.m_TargetObject, null); EditorUtility.ForceReloadInspectors(); AnnotationWindow.IconChanged(); } } }
internal static bool ShowAtPosition(Rect buttonRect, bool isGameView) { long num = DateTime.Now.Ticks / 10000L; if (num >= AnnotationWindow.s_LastClosedTime + 50L) { Event.current.Use(); if (AnnotationWindow.s_AnnotationWindow == null) { AnnotationWindow.s_AnnotationWindow = ScriptableObject.CreateInstance <AnnotationWindow>(); } AnnotationWindow.s_AnnotationWindow.Init(buttonRect, isGameView); return(true); } return(false); }
internal static bool ShowAtPosition(Rect buttonRect, bool isGameView) { // We could not use realtimeSinceStartUp since it is set to 0 when entering/exitting playmode, we assume an increasing time when comparing time. long nowMilliSeconds = System.DateTime.Now.Ticks / System.TimeSpan.TicksPerMillisecond; bool justClosed = nowMilliSeconds < s_LastClosedTime + 50; if (!justClosed) { Event.current.Use(); if (s_AnnotationWindow == null) { s_AnnotationWindow = ScriptableObject.CreateInstance <AnnotationWindow>(); } s_AnnotationWindow.Init(buttonRect, isGameView); return(true); } return(false); }
void DoTopSection(bool anySelected) { Rect selectIconRect = new Rect(6, 4, 110, 20); GUI.Label(selectIconRect, "Select Icon"); // Draw selection background if none is selected using (new EditorGUI.DisabledScope(!anySelected)) { Rect noneButtonRect = new Rect(93, 6, 43, 12); if (GUI.Button(noneButtonRect, m_NoneButtonContent, m_Styles.noneButton)) { EditorGUIUtility.SetIconForObject(m_TargetObject, null); EditorUtility.ForceReloadInspectors(); AnnotationWindow.IconChanged(); } } }
void DoButton(GUIContent content, Texture2D selectedIcon, bool labelIcon) { int controlID = GUIUtility.GetControlID(s_HashIconSelector, FocusType.Keyboard); // Draw selection background if this is the selected icon if (content.image == selectedIcon) { // When placing our selection background we assume that icons rendered from top left corner Rect rect = GUILayoutUtility.topLevel.PeekNext(); float pad = 2; rect.x -= pad; rect.y -= pad; rect.width = selectedIcon.width + 2 * pad; rect.height = selectedIcon.height + 2 * pad; GUI.Label(rect, GUIContent.none, labelIcon ? m_Styles.selectionLabel : m_Styles.selection); } // Do icon if (EditorGUILayout.IconButton(controlID, content, GUIStyle.none)) { // Map to new icon Texture2D largeIcon = ConvertSmallIconToLargeIcon((Texture2D)content.image, labelIcon); Undo.RecordObject(m_TargetObject, "Set Icon On GameObject"); EditorGUIUtility.SetIconForObject(m_TargetObject, largeIcon); // We assume that we are setting icon in an inspector or annotation window (todo: make repaint delegate) EditorUtility.ForceReloadInspectors(); AnnotationWindow.IconChanged(); // Close on double click if (Event.current.clickCount == 2) { CloseWindow(); } } }
private void OnDisable() { foreach (MonoScript current in this.m_MonoScriptIconsChanged) { MonoImporter.CopyMonoScriptIconToImporters(current); } AnnotationWindow.s_LastClosedTime = DateTime.Now.Ticks / 10000L; AnnotationWindow.s_AnnotationWindow = null; }
internal static bool ShowAtPosition(Rect buttonRect, bool isGameView) { long num = DateTime.Now.Ticks / 10000L; if (num >= AnnotationWindow.s_LastClosedTime + 50L) { Event.current.Use(); if (AnnotationWindow.s_AnnotationWindow == null) { AnnotationWindow.s_AnnotationWindow = ScriptableObject.CreateInstance<AnnotationWindow>(); } AnnotationWindow.s_AnnotationWindow.Init(buttonRect, isGameView); return true; } return false; }
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(); }
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(); }
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(); }
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(); }
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(); }
internal static bool ShowAtPosition(Rect buttonRect, bool isGameView) { if (DateTime.Now.Ticks / 10000L < AnnotationWindow.s_LastClosedTime + 50L) return false; Event.current.Use(); if ((UnityEngine.Object) AnnotationWindow.s_AnnotationWindow == (UnityEngine.Object) null) AnnotationWindow.s_AnnotationWindow = ScriptableObject.CreateInstance<AnnotationWindow>(); AnnotationWindow.s_AnnotationWindow.Init(buttonRect, isGameView); return true; }
private void OnDisable() { using (List<MonoScript>.Enumerator enumerator = this.m_MonoScriptIconsChanged.GetEnumerator()) { while (enumerator.MoveNext()) MonoImporter.CopyMonoScriptIconToImporters(enumerator.Current); } AnnotationWindow.s_LastClosedTime = DateTime.Now.Ticks / 10000L; AnnotationWindow.s_AnnotationWindow = (AnnotationWindow) null; }