From 82c57ddf61e14280503d5365e14b4b52506cbc7d Mon Sep 17 00:00:00 2001 From: Paul Balaji Date: Thu, 27 Aug 2020 17:51:01 +0100 Subject: [PATCH 1/4] tooltips --- .../GdkToolsConfigurationProvider.cs | 70 ++++++++++++++----- 1 file changed, 53 insertions(+), 17 deletions(-) diff --git a/workers/unity/Packages/io.improbable.gdk.tools/GdkToolsConfigurationProvider.cs b/workers/unity/Packages/io.improbable.gdk.tools/GdkToolsConfigurationProvider.cs index 233d45c448..06267ce0ea 100644 --- a/workers/unity/Packages/io.improbable.gdk.tools/GdkToolsConfigurationProvider.cs +++ b/workers/unity/Packages/io.improbable.gdk.tools/GdkToolsConfigurationProvider.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.Linq; using System.IO; @@ -16,7 +15,6 @@ public class GdkToolsConfigurationProvider : SettingsProvider { public const string ProjectSettingsPath = "Project/Spatial OS"; - internal const string SchemaStdLibDirLabel = "Standard library"; internal const string VerboseLoggingLabel = "Verbose logging"; internal const string CodegenLogOutputDirLabel = "Log output directory"; internal const string CodegenOutputDirLabel = "C# output directory"; @@ -109,6 +107,8 @@ public override void OnGUI(string searchContext) DrawCodeGenerationOptions(); + DrawDevAuthTokenOptions(); + DrawCustomSnapshotDir(); if (check.changed) @@ -152,13 +152,17 @@ private void DrawGeneralSection() GUILayout.Label(GeneralSectionLabel, EditorStyles.boldLabel); using (new EditorGUI.IndentLevelScope()) { - toolsConfig.EnvironmentPlatform = EditorGUILayout.TextField("Environment", toolsConfig.EnvironmentPlatform); + toolsConfig.EnvironmentPlatform = EditorGUILayout.TextField(new GUIContent("Environment", + "The environment argument to provide to GDK tooling such as the spatial CLI and Deployment Launcher."), + toolsConfig.EnvironmentPlatform); } using (new EditorGUI.IndentLevelScope()) { toolsConfig.RuntimeVersionOverride = - EditorGUILayout.TextField("Runtime Version Override", toolsConfig.RuntimeVersionOverride); + EditorGUILayout.TextField(new GUIContent("Runtime Version Override", + "Overrides the default runtime version used by the GDK for local and cloud deployments."), + toolsConfig.RuntimeVersionOverride); GUILayout.Label($"Current Runtime version: {toolsConfig.RuntimeVersion}", EditorStyles.helpBox); } @@ -177,21 +181,33 @@ private void DrawCodeGenerationOptions() using (new EditorGUIUtility.IconSizeScope(new Vector2(12, 12))) using (new EditorGUI.IndentLevelScope()) { - toolsConfig.VerboseLogging = EditorGUILayout.Toggle(VerboseLoggingLabel, toolsConfig.VerboseLogging); + toolsConfig.VerboseLogging = EditorGUILayout.Toggle(new GUIContent(VerboseLoggingLabel, + "Toggles verbose logging of the code generator."), + toolsConfig.VerboseLogging); toolsConfig.CodegenLogOutputDir = - EditorGUILayout.TextField(CodegenLogOutputDirLabel, toolsConfig.CodegenLogOutputDir); + EditorGUILayout.TextField(new GUIContent(CodegenLogOutputDirLabel, + "The directory, relative to the Unity project root, where code generator places its log files."), + toolsConfig.CodegenLogOutputDir); toolsConfig.CodegenOutputDir = - EditorGUILayout.TextField(CodegenOutputDirLabel, toolsConfig.CodegenOutputDir); + EditorGUILayout.TextField(new GUIContent(CodegenOutputDirLabel, + "The directory, relative to the Unity project root, where the code generator should place non-Editor generated code."), + toolsConfig.CodegenOutputDir); - toolsConfig.CodegenEditorOutputDir = EditorGUILayout.TextField(CodegenEditorOutputDirLabel, + toolsConfig.CodegenEditorOutputDir = EditorGUILayout.TextField(new GUIContent(CodegenEditorOutputDirLabel, + "The directory, relative to the Unity project root, where the code generator should place Editor-specific generated code."), toolsConfig.CodegenEditorOutputDir); toolsConfig.DescriptorOutputDir = - EditorGUILayout.TextField(DescriptorOutputDirLabel, toolsConfig.DescriptorOutputDir); - - EditorGUILayout.LabelField($"{SchemaSourceDirsLabel}", EditorStyles.boldLabel); + EditorGUILayout.TextField(new GUIContent(DescriptorOutputDirLabel, + "The directory, relative to the Unity project root, where the code generator should place the generated descriptor."), + toolsConfig.DescriptorOutputDir); + + EditorGUILayout.LabelField(new GUIContent($"{SchemaSourceDirsLabel}", + "A list of directories, relative to the Unity project root, containing schema that are not already in a package." + + " Note that the GDK automatically finds and provides paths to any `.schema` folder found inside a package."), + EditorStyles.boldLabel); using (new EditorGUI.IndentLevelScope()) { for (var i = 0; i < toolsConfig.SchemaSourceDirs.Count; i++) @@ -221,16 +237,32 @@ private void DrawCodeGenerationOptions() } } + EditorGUIUtility.labelWidth = previousWidth; + } + + private void DrawDevAuthTokenOptions() + { + var previousWidth = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = 180; + GUILayout.Label(DevAuthTokenSectionLabel, EditorStyles.boldLabel); using (new EditorGUI.IndentLevelScope()) { toolsConfig.DevAuthTokenLifetimeDays = - EditorGUILayout.IntSlider(DevAuthTokenLifetimeLabel, toolsConfig.DevAuthTokenLifetimeDays, 1, 90); - - toolsConfig.SaveDevAuthTokenToFile = EditorGUILayout.Toggle("Save token to file", toolsConfig.SaveDevAuthTokenToFile); + EditorGUILayout.IntSlider(new GUIContent(DevAuthTokenLifetimeLabel, + "Sets the lifetime for requested development authentication tokens, between 1 and 90 days. " + + "Changes made to this setting do not affect already requested tokens."), + toolsConfig.DevAuthTokenLifetimeDays, 1, 90); + + toolsConfig.SaveDevAuthTokenToFile = EditorGUILayout.Toggle(new GUIContent("Save token to file", + "Sets whether to save the development authentication to a file, instead of in player preferences."), + toolsConfig.SaveDevAuthTokenToFile); using (new EditorGUI.DisabledScope(!toolsConfig.SaveDevAuthTokenToFile)) { - toolsConfig.DevAuthTokenDir = EditorGUILayout.TextField(DevAuthTokenDirLabel, toolsConfig.DevAuthTokenDir); + toolsConfig.DevAuthTokenDir = EditorGUILayout.TextField(new GUIContent(DevAuthTokenDirLabel, + "The directory, relative to the project's Assets/ folder, where development authentication tokens will be " + + " saved to if saving to file is enabled. The full path is displayed in the window for ease of use."), + toolsConfig.DevAuthTokenDir); GUILayout.Label($"Token filepath: {Path.GetFullPath(toolsConfig.DevAuthTokenFilepath)}", EditorStyles.helpBox); } } @@ -240,13 +272,17 @@ private void DrawCodeGenerationOptions() private void DrawCustomSnapshotDir() { - GUILayout.Label(CustomSnapshotPathLabel, EditorStyles.boldLabel); + GUILayout.Label(new GUIContent(CustomSnapshotPathLabel, + "The default snapshot the GDK will use for local deployments."), + EditorStyles.boldLabel); GUILayout.Space(EditorGUIUtility.standardVerticalSpacing); using (new EditorGUILayout.HorizontalScope()) { using (new EditorGUI.DisabledScope(true)) { - EditorGUILayout.TextField(CustomSnapshotPathLabel, toolsConfig.CustomSnapshotPath); + EditorGUILayout.TextField(new GUIContent(CustomSnapshotPathLabel, + "The default snapshot the GDK will use for local deployments."), + toolsConfig.CustomSnapshotPath); } if (GUILayout.Button("Open", EditorStyles.miniButtonRight, GUILayout.ExpandWidth(false))) From 9ed0e6b581af38f6d6ba437d9b0abbc5f26485b8 Mon Sep 17 00:00:00 2001 From: Paul Balaji Date: Thu, 27 Aug 2020 17:53:44 +0100 Subject: [PATCH 2/4] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79ab56307d..4b7e7045de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ ### Added - Added `MeansImplicitUse` attribute to `RequireAttribute` to reduce warnings in Rider IDE. [#1462](https://github.com/spatialos/gdk-for-unity/pull/1462) +- Added tooltips to the GDK tools configuration options. [#1470](https://github.com/spatialos/gdk-for-unity/pull/1470) ### Changed From 26b31b9b3b54eb8a9c320e0b4c4352f451706ce5 Mon Sep 17 00:00:00 2001 From: Paul Balaji Date: Fri, 28 Aug 2020 12:15:21 +0100 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: Jamie Brynes --- .../GdkToolsConfigurationProvider.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/workers/unity/Packages/io.improbable.gdk.tools/GdkToolsConfigurationProvider.cs b/workers/unity/Packages/io.improbable.gdk.tools/GdkToolsConfigurationProvider.cs index 06267ce0ea..d72725224c 100644 --- a/workers/unity/Packages/io.improbable.gdk.tools/GdkToolsConfigurationProvider.cs +++ b/workers/unity/Packages/io.improbable.gdk.tools/GdkToolsConfigurationProvider.cs @@ -251,11 +251,11 @@ private void DrawDevAuthTokenOptions() toolsConfig.DevAuthTokenLifetimeDays = EditorGUILayout.IntSlider(new GUIContent(DevAuthTokenLifetimeLabel, "Sets the lifetime for requested development authentication tokens, between 1 and 90 days. " + - "Changes made to this setting do not affect already requested tokens."), + "Changes made to this setting do not affect existing tokens."), toolsConfig.DevAuthTokenLifetimeDays, 1, 90); toolsConfig.SaveDevAuthTokenToFile = EditorGUILayout.Toggle(new GUIContent("Save token to file", - "Sets whether to save the development authentication to a file, instead of in player preferences."), + "Sets whether to save the development authentication token to a file, instead of in player preferences."), toolsConfig.SaveDevAuthTokenToFile); using (new EditorGUI.DisabledScope(!toolsConfig.SaveDevAuthTokenToFile)) { @@ -273,7 +273,7 @@ private void DrawDevAuthTokenOptions() private void DrawCustomSnapshotDir() { GUILayout.Label(new GUIContent(CustomSnapshotPathLabel, - "The default snapshot the GDK will use for local deployments."), + "The snapshot the GDK will use for local deployments."), EditorStyles.boldLabel); GUILayout.Space(EditorGUIUtility.standardVerticalSpacing); using (new EditorGUILayout.HorizontalScope()) @@ -281,7 +281,7 @@ private void DrawCustomSnapshotDir() using (new EditorGUI.DisabledScope(true)) { EditorGUILayout.TextField(new GUIContent(CustomSnapshotPathLabel, - "The default snapshot the GDK will use for local deployments."), + "The snapshot the GDK will use for local deployments."), toolsConfig.CustomSnapshotPath); } From cfed0215017725efe0782fb01f0f0296bb6569ac Mon Sep 17 00:00:00 2001 From: Paul Balaji Date: Fri, 28 Aug 2020 12:31:46 +0100 Subject: [PATCH 4/4] Update CHANGELOG.md Co-authored-by: Sean Parker --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1e52164b1..2c09703215 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ ### Added - Added `MeansImplicitUse` attribute to `RequireAttribute` to reduce warnings in Rider IDE. [#1462](https://github.com/spatialos/gdk-for-unity/pull/1462) -- Added tooltips to the GDK tools configuration options. [#1470](https://github.com/spatialos/gdk-for-unity/pull/1470) +- Added tooltips to the SpatialOS Project Settings. [#1470](https://github.com/spatialos/gdk-for-unity/pull/1470) ### Changed