public static void RunMigration(Migration migration) { if (EnableLog) { Debug.Log("Running Migration: " + migration.Id); } var assetPaths = AssetDatabase.GetAllAssetPaths(); var root = new DirectoryInfo(SRDebugEditorUtil.GetRootPath()); if (EnableLog) { Debug.Log("Using Root Path: " + root.FullName); } var obsoleteAssets = migration.ObsoleteFiles.Select(p => root + "/" + p).ToList(); var deleteQueue = assetPaths.Where(assetPath => obsoleteAssets.Contains(assetPath)).ToList(); if (deleteQueue.Count == 0) { return; } var message = "The following files used by a previous version of SRDebugger are obsolete and can be safely deleted: \n\n" + deleteQueue.Aggregate((s1, s2) => s1 + "\n" + s2); Debug.Log(message); message += "\n\nIt is recommended to delete these files."; if (EditorUtility.DisplayDialog("SRDebugger Migration Assistant", message, "Delete Now", "Ignore")) { foreach (var s in deleteQueue) { Debug.Log("[SRDebugger] Deleting Asset {0}".Fmt(s)); if (!AssetDatabase.DeleteAsset(s)) { Debug.LogWarning("[SRDebugger] Error deleting asset {0}".Fmt(s)); } } Debug.Log("[SRDebugger] Migration Complete"); } else { EditorUtility.DisplayDialog("SRDebugger Migration Assitant", "You can run this migration check again via the \"Run Migrations\" button in the advanced tab of the SRDebugger settings window.", "OK"); } }
private void DrawVideo() { if (_demoSprite == null) { _demoSprite = SRDebugEditorUtil.LoadResource <Texture2D>("Editor/DemoSprite.png"); } if (_demoSprite == null) { return; } var frameWidth = 400; var frameHeight = 300; var framePadding = 0; var extraFramesStart = 5; var extraFramesEnd = 20; var totalFrames = 29; var fps = 16f; EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); var rect = GUILayoutUtility.GetRect(400 * 0.75f, 300 * 0.75f, GUILayout.ExpandHeight(false), GUILayout.ExpandWidth(false)); var frame = ((int)(EditorApplication.timeSinceStartup * fps)) % (totalFrames + extraFramesStart + extraFramesEnd); frame -= extraFramesStart; var actualFrame = Mathf.Clamp(frame, 0, totalFrames); SRDebugEditorUtil.RenderGif(rect, _demoSprite, actualFrame, frameWidth, frameHeight, 5, framePadding, framePadding); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); }
public override void OnInspectorGUI() { SRDebugEditorUtil.DrawLogo(SRDebugEditorUtil.GetLogo()); GUILayout.Label( "This asset contains the runtime settings used by SRDebugger. It is recommended that this asset be edited only via the SRDebugger Settings window.", EditorStyles.wordWrappedLabel); EditorGUILayout.Separator(); if (GUILayout.Button("Open SRDebugger Settings Window")) { SRDebuggerSettingsWindow.Open(); } if (!_override) { if (GUILayout.Button("Override Warning")) { _override = true; } } else { GUILayout.Label( "You have been warned...", EditorStyles.wordWrappedLabel); } EditorGUILayout.Separator(); if (_override) { base.OnInspectorGUI(); } }
private void OnGUI() { // Draw header area SRDebugEditorUtil.BeginDrawBackground(); SRDebugEditorUtil.DrawLogo(SRDebugEditorUtil.GetWelcomeLogo()); SRDebugEditorUtil.EndDrawBackground(); // Draw header/content divider EditorGUILayout.BeginVertical(SRDebugEditorUtil.Styles.SettingsHeaderBoxStyle); EditorGUILayout.EndVertical(); _scrollPosition = EditorGUILayout.BeginScrollView(_scrollPosition); GUILayout.Label("Welcome", SRDebugEditorUtil.Styles.HeaderLabel); GUILayout.Label( "Thank you for purchasing SRDebugger, your support is very much appreciated and we hope you find it useful for your project. " + "This window contains a quick guide to get to help get you started with SRDebugger.", SRDebugEditorUtil.Styles.ParagraphLabel); if (SRDebugEditorUtil.ClickableLabel( "Note: For more detailed information <color={0}>click here</color> to visit the online documentation." .Fmt(SRDebugEditorUtil.Styles.LinkColour), SRDebugEditorUtil.Styles.ParagraphLabel)) { Application.OpenURL(SRDebugStrings.Current.SettingsDocumentationUrl); } #if UNITY_5_3 EditorGUILayout.HelpBox( "On Unity 5.3 and 5.3.1 there is a bug causing errors to be printed to the console when using the docked tools. This should be fixed in a future Unity update.", MessageType.Warning, true); #endif GUILayout.Label("Quick Start", SRDebugEditorUtil.Styles.HeaderLabel); #if UNITY_5 GUILayout.Label( "Now that you have imported the package, you should find the trigger available in the top-left of your game window when in play mode. " + "Triple-clicking this trigger will bring up the debug panel. The trigger is hidden until clicked.", SRDebugEditorUtil.Styles.ParagraphLabel); GUILayout.Label( "By default, SRDebugger loads automatically when your game starts. " + "You can change this behaviour from the SRDebugger Settings window.", SRDebugEditorUtil.Styles.ParagraphLabel); #else GUILayout.Label( "Drag the <b>SRDebugger.Init</b> prefab into the first scene of your game. " + "Once initialised, SRDebugger will be available even after loading new scenes. We recommend adding the SRDebugger.Init prefab to the first scene " + "of your game so that the debug panel is available in all subsequent scenes.", SRDebugEditorUtil.Styles.ParagraphLabel); GUILayout.Label( "Once the prefab is in your scene, you should find the trigger available in the top-left of your game window when in play mode. " + "Triple-clicking this trigger will bring up the debug panel. The trigger is hidden until clicked.", SRDebugEditorUtil.Styles.ParagraphLabel); #endif DrawVideo(); EditorGUILayout.Space(); GUILayout.Label("Customization", SRDebugEditorUtil.Styles.HeaderLabel); if (SRDebugEditorUtil.ClickableLabel( "Many features of SRDebugger can be configured from the <color={0}>SRDebugger Settings</color> window." .Fmt( SRDebugEditorUtil.Styles.LinkColour), SRDebugEditorUtil.Styles.ParagraphLabel)) { SRDebuggerSettingsWindow.Open(); } GUILayout.Label( "From the settings window you can configure loading behaviour, trigger position, docked tools layout, and more. " + "You can enable the bug reporter service by using the sign-up form to get a free API key.", SRDebugEditorUtil.Styles.ParagraphLabel); GUILayout.Label("What Next?", SRDebugEditorUtil.Styles.HeaderLabel); if (SRDebugEditorUtil.ClickableLabel( "For more detailed information about SRDebugger's features or details about the Options Tab and script API, check the <color={0}>online documentation</color>." .Fmt(SRDebugEditorUtil.Styles.LinkColour), SRDebugEditorUtil.Styles.ParagraphLabel)) { Application.OpenURL(SRDebugStrings.Current.SettingsDocumentationUrl); } GUILayout.Label( "Thanks again for purchasing SRDebugger. " + "If you find it useful please consider leaving a rating or review on the Asset Store page to help us spread the word. ", SRDebugEditorUtil.Styles.ParagraphLabel); GUILayout.Label( "If you have any questions or concerns please do not hesitate to get in touch with us via email or the Unity forums.", SRDebugEditorUtil.Styles.ParagraphLabel); SRDebugEditorUtil.DrawFooterLayout(Screen.width - 15); EditorGUILayout.EndScrollView(); Repaint(); }
public override void OnInspectorGUI() { SRDebugEditorUtil.DrawLogo(); EditorGUILayout.PropertyField(_isEnabledProperty, new GUIContent("Enabled", SRDebugStrings.Current.SettingsIsEnabledTooltip)); #if UNITY_5 GUI.enabled = _isEnabledProperty.boolValue; EditorGUILayout.PropertyField(_autoLoadProperty, new GUIContent("Auto Load", SRDebugStrings.Current.SettingsAutoLoadTooltip)); GUI.enabled = true; #endif EditorGUILayout.Separator(); _panelAccessFoldoutVisible = SRDebugEditorUtil.DrawInspectorFoldout(_panelAccessFoldoutVisible, "Panel Access"); if (_panelAccessFoldoutVisible) { DrawPanelAccessArea(); } if (_enableKeyboardShortcutsProperty.boolValue) { _keyboardFoldoutVisible = SRDebugEditorUtil.DrawInspectorFoldout(_keyboardFoldoutVisible, "Keyboard Shortcuts"); if (_keyboardFoldoutVisible) { DrawKeyboardShortcutArea(); } EditorGUILayout.Separator(); } EditorGUILayout.Separator(); _displayFoldoutVisible = SRDebugEditorUtil.DrawInspectorFoldout(_displayFoldoutVisible, "Display"); if (_displayFoldoutVisible) { DrawDisplayArea(); } EditorGUILayout.Separator(); _enableDisableTabsVisible = SRDebugEditorUtil.DrawInspectorFoldout(_enableDisableTabsVisible, "Enabled Tabs"); if (_enableDisableTabsVisible) { DrawEnableDisableTabsArea(); } EditorGUILayout.Separator(); _bugReporterFoldoutVisible = SRDebugEditorUtil.DrawInspectorFoldout(_bugReporterFoldoutVisible, "Bug Reporter"); if (_bugReporterFoldoutVisible) { DrawBugReporterArea(); } serializedObject.ApplyModifiedProperties(); EditorGUILayout.Separator(); EditorGUILayout.Separator(); EditorGUILayout.HelpBox(SRDebugStrings.Current.SettingsRateBoxContents, MessageType.None, true); EditorGUILayout.BeginHorizontal(); var width = Screen.width - 50; GUILayout.Space(5); var margin = (EditorStyles.miniButton.padding.left) / 2f; if (GUILayout.Button("Web Site", GUILayout.Width(width / 2f - margin))) { Application.OpenURL(SRDebugStrings.Current.SettingsWebSiteUrl); } if (GUILayout.Button("Asset Store Page", GUILayout.Width(width / 2f - margin))) { Application.OpenURL(SRDebugStrings.Current.SettingsAssetStoreUrl); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Space(5); if (GUILayout.Button("Documentation", GUILayout.Width(width / 2f - margin))) { Application.OpenURL(SRDebugStrings.Current.SettingsDocumentationUrl); } if (GUILayout.Button("Support", GUILayout.Width(width / 2f - margin))) { Application.OpenURL( SRDebugStrings.Current.SettingsSupportUrl); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("Version " + SRDebug.Version, EditorStyles.miniLabel); EditorGUILayout.EndHorizontal(); }
private void OnGUI() { // Draw header area SRDebugEditorUtil.BeginDrawBackground(); SRDebugEditorUtil.DrawLogo(SRDebugEditorUtil.GetLogo()); SRDebugEditorUtil.EndDrawBackground(); // Draw header/content divider EditorGUILayout.BeginVertical(SRDebugEditorUtil.Styles.SettingsHeaderBoxStyle); EditorGUILayout.EndVertical(); // Draw tab buttons var rect = EditorGUILayout.BeginVertical(GUI.skin.box); --rect.width; var height = 18; EditorGUI.BeginChangeCheck(); EditorGUI.BeginDisabledGroup(!_enableTabChange); for (var i = 0; i < _tabs.Length; ++i) { var xStart = Mathf.RoundToInt(i * rect.width / _tabs.Length); var xEnd = Mathf.RoundToInt((i + 1) * rect.width / _tabs.Length); var pos = new Rect(rect.x + xStart, rect.y, xEnd - xStart, height); if (GUI.Toggle(pos, (int)_selectedTab == i, new GUIContent(_tabs[i]), EditorStyles.toolbarButton)) { _selectedTab = (Tabs)i; } } GUILayoutUtility.GetRect(10f, height); EditorGUI.EndDisabledGroup(); if (EditorGUI.EndChangeCheck()) { _scrollPosition = Vector2.zero; GUIUtility.keyboardControl = 0; } // Draw selected tab switch (_selectedTab) { case Tabs.General: DrawTabGeneral(); break; case Tabs.Layout: DrawTabLayout(); break; case Tabs.Bug_Reporter: DrawTabBugReporter(); break; case Tabs.Shortcuts: DrawTabShortcuts(); break; case Tabs.Advanced: DrawTabAdvanced(); break; } EditorGUILayout.EndVertical(); // Display rating prompt and link buttons EditorGUILayout.LabelField(SRDebugStrings.Current.SettingsRateBoxContents, EditorStyles.miniLabel); SRDebugEditorUtil.DrawFooterLayout(Screen.width); if (GUI.changed) { EditorUtility.SetDirty(Settings.Instance); } }
private void DrawBugReportSignupForm() { var isWeb = false; #if UNITY_WEBPLAYER EditorGUILayout.HelpBox("Signup form is not available when build target is Web Player.", MessageType.Error); isWeb = true; #endif EditorGUI.BeginDisabledGroup(isWeb || !_enableTabChange); GUILayout.Label("Signup Form", SRDebugEditorUtil.Styles.HeaderLabel); GUILayout.Label( "SRDebugger requires a free API key to enable the bug reporter system. This form will acquire one for you.", SRDebugEditorUtil.Styles.ParagraphLabel); if ( SRDebugEditorUtil.ClickableLabel( "Already got an API key? <color={0}>Click here</color>.".Fmt(SRDebugEditorUtil.Styles.LinkColour), SRDebugEditorUtil.Styles.RichTextLabel)) { _showBugReportSignupForm = false; Repaint(); } EditorGUILayout.Space(); GUILayout.Label("Invoice Number", EditorStyles.boldLabel); GUILayout.Label( "Enter the invoice number from your Asset Store purchase invoice.", EditorStyles.miniLabel); _invoiceNumber = EditorGUILayout.TextField(_invoiceNumber); EditorGUILayout.Space(); GUILayout.Label("Email Address", EditorStyles.boldLabel); GUILayout.Label( "Provide an email address where the bug reports should be sent.", EditorStyles.miniLabel); _emailAddress = EditorGUILayout.TextField(_emailAddress); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); if (SRDebugEditorUtil.ClickableLabel( "I agree to the <color={0}>terms and conditions</color>.".Fmt(SRDebugEditorUtil.Styles.LinkColour), SRDebugEditorUtil.Styles.RichTextLabel)) { ApiSignupTermsWindow.Open(); } _agreeLegal = EditorGUILayout.Toggle(_agreeLegal); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); var isEnabled = !string.IsNullOrEmpty(_invoiceNumber) && !string.IsNullOrEmpty(_emailAddress) && _agreeLegal; EditorGUI.BeginDisabledGroup(!isEnabled); if (GUILayout.Button("Submit")) { _errorMessage = null; _enableTabChange = false; EditorApplication.delayCall += () => { ApiSignup.SignUp(_emailAddress, _invoiceNumber, OnSignupResult); Repaint(); }; } EditorGUI.EndDisabledGroup(); if (!string.IsNullOrEmpty(_errorMessage)) { EditorGUILayout.HelpBox(_errorMessage, MessageType.Error, true); } GUILayout.FlexibleSpace(); GUILayout.Label("Having trouble? Please email [email protected] for assistance.", EditorStyles.miniLabel); EditorGUI.EndDisabledGroup(); }
private void DrawTabLayout() { GUILayout.Label("Pinned Tool Positions", SRDebugEditorUtil.Styles.HeaderLabel); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); var rect = GUILayoutUtility.GetRect(360, 210); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); SRDebugEditorUtil.DrawLayoutPreview(rect); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.BeginVertical(); GUILayout.Label("Console", SRDebugEditorUtil.Styles.InspectorHeaderStyle); Settings.Instance.ConsoleAlignment = (ConsoleAlignment)EditorGUILayout.EnumPopup(Settings.Instance.ConsoleAlignment); EditorGUILayout.EndVertical(); } { EditorGUI.BeginDisabledGroup(Settings.Instance.EnableTrigger == Settings.TriggerEnableModes.Off); EditorGUILayout.BeginVertical(); GUILayout.Label("Entry Trigger", SRDebugEditorUtil.Styles.InspectorHeaderStyle); Settings.Instance.TriggerPosition = (PinAlignment)EditorGUILayout.EnumPopup(Settings.Instance.TriggerPosition); EditorGUILayout.EndVertical(); EditorGUI.EndDisabledGroup(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.BeginVertical(); GUILayout.Label("Profiler", SRDebugEditorUtil.Styles.InspectorHeaderStyle); Settings.Instance.ProfilerAlignment = (PinAlignment)EditorGUILayout.EnumPopup((ProfilerAlignment)Settings.Instance.ProfilerAlignment); EditorGUILayout.EndVertical(); } { EditorGUILayout.BeginVertical(); GUILayout.Label("Options", SRDebugEditorUtil.Styles.InspectorHeaderStyle); Settings.Instance.OptionsAlignment = (PinAlignment)EditorGUILayout.EnumPopup((OptionsAlignment)Settings.Instance.OptionsAlignment); EditorGUILayout.EndVertical(); } EditorGUILayout.EndHorizontal(); // Expand content area to fit all available space GUILayout.FlexibleSpace(); }