From 4383159979ba46463ebb4f6608f3334bf8cbbc75 Mon Sep 17 00:00:00 2001 From: Beck Sebenius Date: Tue, 14 Sep 2021 13:15:02 -0700 Subject: [PATCH 1/7] feat: added tip to the network manager inspector that directs to the golden path docs (MTT-1211) --- .../Editor/NetworkManagerEditor.cs | 82 +++++++++++++++++++ .../Editor/com.unity.netcode.editor.asmdef | 16 +++- .../Tests/Editor/UI.meta | 3 + .../Tests/Editor/UI/UITestHelpers.cs | 14 ++++ .../Tests/Editor/UI/UITestHelpers.cs.meta | 3 + 5 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 com.unity.netcode.gameobjects/Tests/Editor/UI.meta create mode 100644 com.unity.netcode.gameobjects/Tests/Editor/UI/UITestHelpers.cs create mode 100644 com.unity.netcode.gameobjects/Tests/Editor/UI/UITestHelpers.cs.meta diff --git a/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs b/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs index 701fbe92a4..568af630af 100644 --- a/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs +++ b/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs @@ -10,6 +10,9 @@ namespace Unity.Netcode.Editor [CanEditMultipleObjects] public class NetworkManagerEditor : UnityEditor.Editor { + private static GUIStyle s_CenteredWordWrappedLabel; + private static GUIStyle s_RightAlignedLinkLabel; + // Properties private SerializedProperty m_DontDestroyOnLoadProperty; private SerializedProperty m_RunInBackgroundProperty; @@ -203,6 +206,10 @@ public override void OnInspectorGUI() Initialize(); CheckNullProperties(); +#if !MULTIPLAYER_TOOLS + DrawMultiplayerToolsInfoTip(); +#endif + { var iterator = serializedObject.GetIterator(); @@ -356,5 +363,80 @@ public override void OnInspectorGUI() } } } + + void DrawMultiplayerToolsInfoTip() + { + const string dismissedKey = "NGO_Tools_Tip_Dismissed"; + + if (PlayerPrefs.GetInt(dismissedKey, 0) != 0) + { + return; + } + + if (s_CenteredWordWrappedLabel == null) + { + s_CenteredWordWrappedLabel = new GUIStyle(GUI.skin.label); + s_CenteredWordWrappedLabel.wordWrap = true; + } + + if (s_RightAlignedLinkLabel == null) + { + s_RightAlignedLinkLabel = new GUIStyle(EditorStyles.linkLabel); + s_RightAlignedLinkLabel.alignment = TextAnchor.MiddleRight; + } + + const float buttonWidth = 65f; + float buttonHeight = s_RightAlignedLinkLabel.lineHeight; + + const float elementMargin = 4f; + + const float boxPadding = 10f; + const float boxMargin = 4f; + float boxHeight = buttonHeight * 2 + elementMargin + boxMargin * 2 + boxPadding * 2; + + const string getToolsText = "Get access to additional tools for multiplayer development by installing the Multiplayer Tools package in the package manager."; + const string openDocsButtonText = "Open Docs"; + const string dismissButtonText = "Dismiss"; + const string targetUrl = "https://docs-multiplayer.unity3d.com/docs/tutorials/goldenpath_series/goldenpath_foundation_module"; + const string infoIconName = "console.infoicon"; + + void ShrinkRect(ref Rect rect, float amount) => + rect = new Rect( + rect.x + amount, + rect.y + amount, + rect.width - amount * 2, + rect.height - amount * 2); + + var helpBoxRect = GUILayoutUtility.GetRect(0f, boxHeight, GUILayout.ExpandWidth(true)); + ShrinkRect(ref helpBoxRect, boxMargin); + GUI.Box(helpBoxRect, GUIContent.none, EditorStyles.helpBox); + ShrinkRect(ref helpBoxRect, boxPadding); + + var iconRect = helpBoxRect; + iconRect.width = iconRect.height; + GUI.Label(iconRect, new GUIContent(EditorGUIUtility.IconContent(infoIconName))); + + var labelRect = iconRect; + labelRect.x += labelRect.width + elementMargin; + labelRect.width = helpBoxRect.width - iconRect.width - elementMargin * 3 - buttonWidth; + GUI.Label(labelRect, getToolsText, s_CenteredWordWrappedLabel); + + var buttonRect = labelRect; + buttonRect.x += labelRect.width + elementMargin; + buttonRect.width = buttonWidth; + buttonRect.height = buttonHeight; + + if (GUI.Button(buttonRect, openDocsButtonText, s_RightAlignedLinkLabel)) + { + Application.OpenURL(targetUrl); + } + + buttonRect.y += buttonRect.height + elementMargin; + + if (GUI.Button(buttonRect, dismissButtonText, s_RightAlignedLinkLabel)) + { + PlayerPrefs.SetInt(dismissedKey, 1); + } + } } } diff --git a/com.unity.netcode.gameobjects/Editor/com.unity.netcode.editor.asmdef b/com.unity.netcode.gameobjects/Editor/com.unity.netcode.editor.asmdef index 0b617f3ec6..5a9e666dd0 100644 --- a/com.unity.netcode.gameobjects/Editor/com.unity.netcode.editor.asmdef +++ b/com.unity.netcode.gameobjects/Editor/com.unity.netcode.editor.asmdef @@ -7,5 +7,19 @@ ], "includePlatforms": [ "Editor" - ] + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [ + { + "name": "com.unity.multiplayer.tools", + "expression": "", + "define": "MULTIPLAYER_TOOLS" + } + ], + "noEngineReferences": false } \ No newline at end of file diff --git a/com.unity.netcode.gameobjects/Tests/Editor/UI.meta b/com.unity.netcode.gameobjects/Tests/Editor/UI.meta new file mode 100644 index 0000000000..f22cc756dc --- /dev/null +++ b/com.unity.netcode.gameobjects/Tests/Editor/UI.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f672293e0efc41a6a7e930fd7ff14436 +timeCreated: 1631650280 \ No newline at end of file diff --git a/com.unity.netcode.gameobjects/Tests/Editor/UI/UITestHelpers.cs b/com.unity.netcode.gameobjects/Tests/Editor/UI/UITestHelpers.cs new file mode 100644 index 0000000000..bc2e70b24a --- /dev/null +++ b/com.unity.netcode.gameobjects/Tests/Editor/UI/UITestHelpers.cs @@ -0,0 +1,14 @@ +using UnityEditor; +using UnityEngine; + +namespace Unity.Netcode.EditorTests +{ + static class UITestHelpers + { + [MenuItem("Netcode/UI/Reset Multiplayer Tools Tip Status")] + static void ResetMultiplayerToolsTipStatus() + { + PlayerPrefs.DeleteKey("NGO_Tools_Tip_Dismissed"); + } + } +} diff --git a/com.unity.netcode.gameobjects/Tests/Editor/UI/UITestHelpers.cs.meta b/com.unity.netcode.gameobjects/Tests/Editor/UI/UITestHelpers.cs.meta new file mode 100644 index 0000000000..c9addc4f10 --- /dev/null +++ b/com.unity.netcode.gameobjects/Tests/Editor/UI/UITestHelpers.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: bde5fc3349494f77bebd0be12a6957e1 +timeCreated: 1631650292 \ No newline at end of file From fcb1242114392ef1ea04e56a324e92127ea98f2a Mon Sep 17 00:00:00 2001 From: Beck Sebenius Date: Tue, 14 Sep 2021 13:43:34 -0700 Subject: [PATCH 2/7] capitalized Package Manager --- com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs b/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs index 568af630af..6102d037ab 100644 --- a/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs +++ b/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs @@ -394,7 +394,7 @@ void DrawMultiplayerToolsInfoTip() const float boxMargin = 4f; float boxHeight = buttonHeight * 2 + elementMargin + boxMargin * 2 + boxPadding * 2; - const string getToolsText = "Get access to additional tools for multiplayer development by installing the Multiplayer Tools package in the package manager."; + const string getToolsText = "Get access to additional tools for multiplayer development by installing the Multiplayer Tools package in the Package Manager."; const string openDocsButtonText = "Open Docs"; const string dismissButtonText = "Dismiss"; const string targetUrl = "https://docs-multiplayer.unity3d.com/docs/tutorials/goldenpath_series/goldenpath_foundation_module"; From 2e16b97b8e98ddd524e66d58ad6e4363524e8726 Mon Sep 17 00:00:00 2001 From: Beck Sebenius Date: Tue, 14 Sep 2021 14:50:46 -0700 Subject: [PATCH 3/7] PR feedback --- .../Editor/AssemblyInfo.cs | 3 + .../Editor/AssemblyInfo.cs.meta | 3 + .../Editor/NetworkManagerEditor.cs | 109 +++++++++--------- .../Tests/Editor/UI/UITestHelpers.cs | 5 +- 4 files changed, 62 insertions(+), 58 deletions(-) create mode 100644 com.unity.netcode.gameobjects/Editor/AssemblyInfo.cs create mode 100644 com.unity.netcode.gameobjects/Editor/AssemblyInfo.cs.meta diff --git a/com.unity.netcode.gameobjects/Editor/AssemblyInfo.cs b/com.unity.netcode.gameobjects/Editor/AssemblyInfo.cs new file mode 100644 index 0000000000..102cfbd70c --- /dev/null +++ b/com.unity.netcode.gameobjects/Editor/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Unity.Netcode.EditorTests")] diff --git a/com.unity.netcode.gameobjects/Editor/AssemblyInfo.cs.meta b/com.unity.netcode.gameobjects/Editor/AssemblyInfo.cs.meta new file mode 100644 index 0000000000..5b2f096009 --- /dev/null +++ b/com.unity.netcode.gameobjects/Editor/AssemblyInfo.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4b3ac10f0d62417080a83d7e17407dd3 +timeCreated: 1631656133 \ No newline at end of file diff --git a/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs b/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs index 6102d037ab..8a843d28ae 100644 --- a/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs +++ b/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs @@ -10,8 +10,9 @@ namespace Unity.Netcode.Editor [CanEditMultipleObjects] public class NetworkManagerEditor : UnityEditor.Editor { - private static GUIStyle s_CenteredWordWrappedLabel; - private static GUIStyle s_RightAlignedLinkLabel; + internal const string k_InstallMultiplayerToolsTipDismissed_PlayerPrefKey = "Netcode_Tip_InstallMPTools_Dismissed"; + private static GUIStyle s_CenteredWordWrappedLabelStyle; + private static GUIStyle s_HelpBoxStyle; // Properties private SerializedProperty m_DontDestroyOnLoadProperty; @@ -366,77 +367,73 @@ public override void OnInspectorGUI() void DrawMultiplayerToolsInfoTip() { - const string dismissedKey = "NGO_Tools_Tip_Dismissed"; + const string getToolsText = "Access additional tools for multiplayer development by installing the Multiplayer Tools package in the Package Manager."; + const string openDocsButtonText = "Open Docs"; + const string dismissButtonText = "Dismiss"; + const string targetUrl = "https://docs-multiplayer.unity3d.com/docs/tutorials/goldenpath_series/goldenpath_foundation_module"; + const string infoIconName = "console.infoicon"; - if (PlayerPrefs.GetInt(dismissedKey, 0) != 0) + if (PlayerPrefs.GetInt(k_InstallMultiplayerToolsTipDismissed_PlayerPrefKey, 0) != 0) { return; } - if (s_CenteredWordWrappedLabel == null) + if (s_CenteredWordWrappedLabelStyle == null) { - s_CenteredWordWrappedLabel = new GUIStyle(GUI.skin.label); - s_CenteredWordWrappedLabel.wordWrap = true; + s_CenteredWordWrappedLabelStyle = new GUIStyle(GUI.skin.label); + s_CenteredWordWrappedLabelStyle.wordWrap = true; + s_CenteredWordWrappedLabelStyle.alignment = TextAnchor.MiddleLeft; } - if (s_RightAlignedLinkLabel == null) + if (s_HelpBoxStyle == null) { - s_RightAlignedLinkLabel = new GUIStyle(EditorStyles.linkLabel); - s_RightAlignedLinkLabel.alignment = TextAnchor.MiddleRight; + s_HelpBoxStyle = new GUIStyle(EditorStyles.helpBox); + s_HelpBoxStyle.padding = new RectOffset(10,10,10,10); } - const float buttonWidth = 65f; - float buttonHeight = s_RightAlignedLinkLabel.lineHeight; - - const float elementMargin = 4f; + var openDocsButtonStyle = GUI.skin.button; + var dismissButtonStyle = EditorStyles.linkLabel; - const float boxPadding = 10f; - const float boxMargin = 4f; - float boxHeight = buttonHeight * 2 + elementMargin + boxMargin * 2 + boxPadding * 2; + GUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + GUILayout.BeginHorizontal(s_HelpBoxStyle, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false), GUILayout.MaxWidth(800)); + { + GUILayout.Label(new GUIContent(EditorGUIUtility.IconContent(infoIconName)), GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)); + GUILayout.Space(4); + GUILayout.Label(getToolsText, s_CenteredWordWrappedLabelStyle, GUILayout.ExpandHeight(true)); - const string getToolsText = "Get access to additional tools for multiplayer development by installing the Multiplayer Tools package in the Package Manager."; - const string openDocsButtonText = "Open Docs"; - const string dismissButtonText = "Dismiss"; - const string targetUrl = "https://docs-multiplayer.unity3d.com/docs/tutorials/goldenpath_series/goldenpath_foundation_module"; - const string infoIconName = "console.infoicon"; + GUILayout.Space(4); - void ShrinkRect(ref Rect rect, float amount) => - rect = new Rect( - rect.x + amount, - rect.y + amount, - rect.width - amount * 2, - rect.height - amount * 2); - - var helpBoxRect = GUILayoutUtility.GetRect(0f, boxHeight, GUILayout.ExpandWidth(true)); - ShrinkRect(ref helpBoxRect, boxMargin); - GUI.Box(helpBoxRect, GUIContent.none, EditorStyles.helpBox); - ShrinkRect(ref helpBoxRect, boxPadding); - - var iconRect = helpBoxRect; - iconRect.width = iconRect.height; - GUI.Label(iconRect, new GUIContent(EditorGUIUtility.IconContent(infoIconName))); - - var labelRect = iconRect; - labelRect.x += labelRect.width + elementMargin; - labelRect.width = helpBoxRect.width - iconRect.width - elementMargin * 3 - buttonWidth; - GUI.Label(labelRect, getToolsText, s_CenteredWordWrappedLabel); - - var buttonRect = labelRect; - buttonRect.x += labelRect.width + elementMargin; - buttonRect.width = buttonWidth; - buttonRect.height = buttonHeight; - - if (GUI.Button(buttonRect, openDocsButtonText, s_RightAlignedLinkLabel)) - { - Application.OpenURL(targetUrl); - } + GUILayout.BeginVertical(); + GUILayout.FlexibleSpace(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button(openDocsButtonText, openDocsButtonStyle, GUILayout.Width(90), GUILayout.Height(30))) + { + Application.OpenURL(targetUrl); + } + GUILayout.EndHorizontal(); + GUILayout.FlexibleSpace(); + GUILayout.EndVertical(); - buttonRect.y += buttonRect.height + elementMargin; + GUILayout.Space(4); - if (GUI.Button(buttonRect, dismissButtonText, s_RightAlignedLinkLabel)) - { - PlayerPrefs.SetInt(dismissedKey, 1); + GUILayout.BeginVertical(); + GUILayout.FlexibleSpace(); + GUILayout.BeginHorizontal(); + if (GUILayout.Button(dismissButtonText, dismissButtonStyle, GUILayout.ExpandWidth(false))) + { + PlayerPrefs.SetInt(k_InstallMultiplayerToolsTipDismissed_PlayerPrefKey, 1); + } + EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link); + GUILayout.EndHorizontal(); + GUILayout.FlexibleSpace(); + GUILayout.EndVertical(); } + GUILayout.EndHorizontal(); + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + + GUILayout.Space(10); } } } diff --git a/com.unity.netcode.gameobjects/Tests/Editor/UI/UITestHelpers.cs b/com.unity.netcode.gameobjects/Tests/Editor/UI/UITestHelpers.cs index bc2e70b24a..1ee9d68548 100644 --- a/com.unity.netcode.gameobjects/Tests/Editor/UI/UITestHelpers.cs +++ b/com.unity.netcode.gameobjects/Tests/Editor/UI/UITestHelpers.cs @@ -1,4 +1,5 @@ -using UnityEditor; +using Unity.Netcode.Editor; +using UnityEditor; using UnityEngine; namespace Unity.Netcode.EditorTests @@ -8,7 +9,7 @@ static class UITestHelpers [MenuItem("Netcode/UI/Reset Multiplayer Tools Tip Status")] static void ResetMultiplayerToolsTipStatus() { - PlayerPrefs.DeleteKey("NGO_Tools_Tip_Dismissed"); + PlayerPrefs.DeleteKey(NetworkManagerEditor.k_InstallMultiplayerToolsTipDismissed_PlayerPrefKey); } } } From 6f3a0b97b23dacbc759a485dcf8de97f8e1d0769 Mon Sep 17 00:00:00 2001 From: Beck Sebenius Date: Tue, 14 Sep 2021 14:52:48 -0700 Subject: [PATCH 4/7] method rename --- com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs b/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs index 8a843d28ae..b54c203bc8 100644 --- a/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs +++ b/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs @@ -208,7 +208,7 @@ public override void OnInspectorGUI() CheckNullProperties(); #if !MULTIPLAYER_TOOLS - DrawMultiplayerToolsInfoTip(); + DrawInstallMultiplayerToolsTip(); #endif { @@ -365,7 +365,7 @@ public override void OnInspectorGUI() } } - void DrawMultiplayerToolsInfoTip() + void DrawInstallMultiplayerToolsTip() { const string getToolsText = "Access additional tools for multiplayer development by installing the Multiplayer Tools package in the Package Manager."; const string openDocsButtonText = "Open Docs"; From ce966c508897da7062e36df4a7671f21c247f78d Mon Sep 17 00:00:00 2001 From: Beck Sebenius Date: Tue, 14 Sep 2021 14:53:53 -0700 Subject: [PATCH 5/7] removed some unnecessary lines --- com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs b/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs index b54c203bc8..139600b011 100644 --- a/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs +++ b/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs @@ -406,12 +406,10 @@ void DrawInstallMultiplayerToolsTip() GUILayout.BeginVertical(); GUILayout.FlexibleSpace(); - GUILayout.BeginHorizontal(); if (GUILayout.Button(openDocsButtonText, openDocsButtonStyle, GUILayout.Width(90), GUILayout.Height(30))) { Application.OpenURL(targetUrl); } - GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.EndVertical(); @@ -419,13 +417,11 @@ void DrawInstallMultiplayerToolsTip() GUILayout.BeginVertical(); GUILayout.FlexibleSpace(); - GUILayout.BeginHorizontal(); if (GUILayout.Button(dismissButtonText, dismissButtonStyle, GUILayout.ExpandWidth(false))) { PlayerPrefs.SetInt(k_InstallMultiplayerToolsTipDismissed_PlayerPrefKey, 1); } EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link); - GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.EndVertical(); } From cb58b3d70565113c184188ff00776e911540f3f9 Mon Sep 17 00:00:00 2001 From: Beck Sebenius Date: Tue, 14 Sep 2021 15:46:04 -0700 Subject: [PATCH 6/7] standards fixes --- .../Editor/NetworkManagerEditor.cs | 8 ++++---- .../Tests/Editor/UI/UITestHelpers.cs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs b/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs index 3a4007d7ff..e4b0eaf905 100644 --- a/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs +++ b/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs @@ -10,7 +10,7 @@ namespace Unity.Netcode.Editor [CanEditMultipleObjects] public class NetworkManagerEditor : UnityEditor.Editor { - internal const string k_InstallMultiplayerToolsTipDismissed_PlayerPrefKey = "Netcode_Tip_InstallMPTools_Dismissed"; + internal const string installMultiplayerToolsTipDismissedPlayerPrefKey = "Netcode_Tip_InstallMPTools_Dismissed"; private static GUIStyle s_CenteredWordWrappedLabelStyle; private static GUIStyle s_HelpBoxStyle; @@ -358,7 +358,7 @@ public override void OnInspectorGUI() } } - void DrawInstallMultiplayerToolsTip() + private static void DrawInstallMultiplayerToolsTip() { const string getToolsText = "Access additional tools for multiplayer development by installing the Multiplayer Tools package in the Package Manager."; const string openDocsButtonText = "Open Docs"; @@ -366,7 +366,7 @@ void DrawInstallMultiplayerToolsTip() const string targetUrl = "https://docs-multiplayer.unity3d.com/docs/tutorials/goldenpath_series/goldenpath_foundation_module"; const string infoIconName = "console.infoicon"; - if (PlayerPrefs.GetInt(k_InstallMultiplayerToolsTipDismissed_PlayerPrefKey, 0) != 0) + if (PlayerPrefs.GetInt(installMultiplayerToolsTipDismissedPlayerPrefKey, 0) != 0) { return; } @@ -412,7 +412,7 @@ void DrawInstallMultiplayerToolsTip() GUILayout.FlexibleSpace(); if (GUILayout.Button(dismissButtonText, dismissButtonStyle, GUILayout.ExpandWidth(false))) { - PlayerPrefs.SetInt(k_InstallMultiplayerToolsTipDismissed_PlayerPrefKey, 1); + PlayerPrefs.SetInt(installMultiplayerToolsTipDismissedPlayerPrefKey, 1); } EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link); GUILayout.FlexibleSpace(); diff --git a/com.unity.netcode.gameobjects/Tests/Editor/UI/UITestHelpers.cs b/com.unity.netcode.gameobjects/Tests/Editor/UI/UITestHelpers.cs index 1ee9d68548..b2e0a4c2e7 100644 --- a/com.unity.netcode.gameobjects/Tests/Editor/UI/UITestHelpers.cs +++ b/com.unity.netcode.gameobjects/Tests/Editor/UI/UITestHelpers.cs @@ -7,9 +7,9 @@ namespace Unity.Netcode.EditorTests static class UITestHelpers { [MenuItem("Netcode/UI/Reset Multiplayer Tools Tip Status")] - static void ResetMultiplayerToolsTipStatus() + private static void ResetMultiplayerToolsTipStatus() { - PlayerPrefs.DeleteKey(NetworkManagerEditor.k_InstallMultiplayerToolsTipDismissed_PlayerPrefKey); + PlayerPrefs.DeleteKey(NetworkManagerEditor.installMultiplayerToolsTipDismissedPlayerPrefKey); } } } From 1b7b4badee167022e371b34f34dc2025520bf2bc Mon Sep 17 00:00:00 2001 From: Beck Sebenius Date: Tue, 14 Sep 2021 15:56:34 -0700 Subject: [PATCH 7/7] standards checks --- com.unity.netcode.gameobjects/Editor/AssemblyInfo.cs | 2 +- .../Editor/NetworkManagerEditor.cs | 8 ++++---- .../Tests/Editor/UI/UITestHelpers.cs | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/com.unity.netcode.gameobjects/Editor/AssemblyInfo.cs b/com.unity.netcode.gameobjects/Editor/AssemblyInfo.cs index 102cfbd70c..3437d8cec2 100644 --- a/com.unity.netcode.gameobjects/Editor/AssemblyInfo.cs +++ b/com.unity.netcode.gameobjects/Editor/AssemblyInfo.cs @@ -1,3 +1,3 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Unity.Netcode.EditorTests")] diff --git a/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs b/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs index e4b0eaf905..63342c1c8b 100644 --- a/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs +++ b/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs @@ -10,7 +10,7 @@ namespace Unity.Netcode.Editor [CanEditMultipleObjects] public class NetworkManagerEditor : UnityEditor.Editor { - internal const string installMultiplayerToolsTipDismissedPlayerPrefKey = "Netcode_Tip_InstallMPTools_Dismissed"; + internal const string InstallMultiplayerToolsTipDismissedPlayerPrefKey = "Netcode_Tip_InstallMPTools_Dismissed"; private static GUIStyle s_CenteredWordWrappedLabelStyle; private static GUIStyle s_HelpBoxStyle; @@ -366,7 +366,7 @@ private static void DrawInstallMultiplayerToolsTip() const string targetUrl = "https://docs-multiplayer.unity3d.com/docs/tutorials/goldenpath_series/goldenpath_foundation_module"; const string infoIconName = "console.infoicon"; - if (PlayerPrefs.GetInt(installMultiplayerToolsTipDismissedPlayerPrefKey, 0) != 0) + if (PlayerPrefs.GetInt(InstallMultiplayerToolsTipDismissedPlayerPrefKey, 0) != 0) { return; } @@ -381,7 +381,7 @@ private static void DrawInstallMultiplayerToolsTip() if (s_HelpBoxStyle == null) { s_HelpBoxStyle = new GUIStyle(EditorStyles.helpBox); - s_HelpBoxStyle.padding = new RectOffset(10,10,10,10); + s_HelpBoxStyle.padding = new RectOffset(10, 10, 10, 10); } var openDocsButtonStyle = GUI.skin.button; @@ -412,7 +412,7 @@ private static void DrawInstallMultiplayerToolsTip() GUILayout.FlexibleSpace(); if (GUILayout.Button(dismissButtonText, dismissButtonStyle, GUILayout.ExpandWidth(false))) { - PlayerPrefs.SetInt(installMultiplayerToolsTipDismissedPlayerPrefKey, 1); + PlayerPrefs.SetInt(InstallMultiplayerToolsTipDismissedPlayerPrefKey, 1); } EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link); GUILayout.FlexibleSpace(); diff --git a/com.unity.netcode.gameobjects/Tests/Editor/UI/UITestHelpers.cs b/com.unity.netcode.gameobjects/Tests/Editor/UI/UITestHelpers.cs index b2e0a4c2e7..5eefc13da0 100644 --- a/com.unity.netcode.gameobjects/Tests/Editor/UI/UITestHelpers.cs +++ b/com.unity.netcode.gameobjects/Tests/Editor/UI/UITestHelpers.cs @@ -1,15 +1,15 @@ -using Unity.Netcode.Editor; +using Unity.Netcode.Editor; using UnityEditor; using UnityEngine; namespace Unity.Netcode.EditorTests { - static class UITestHelpers + internal static class UITestHelpers { [MenuItem("Netcode/UI/Reset Multiplayer Tools Tip Status")] private static void ResetMultiplayerToolsTipStatus() { - PlayerPrefs.DeleteKey(NetworkManagerEditor.installMultiplayerToolsTipDismissedPlayerPrefKey); + PlayerPrefs.DeleteKey(NetworkManagerEditor.InstallMultiplayerToolsTipDismissedPlayerPrefKey); } } }