From ca54cea13aafb85d128c08944f9a7089e5cd8151 Mon Sep 17 00:00:00 2001 From: Harrison Date: Tue, 18 Apr 2023 08:55:59 +0300 Subject: [PATCH 01/18] chore: update release name --- .github/workflows/auto-release-action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-release-action.yml b/.github/workflows/auto-release-action.yml index 5b226735..1078cef0 100644 --- a/.github/workflows/auto-release-action.yml +++ b/.github/workflows/auto-release-action.yml @@ -15,5 +15,5 @@ jobs: - uses: actions/checkout@v2 - uses: ncipollo/release-action@v1 with: - name: "Ready Player Me Unity SDK: Core ${{github.ref_name}}" + name: "${{github.ref_name}}" bodyFile: ".github/latest.md" \ No newline at end of file From 346aa8d39c6cf1e055206b5c27079fefcbd52c62 Mon Sep 17 00:00:00 2001 From: Harrison Hough Date: Wed, 19 Apr 2023 18:16:52 +0300 Subject: [PATCH 02/18] [SDK-43] Feature/contribution update (#65) ## Changes #### Added - style-guidelines.md #### Updated - style guide links in contributing.md --- CONTRIBUTING.md | 5 ++- Editor/Analytics/AmplitudeEventLogger.cs | 2 +- Editor/Module Management/ModuleInfo.cs | 4 +- Editor/Module Management/ModuleInstaller.cs | 2 +- Editor/Module Management/ModuleUpdater.cs | 25 ++++++------ Editor/ReadyPlayerMe.Core.Editor.asmdef | 32 ++++++++-------- Editor/UI/Components/AnalyticsPanel.cs | 8 ++-- Editor/UI/Components/Banner.cs | 6 +-- Editor/UI/Components/Footer.cs | 6 +-- Editor/UI/Components/QuickStartPanel.cs | 24 ++++++------ Editor/UI/EditorWindows/EditorWindowBase.cs | 6 +-- Editor/UI/EditorWindows/WelcomeWindow.cs | 10 ++--- Editor/Utils/EntryPoint.cs | 2 +- Editor/Utils/ProjectPrefs.cs | 4 +- Runtime/CoreSettingsHandler.cs | 2 +- Runtime/Data/Response.cs | 2 +- Runtime/Data/ResponseFile.cs | 6 +-- Runtime/OperationExecutor.cs | 2 +- Runtime/Utils/WebRequestDispatcher.cs | 4 +- .../ReadyPlayerMe.Core.Editor.Tests.asmdef | 38 +++++++++---------- style-guidelines.md | 31 +++++++++++++++ style-guidelines.md.meta | 3 ++ 22 files changed, 130 insertions(+), 94 deletions(-) create mode 100644 style-guidelines.md create mode 100644 style-guidelines.md.meta diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cec30dc9..41a71af3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,6 +17,7 @@ To get an overview of the project, read the [README](README.md). Here are some r - [Set up Git](https://docs.github.com/en/get-started/quickstart/set-up-git) - [GitHub flow](https://docs.github.com/en/get-started/quickstart/github-flow) - [Collaborating with pull requests](https://docs.github.com/en/github/collaborating-with-pull-requests) +- [Code style guide](https://github.com/readyplayerme/rpm-unity-sdk-core/blob/main/style-guidelines.md) ## FAQ @@ -92,10 +93,10 @@ You should always review your own PR first. For content changes, make sure that you: - [ ] Confirm that the changes meet the user experience and goals outlined in the content design plan (if there is one). -- [ ] Compare your pull request's source changes to staging to confirm that the output matches the source and that everything is rendering as expected. This helps spot issues like typos, content that doesn't follow the style guide, or content that isn't rendering due to versioning problems. Remember that lists and tables can be tricky. +- [ ] Compare your pull request's source changes to staging to confirm that the output matches the source and that everything is rendering as expected. This helps spot issues like typos, content that doesn't follow the [style guide](https://github.com/readyplayerme/rpm-unity-sdk-core/blob/main/style-guidelines.md), or content that isn't rendering due to versioning problems. Remember that lists and tables can be tricky. - [ ] Review the content for technical accuracy. - [ ] Review the entire pull request using the [translations guide for writers](./translations/for-writers.md). -- [ ] Copy-edit the changes for grammar, spelling, and adherence to the [style guide](#). +- [ ] Copy-edit the changes for grammar, spelling, and adherence to the [style guide](https://github.com/readyplayerme/rpm-unity-sdk-core/blob/main/style-guidelines.md). - [ ] Check new or updated Liquid statements to confirm that versioning is correct. - [ ] If there are any failing checks in your PR, troubleshoot them until they're all passing. diff --git a/Editor/Analytics/AmplitudeEventLogger.cs b/Editor/Analytics/AmplitudeEventLogger.cs index a1b56261..900c1ac9 100644 --- a/Editor/Analytics/AmplitudeEventLogger.cs +++ b/Editor/Analytics/AmplitudeEventLogger.cs @@ -74,7 +74,7 @@ public async void LogEvent(string eventName, Dictionary eventPro { eventData.Add(Constants.AmplitudeKeys.USER_PROPERTIES, userProperties); } - + if (eventProperties != null) { eventData.Add(Constants.AmplitudeKeys.EVENT_PROPERTIES, eventProperties); diff --git a/Editor/Module Management/ModuleInfo.cs b/Editor/Module Management/ModuleInfo.cs index 57949f30..ff01066c 100644 --- a/Editor/Module Management/ModuleInfo.cs +++ b/Editor/Module Management/ModuleInfo.cs @@ -29,8 +29,8 @@ public string Identifier return name; } // if branch not set, default to the version in ModuleList - return gitUrl + (string.IsNullOrEmpty(branch) ? $"#v{version}": $"#{branch}"); - + return gitUrl + (string.IsNullOrEmpty(branch) ? $"#v{version}" : $"#{branch}"); + } } } diff --git a/Editor/Module Management/ModuleInstaller.cs b/Editor/Module Management/ModuleInstaller.cs index 72ba2dd4..12832103 100644 --- a/Editor/Module Management/ModuleInstaller.cs +++ b/Editor/Module Management/ModuleInstaller.cs @@ -23,7 +23,7 @@ public static class ModuleInstaller private const string PROGRESS_BAR_TITLE = "Ready Player Me"; private const string RPM_SCRIPTING_SYMBOL = "READY_PLAYER_ME"; private const string CORE_MODULE_NAME = "com.readyplayerme.core"; - + private const string MODULE_INSTALLATION_SUCCESS_MESSAGE = "All the modules are installed successfully. Ready Player Me avatar system is ready to use."; private const string MODULE_INSTALLATION_FAILURE_MESSAGE = "Something went wrong while installing modules."; diff --git a/Editor/Module Management/ModuleUpdater.cs b/Editor/Module Management/ModuleUpdater.cs index 2bb8fada..01d05d8f 100644 --- a/Editor/Module Management/ModuleUpdater.cs +++ b/Editor/Module Management/ModuleUpdater.cs @@ -5,6 +5,7 @@ using Newtonsoft.Json; using UnityEditor; using UnityEditor.PackageManager; +using UnityEditor.PackageManager.Requests; using UnityEngine; using UnityEngine.Networking; using PackageInfo = UnityEditor.PackageManager.PackageInfo; @@ -51,7 +52,7 @@ public static void CheckForUpdates() private static void Check(bool isStartup = false) { // Get PackageInfo array from RPM Module package.json files - var packages = AssetDatabase.FindAssets(ASSET_FILTER) + PackageInfo[] packages = AssetDatabase.FindAssets(ASSET_FILTER) .Select(AssetDatabase.GUIDToAssetPath) .Where(x => x.Contains(PACKAGE_JSON) && x.Contains(PACKAGE_DOMAIN)) .Select(PackageInfo.FindForAssetPath) @@ -63,14 +64,14 @@ private static void Check(bool isStartup = false) } // Turn package_name@repo_url#branch_name into https://api.github.com/repos/readyplayerme/repo_name/releases - foreach (var package in packages) + foreach (PackageInfo package in packages) { var repoUrl = package.packageId.Split('@')[1]; var releasesUrl = repoUrl - .Split(new[] { ".git" }, StringSplitOptions.None)[0] + .Split(new[] { ".git" }, StringSplitOptions.None)[0] .Replace(GITHUB_WEBSITE, GITHUB_API_URL) + "/releases"; - - + + var packageUrl = repoUrl.Split('#')[0]; // Experimental or prerelease packages might look like 0.1.0-exp.1, remove after dash to parse with Version @@ -95,17 +96,17 @@ private static void Check(bool isStartup = false) private static async void FetchReleases(string packageName, string packageUrl, string releasesUrl, Version currentVersion) { - var request = UnityWebRequest.Get(releasesUrl); - var op = request.SendWebRequest(); + UnityWebRequest request = UnityWebRequest.Get(releasesUrl); + UnityWebRequestAsyncOperation op = request.SendWebRequest(); while (!op.isDone) await Task.Yield(); if (request.result == UnityWebRequest.Result.Success) { var response = request.downloadHandler.text; - var releases = JsonConvert.DeserializeObject(response); - var versions = releases!.Select(r => new Version(r.Tag.Substring(1).Split('-')[0])).ToArray(); + Release[] releases = JsonConvert.DeserializeObject(response); + Version[] versions = releases!.Select(r => new Version(r.Tag.Substring(1).Split('-')[0])).ToArray(); - var latestVersion = versions.Max(); + Version latestVersion = versions.Max(); if (latestVersion > currentVersion) { @@ -161,10 +162,10 @@ private static void DisplayUpdateDialog(string packageName, Version currentVersi /// The new version of the package. private static void UpdateModule(string name, string url, Version current, Version latest) { - var removeRequest = Client.Remove(name); + RemoveRequest removeRequest = Client.Remove(name); while (!removeRequest.IsCompleted) Thread.Sleep(MILLISECONDS_TIMEOUT); - var addRequest = Client.Add(url); + AddRequest addRequest = Client.Add(url); while (!addRequest.IsCompleted) Thread.Sleep(MILLISECONDS_TIMEOUT); Debug.Log($"Updated {name} from v{current} to v{latest}"); diff --git a/Editor/ReadyPlayerMe.Core.Editor.asmdef b/Editor/ReadyPlayerMe.Core.Editor.asmdef index 2cf950a4..3b400be9 100644 --- a/Editor/ReadyPlayerMe.Core.Editor.asmdef +++ b/Editor/ReadyPlayerMe.Core.Editor.asmdef @@ -1,18 +1,18 @@ { - "name": "ReadyPlayerMe.Core.Editor", - "references": [ - "GUID:69ab3f10cf42d0b42a6cd1353c374377", - "GUID:96af4ea235d92d245a095007c6ca3701" - ], - "includePlatforms": [ - "Editor" - ], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false + "name": "ReadyPlayerMe.Core.Editor", + "references": [ + "GUID:69ab3f10cf42d0b42a6cd1353c374377", + "GUID:96af4ea235d92d245a095007c6ca3701" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false } \ No newline at end of file diff --git a/Editor/UI/Components/AnalyticsPanel.cs b/Editor/UI/Components/AnalyticsPanel.cs index c3685e81..3573ad68 100644 --- a/Editor/UI/Components/AnalyticsPanel.cs +++ b/Editor/UI/Components/AnalyticsPanel.cs @@ -14,7 +14,7 @@ public class AnalyticsPanel : IEditorWindowComponent private const string ANALYTICS_PRIVACY_TEXT = "Read our Privacy Policy and learn how we use the data here."; private const string ANALYTICS_PRIVACY_URL = "https://docs.readyplayer.me/ready-player-me/integration-guides/unity/help-us-improve-the-unity-sdk"; - + private const string NEVER_ASK_AGAIN = "Never Ask Again"; private const string DONT_ENABLE_ANALYTICS = "Don't Enable Analytics"; private const string ENABLE_ANALYTICS = "Enable Analytics"; @@ -30,9 +30,9 @@ public class AnalyticsPanel : IEditorWindowComponent private GUIStyle descriptionStyle; private GUIStyle HeadingStyle; public string EditorWindowName { get; set; } - + public UnityEvent OnButtonClick = new UnityEvent(); - + public AnalyticsPanel(string editorWindowName) { EditorWindowName = editorWindowName; @@ -117,7 +117,7 @@ private void LoadStyles() GUILayout.Space(10); EditorGUILayout.EndVertical(); - + EditorGUILayout.BeginHorizontal(); GUILayout.Space(3); if (GUILayout.Button(DONT_ENABLE_ANALYTICS, buttonStyle)) diff --git a/Editor/UI/Components/Banner.cs b/Editor/UI/Components/Banner.cs index 89264a9b..b89955e6 100644 --- a/Editor/UI/Components/Banner.cs +++ b/Editor/UI/Components/Banner.cs @@ -10,7 +10,7 @@ namespace ReadyPlayerMe.Core.Editor public class Banner : IEditorWindowComponent { private const int FONT_SIZE = 14; - + private const int BANNER_WIDTH = 460; private const int BANNER_HEIGHT = 123; @@ -21,7 +21,7 @@ public class Banner : IEditorWindowComponent public Banner() { - + var assetGuid = AssetDatabase.FindAssets(BANNER_SEARCH_FILTER).FirstOrDefault(); var assetPath = AssetDatabase.GUIDToAssetPath(assetGuid); @@ -45,4 +45,4 @@ public void Draw(Rect position) GUILayout.Space(128); } } -} \ No newline at end of file +} diff --git a/Editor/UI/Components/Footer.cs b/Editor/UI/Components/Footer.cs index ac9e6683..20499aab 100644 --- a/Editor/UI/Components/Footer.cs +++ b/Editor/UI/Components/Footer.cs @@ -18,7 +18,7 @@ public class Footer : IEditorWindowComponent private readonly GUIStyle webButtonStyle; private string editorWindowName; - + public Footer(string editorWindowName) { this.editorWindowName = editorWindowName; @@ -32,7 +32,7 @@ public Footer(string editorWindowName) public void Draw(Rect position = new Rect()) { EditorGUILayout.BeginHorizontal(); - + if (GUILayout.Button("Documentation", webButtonStyle)) { AnalyticsEditorLogger.EventLogger.LogOpenDocumentation(editorWindowName); @@ -50,7 +50,7 @@ public Footer(string editorWindowName) AnalyticsEditorLogger.EventLogger.LogOpenDiscord(editorWindowName); Application.OpenURL(DISCORD_URL); } - + EditorGUILayout.EndHorizontal(); } } diff --git a/Editor/UI/Components/QuickStartPanel.cs b/Editor/UI/Components/QuickStartPanel.cs index 2691a379..c5dd3ff1 100644 --- a/Editor/UI/Components/QuickStartPanel.cs +++ b/Editor/UI/Components/QuickStartPanel.cs @@ -10,7 +10,7 @@ namespace ReadyPlayerMe.Core.Editor { public class QuickStartPanel : IEditorWindowComponent { - + private const string HEADING = "New to Ready Player Me? "; private const string DESCRIPTION = "Get started with the QuickStart sample."; private static bool neverAskAgain; @@ -20,7 +20,7 @@ public class QuickStartPanel : IEditorWindowComponent private GUIStyle buttonStyle; private GUIStyle descriptionStyle; private GUIStyle headingStyle; - + public readonly UnityEvent OnQuickStartClick = new UnityEvent(); public readonly UnityEvent OnCloseClick = new UnityEvent(); @@ -67,30 +67,30 @@ private void LoadStyles() alignment = TextAnchor.MiddleCenter }; } - + public void Draw(Rect position = new Rect()) { LoadStyles(); EditorGUILayout.BeginVertical("Box"); GUILayout.Space(10); - + EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.FlexibleSpace(); GUILayout.Label(HEADING, headingStyle); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); - + GUILayout.Space(8); - + EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.FlexibleSpace(); GUILayout.Label(DESCRIPTION, descriptionStyle); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); - + GUILayout.Space(20); EditorGUILayout.EndVertical(); - + EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.FlexibleSpace(); if (GUILayout.Button("Close", buttonStyle)) @@ -99,7 +99,7 @@ private void LoadStyles() } if (GUILayout.Button(QUICKSTART_SAMPLE_NAME, buttonStyle)) { - var quickStartSample = GetQuickStartSample(); + Sample quickStartSample = GetQuickStartSample(); if (!quickStartSample.isImported) { ImportAndOpenSample(quickStartSample); @@ -113,11 +113,11 @@ private void LoadStyles() private Sample GetQuickStartSample() { - var samples = Sample.FindByPackage(LOADER_PACKAGE, null).ToArray(); - var quickStartSample = samples.First(x => x.displayName == QUICKSTART_SAMPLE_NAME); + Sample[] samples = Sample.FindByPackage(LOADER_PACKAGE, null).ToArray(); + Sample quickStartSample = samples.First(x => x.displayName == QUICKSTART_SAMPLE_NAME); return quickStartSample; } - + private void ImportAndOpenSample(Sample quickStartSample) { quickStartSample.Import(); diff --git a/Editor/UI/EditorWindows/EditorWindowBase.cs b/Editor/UI/EditorWindows/EditorWindowBase.cs index aff4dc3b..df186821 100644 --- a/Editor/UI/EditorWindows/EditorWindowBase.cs +++ b/Editor/UI/EditorWindows/EditorWindowBase.cs @@ -16,7 +16,7 @@ public class EditorWindowBase : EditorWindow protected GUIStyle HeadingStyle; protected GUIStyle DescriptionStyle; - + protected Texture errorIcon; private GUIStyle webButtonStyle; @@ -32,9 +32,9 @@ public class EditorWindowBase : EditorWindow private void LoadAssets() { banner ??= new Banner(); - + footer ??= new Footer(editorWindowName); - + if (errorIcon == null) { var assetGuid = AssetDatabase.FindAssets(ERROR_ICON_SEARCH_FILTER).FirstOrDefault(); diff --git a/Editor/UI/EditorWindows/WelcomeWindow.cs b/Editor/UI/EditorWindows/WelcomeWindow.cs index 3438040e..1e644e0f 100644 --- a/Editor/UI/EditorWindows/WelcomeWindow.cs +++ b/Editor/UI/EditorWindows/WelcomeWindow.cs @@ -16,7 +16,7 @@ public class WelcomeWindow : EditorWindowBase private bool displayQuickStart; public static readonly string NeverAskAgainPref = "rpm-sdk-metrics-never-ask-again"; - + /// /// Constructor method that subscribes to the StartUp event. /// @@ -32,7 +32,7 @@ private void OnDestroy() { EntryPoint.Startup -= OnStartup; } - + /// /// This method is called when a Unity project is opened or after this Unity package has finished importing and is /// responsible for displaying the window. It also calls analytics events if enabled. @@ -51,7 +51,7 @@ private static void OnStartup() EditorApplication.quitting += OnQuit; } } - + private static bool CanShowWindow() { return !ProjectPrefs.GetBool(NeverAskAgainPref); @@ -64,7 +64,7 @@ private static void OnQuit() { AnalyticsEditorLogger.EventLogger.LogCloseProject(); } - + public static void ShowWindow() { GetWindow(typeof(WelcomeWindow), false, "Welcome"); @@ -89,7 +89,7 @@ private void LoadPanels() if (quickStartPanel == null) { quickStartPanel = new QuickStartPanel(); - quickStartPanel.OnQuickStartClick.AddListener(Close); + quickStartPanel.OnQuickStartClick.AddListener(Close); quickStartPanel.OnCloseClick.AddListener(Close); } } diff --git a/Editor/Utils/EntryPoint.cs b/Editor/Utils/EntryPoint.cs index ca6f648e..20682bd5 100644 --- a/Editor/Utils/EntryPoint.cs +++ b/Editor/Utils/EntryPoint.cs @@ -13,7 +13,7 @@ public static class EntryPoint /// Event for when package is imported or when project with package is opened. public static Action Startup; - + /// /// This constructor is used to subscribe to the event. /// diff --git a/Editor/Utils/ProjectPrefs.cs b/Editor/Utils/ProjectPrefs.cs index cdd96413..0b925174 100644 --- a/Editor/Utils/ProjectPrefs.cs +++ b/Editor/Utils/ProjectPrefs.cs @@ -1,13 +1,13 @@ using UnityEditor; using UnityEngine; -public static class ProjectPrefs +public static class ProjectPrefs { public static bool GetBool(string key) { return EditorPrefs.GetBool($"{Application.dataPath}{key}"); } - + public static void SetBool(string key, bool value) { EditorPrefs.SetBool($"{Application.dataPath}{key}", value); diff --git a/Runtime/CoreSettingsHandler.cs b/Runtime/CoreSettingsHandler.cs index dcb46907..021a9156 100644 --- a/Runtime/CoreSettingsHandler.cs +++ b/Runtime/CoreSettingsHandler.cs @@ -41,7 +41,7 @@ public static void Save() AssetDatabase.SaveAssets(); #endif } - + #if UNITY_EDITOR private static CoreSettings CreateCoreSettings() { diff --git a/Runtime/Data/Response.cs b/Runtime/Data/Response.cs index ec3d26e0..ebc19e3d 100644 --- a/Runtime/Data/Response.cs +++ b/Runtime/Data/Response.cs @@ -8,7 +8,7 @@ public class Response : IResponse public byte[] Data; public bool IsSuccess { get; set; } - public string Error { get; set; } + public string Error { get; set; } public long ResponseCode { get; set; } public void Parse(UnityWebRequest request) diff --git a/Runtime/Data/ResponseFile.cs b/Runtime/Data/ResponseFile.cs index 4b0bea5c..0a54364a 100644 --- a/Runtime/Data/ResponseFile.cs +++ b/Runtime/Data/ResponseFile.cs @@ -7,15 +7,15 @@ namespace ReadyPlayerMe.Core { public class ResponseFile : IResponse { - public bool IsSuccess { get; set; } - public string Error { get; set; } + public bool IsSuccess { get; set; } + public string Error { get; set; } public long ResponseCode { get; set; } public byte[] Data { get; private set; } private ulong length; - public void Parse( UnityWebRequest request) + public void Parse(UnityWebRequest request) { length = request.downloadedBytes; } diff --git a/Runtime/OperationExecutor.cs b/Runtime/OperationExecutor.cs index abd81e4b..ffd5735f 100644 --- a/Runtime/OperationExecutor.cs +++ b/Runtime/OperationExecutor.cs @@ -29,7 +29,7 @@ public OperationExecutor(IOperation[] operations) public async Task Execute(T context) { ctxSource = new CancellationTokenSource(); - foreach (var operation in operations) + foreach (IOperation operation in operations) { operation.ProgressChanged += OnProgressChanged; operation.Timeout = Timeout; diff --git a/Runtime/Utils/WebRequestDispatcher.cs b/Runtime/Utils/WebRequestDispatcher.cs index a21d3299..4293fc5a 100644 --- a/Runtime/Utils/WebRequestDispatcher.cs +++ b/Runtime/Utils/WebRequestDispatcher.cs @@ -37,7 +37,7 @@ public async Task SendRequest( if (headers != null) { - foreach (var header in headers) + foreach (KeyValuePair header in headers) { request.SetRequestHeader(header.Key, header.Value); } @@ -53,7 +53,7 @@ public async Task SendRequest( request.uploadHandler = new UploadHandlerRaw(bytes); } - var asyncOperation = request.SendWebRequest(); + UnityWebRequestAsyncOperation asyncOperation = request.SendWebRequest(); while (!asyncOperation.isDone && !ctx.IsCancellationRequested) { diff --git a/Tests/Editor/ReadyPlayerMe.Core.Editor.Tests.asmdef b/Tests/Editor/ReadyPlayerMe.Core.Editor.Tests.asmdef index c8634f84..82221626 100644 --- a/Tests/Editor/ReadyPlayerMe.Core.Editor.Tests.asmdef +++ b/Tests/Editor/ReadyPlayerMe.Core.Editor.Tests.asmdef @@ -1,21 +1,21 @@ { - "name": "ReadyPlayerMe.Core.Editor.Tests", - "references": [ - "ReadyPlayerMe.Core" - ], - "includePlatforms": [ - "Editor" - ], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": true, - "precompiledReferences": [ - "nunit.framework.dll" - ], - "autoReferenced": false, - "defineConstraints": [ - "UNITY_INCLUDE_TESTS" - ], - "versionDefines": [], - "noEngineReferences": false + "name": "ReadyPlayerMe.Core.Editor.Tests", + "references": [ + "ReadyPlayerMe.Core" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll" + ], + "autoReferenced": false, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [], + "noEngineReferences": false } \ No newline at end of file diff --git a/style-guidelines.md b/style-guidelines.md new file mode 100644 index 00000000..5e218603 --- /dev/null +++ b/style-guidelines.md @@ -0,0 +1,31 @@ + +# Coding Guidelines + +Generally we follow the dotnet C# style and code conventions as described [microsoft dotnet documentation](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions) you can use this as a reference. + +However there are a few different or Unity specific conventions we use in our modules that you will find described below. + +### Private class fields + +Similar to the dotnet C# conventions we use [Camel case](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions#camel-case) for private fields however we do not use the `_` prefix and as such we encourage you to do the same to keep the code consistent, see below for an example. + +```cs +public class Avatar +{ + private string avatarName; +} + +``` + +### Constant class fields + +For constant class fields our convention is to use SCREAMING_SNAKE_CASE. + + +```cs +public class Avatar +{ + public const string AVATAR_NAME; +} + +``` \ No newline at end of file diff --git a/style-guidelines.md.meta b/style-guidelines.md.meta new file mode 100644 index 00000000..284a5aba --- /dev/null +++ b/style-guidelines.md.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 58423b7924e34b0da8bbc91bab3334f4 +timeCreated: 1681820568 \ No newline at end of file From e196d42980ff971595029e66f716e6ad7fd3af8c Mon Sep 17 00:00:00 2001 From: Harrison Hough Date: Wed, 19 Apr 2023 18:17:27 +0300 Subject: [PATCH 03/18] [SDK-32] Feature/git hooks (#64) ## Changes #### Added - .githooks folder with pre-commit and commit-msg scripts to enforce standards #### Updated - CONTRIBUTING.md now has more info about commit message formatting --- .githooks/commit-msg | 23 +++++++++++++++++++++++ .githooks/pre-commit | 17 +++++++++++++++++ CONTRIBUTING.md | 9 +++++++++ 3 files changed, 49 insertions(+) create mode 100755 .githooks/commit-msg create mode 100755 .githooks/pre-commit diff --git a/.githooks/commit-msg b/.githooks/commit-msg new file mode 100755 index 00000000..c8a0c97b --- /dev/null +++ b/.githooks/commit-msg @@ -0,0 +1,23 @@ +#!/bin/sh + +COMMIT_MESSAGE="$(head -n1 "$1")" +COMMIT_MESSAGE_REGEX="^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-z ]+\))?: .+$" +AUTO_COMMIT_MESSAGE_REGEX="^Merge (pull request|branch) [a-zA-Z0-9#'_/-]+ (of [a-zA-Z0-9#':_. /-]+ )?(from|into) [a-zA-Z0-9#':_. /-]+$" + + +if [[ $COMMIT_MESSAGE =~ $COMMIT_MESSAGE_REGEX || $COMMIT_MESSAGE =~ $AUTO_COMMIT_MESSAGE_REGEX ]]; then + exit 0 +else + echo "Invalid commit message format:" + echo "Your message: '${COMMIT_MESSAGE}'" + echo "" + echo "Please use the following format:" + echo "(): " + echo "" + echo " the () part is optional" + echo "" + echo "Examples:" + echo "feat(login): add support for email login" + echo "fix: fix issue with user profile image upload" + exit 1 +fi \ No newline at end of file diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100755 index 00000000..8b153967 --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,17 @@ +#!/bin/sh + +# Enforce Gitflow branching and naming strategy + +# Get the name of the current branch +branch=$(git symbolic-ref --short HEAD) + +# Check if the branch name follows the Gitflow naming convention +if ! [[ $branch =~ ^(feature|hotfix|release)\/[a-z0-9-]+$ ]]; then + echo "Error: Branch name does not follow Gitflow naming convention." + echo "Branch names should start with 'feature/', 'hotfix/', or 'release/', followed by a hyphen-separated name." + echo "Example: feature/async-mesh-loading" + exit 1 +fi + +# All checks passed, allow the commit to proceed +exit 0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 41a71af3..0d7242a7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -84,6 +84,15 @@ Scan through our [existing issues](https://github.com/github/docs/issues) to fin ### Commit your update +We encourage following the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) format when it comes to writing commit messages. Our package repositories come with a .githooks folder that has a commit-msg file that can enforce this. +To set this up you just need to configure git's hookspath folder to point there. + +You can do this by +1. Open the terminal +2. Navigate to the root folder of this repository +3. Run the following command + `git config core.hooksPath .githooks` + Commit the changes once you are happy with them. Don't forget to [self-review](#self-review) to speed up the review process:zap:. ### Self review From 7a136084f61ba6431e45fe85b8c0165e16a8db4c Mon Sep 17 00:00:00 2001 From: Harrison Hough Date: Wed, 19 Apr 2023 19:59:01 +0300 Subject: [PATCH 04/18] fix: quick fix for handling dev and main branches --- .githooks/pre-commit | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 8b153967..6d8e44ea 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -1,17 +1,30 @@ #!/bin/sh -# Enforce Gitflow branching and naming strategy +# Gitflow branching and naming strategy enforcement for Windows and Mac -# Get the name of the current branch -branch=$(git symbolic-ref --short HEAD) +protected_branches="^(main|develop|hotfix/|release/|feature/)" +current_branch=$(git symbolic-ref HEAD | sed 's!refs/heads/!!') -# Check if the branch name follows the Gitflow naming convention -if ! [[ $branch =~ ^(feature|hotfix|release)\/[a-z0-9-]+$ ]]; then - echo "Error: Branch name does not follow Gitflow naming convention." - echo "Branch names should start with 'feature/', 'hotfix/', or 'release/', followed by a hyphen-separated name." - echo "Example: feature/async-mesh-loading" - exit 1 +# Ensure the branch name adheres to the Gitflow naming strategy +if ! [[ ${current_branch} =~ ${protected_branches} ]]; then + echo "Error: The current branch '${current_branch}' does not adhere to the Gitflow naming strategy." + echo "Branch names must match the following patterns: main, develop, hotfix/*, release/*, feature/*." + exit 1 fi -# All checks passed, allow the commit to proceed -exit 0 +# Check if pushing to the correct remote branch +remote_branch=$(git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD)) +if [[ -z "${remote_branch}" ]]; then + echo "Error: The current branch '${current_branch}' has no tracking remote branch." + exit 1 +fi + +remote_name=$(echo ${remote_branch} | cut -d/ -f1) +remote_branch_name=$(echo ${remote_branch} | cut -d/ -f2-) + +if [[ "${current_branch}" != "${remote_branch_name}" ]]; then + echo "Error: The current branch '${current_branch}' must be pushed to a remote branch with the same name: '${remote_name}/${current_branch}'." + exit 1 +fi + +exit 0 \ No newline at end of file From 3cb234721347dc506871dc60b00c900ae070414c Mon Sep 17 00:00:00 2001 From: Harrison Hough Date: Thu, 20 Apr 2023 19:41:23 +0300 Subject: [PATCH 05/18] chore: remove sdk version from log --- Runtime/ApplicationData.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Runtime/ApplicationData.cs b/Runtime/ApplicationData.cs index a5b98849..9d9fba4a 100644 --- a/Runtime/ApplicationData.cs +++ b/Runtime/ApplicationData.cs @@ -34,7 +34,6 @@ private static string GetRenderPipeline() public static void Log() { SDKLogger.Log(TAG, $"Partner Subdomain: {Data.PartnerName}"); - SDKLogger.Log(TAG, $"SDK Version: {Data.SDKVersion}"); SDKLogger.Log(TAG, $"Unity Version: {Data.UnityVersion}"); SDKLogger.Log(TAG, $"Unity Platform: {Data.UnityPlatform}"); SDKLogger.Log(TAG, $"Unity Render Pipeline: {Data.RenderPipeline}"); From 7bb80d4d87ef38f360893b7ff60e12f8d1bccfb7 Mon Sep 17 00:00:00 2001 From: Robin <1121080+rYuuk@users.noreply.github.com> Date: Wed, 26 Apr 2023 13:17:36 +0200 Subject: [PATCH 06/18] [SDK-131] Add checkout of avatar loader branch (#67) ## [SDK-131](https://ready-player-me.atlassian.net/browse/SDK-131) ## Description - This update the pr-template with dependency - avatar loader branch - Also updates test runner to checkout defined avatar loader branch in PR. ## Changes #### Updated - Test runner action to checkout avatar loader specified branch --- .github/pull_request_template.md | 6 +++++ .github/workflows/pr-test-runner.yml | 36 ++++++++++++++++++++++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index f675fefc..89830043 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -5,6 +5,12 @@ ## [TICKETID](https://ready-player-me.atlassian.net/browse/TICKETID) + +## Dependencies +```Package +Avatar Loader: branch +``` + ## Description - Briefly describe what this change will do diff --git a/.github/workflows/pr-test-runner.yml b/.github/workflows/pr-test-runner.yml index 99ca836d..ad5b04e7 100644 --- a/.github/workflows/pr-test-runner.yml +++ b/.github/workflows/pr-test-runner.yml @@ -27,13 +27,45 @@ jobs: fetch-depth: 0 ref: develop token: ${{ secrets.DEV_SDK_TOKEN }} + + - name: Get PR dependencies + id: pr-dependencies + run: | + PR_DEPENDENCY=$(awk -v start="\`\`\`Package" -v end="\`\`\`" '{ + if ($0 ~ start) {p=1; next} + if (p && !($0 ~ end)) {print} + if ($0 ~ end) {p=0} + }' <<\EOF + ${{ github.event.pull_request.body }} + EOF + ) + echo "dependency=$PR_DEPENDENCY" >> "$GITHUB_OUTPUT" - name: Checkout submodule branch run: | - cd ${{ secrets.CORE_PATH }} + cd Assets/Ready\ Player\ Me/Core git fetch -a git checkout ${{ github.event.pull_request.head.ref }} git pull origin ${{ github.event.pull_request.head.ref }} - + + dependency="${{ steps.pr-dependencies.outputs.dependency }}" + if [ -z "$dependency" ]; then + echo "No dependency found in PR description" + exit 0 + fi + echo "Dependencies found - ${dependency}" + AVATAR_LOADER_BRANCH="${dependency#*Avatar Loader: }" + + cd ../Avatar\ Loader + git fetch -a + git checkout "$AVATAR_LOADER_BRANCH" + + if [ $? -ne 0 ]; then + echo "Avatar loader checkout failed, no branch found with name $AVATAR_LOADER_BRANCH" + exit 0 + else + + git pull origin "$AVATAR_LOADER_BRANCH" + - name: Cache Project uses: actions/cache@v3 with: From f2fc318323277c98570e06529a14f9e3eaf6146d Mon Sep 17 00:00:00 2001 From: Robin <1121080+rYuuk@users.noreply.github.com> Date: Wed, 26 Apr 2023 13:17:36 +0200 Subject: [PATCH 07/18] [SDK-131] Add checkout of avatar loader branch (#67) ## [SDK-131](https://ready-player-me.atlassian.net/browse/SDK-131) ## Description - This update the pr-template with dependency - avatar loader branch - Also updates test runner to checkout defined avatar loader branch in PR. ## Changes #### Updated - Test runner action to checkout avatar loader specified branch --- .github/pull_request_template.md | 6 +++++ .github/workflows/pr-test-runner.yml | 37 ++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index f675fefc..89830043 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -5,6 +5,12 @@ ## [TICKETID](https://ready-player-me.atlassian.net/browse/TICKETID) + +## Dependencies +```Package +Avatar Loader: branch +``` + ## Description - Briefly describe what this change will do diff --git a/.github/workflows/pr-test-runner.yml b/.github/workflows/pr-test-runner.yml index f5793f5a..21aa9fbf 100644 --- a/.github/workflows/pr-test-runner.yml +++ b/.github/workflows/pr-test-runner.yml @@ -27,13 +27,46 @@ jobs: fetch-depth: 0 ref: develop token: ${{ secrets.DEV_SDK_TOKEN }} + + - name: Get PR dependencies + id: pr-dependencies + run: | + PR_DEPENDENCY=$(awk -v start="\`\`\`Package" -v end="\`\`\`" '{ + if ($0 ~ start) {p=1; next} + if (p && !($0 ~ end)) {print} + if ($0 ~ end) {p=0} + }' <<\EOF + ${{ github.event.pull_request.body }} + EOF + ) + echo "dependency=$PR_DEPENDENCY" >> "$GITHUB_OUTPUT" - name: Checkout submodule branch run: | - cd ${{ secrets.CORE_PATH }} + cd Assets/Ready\ Player\ Me/Core git fetch -a git checkout ${{ github.event.pull_request.head.ref }} git pull origin ${{ github.event.pull_request.head.ref }} - + + dependency="${{ steps.pr-dependencies.outputs.dependency }}" + if [ -z "$dependency" ]; then + echo "No dependency found in PR description" + exit 0 + fi + echo "Dependencies found - ${dependency}" + echo "$dependency" | od -c + AVATAR_LOADER_BRANCH="${dependency#*Avatar Loader: }" + echo "$AVATAR_LOADER_BRANCH" | od -c + cd ../Avatar\ Loader + git fetch -a + git checkout "$AVATAR_LOADER_BRANCH" + + if [ $? -ne 0 ]; then + echo "Avatar loader checkout failed, no branch found with name $AVATAR_LOADER_BRANCH" + exit 0 + else + + git pull origin "$AVATAR_LOADER_BRANCH" + - name: Cache Project uses: actions/cache@v3 with: From 90a078124b7cdf005b364c1af7a6f30d7135b537 Mon Sep 17 00:00:00 2001 From: Harrison Hough Date: Wed, 26 Apr 2023 15:48:07 +0300 Subject: [PATCH 08/18] [SDK-49] Core settings handler cleanup (#66) ## Changes #### Updated - CoreSettingsHandler #### Removed - EditorAssetGenerator.cs - SubdomainHelper as it's no longer used. --- Editor/Analytics/AmplitudeEventLogger.cs | 3 +- Editor/Module Management/ModuleInstaller.cs | 8 ++-- Editor/Module Management/ModuleUpdater.cs | 13 ++++-- Editor/UI/EditorWindows/EditorWindowBase.cs | 9 ++-- Editor/UI/EditorWindows/WelcomeWindow.cs | 5 ++- Editor/Utils/EditorAssetGenerator.cs | 29 ------------- Editor/Utils/EditorAssetGenerator.cs.meta | 11 ----- Editor/Utils/EditorUtilities.cs | 14 ------- Editor/Utils/SubdomainHelper.cs | 46 --------------------- Editor/Utils/SubdomainHelper.cs.meta | 3 -- Runtime/CoreSettingsHandler.cs | 28 +++++++------ Runtime/Logger/SDKLogger.cs | 2 + Runtime/Utils/WebRequestDispatcher.cs | 3 +- 13 files changed, 43 insertions(+), 131 deletions(-) delete mode 100644 Editor/Utils/EditorAssetGenerator.cs delete mode 100644 Editor/Utils/EditorAssetGenerator.cs.meta delete mode 100644 Editor/Utils/SubdomainHelper.cs delete mode 100644 Editor/Utils/SubdomainHelper.cs.meta diff --git a/Editor/Analytics/AmplitudeEventLogger.cs b/Editor/Analytics/AmplitudeEventLogger.cs index 900c1ac9..2176c597 100644 --- a/Editor/Analytics/AmplitudeEventLogger.cs +++ b/Editor/Analytics/AmplitudeEventLogger.cs @@ -43,7 +43,7 @@ public void SetUserProperties() { Constants.Properties.RENDER_PIPELINE, appData.RenderPipeline }, { Constants.Properties.SUBDOMAIN, appData.PartnerName }, { Constants.Properties.APP_NAME, PlayerSettings.productName }, - { Constants.Properties.SDK_TARGET, "Unity" }, + { Constants.Properties.SDK_TARGET, SDK_TARGET }, { Constants.Properties.APP_IDENTIFIER, Application.identifier }, { Constants.Properties.ALLOW_ANALYTICS, true } }; @@ -133,6 +133,7 @@ private enum Target private const string PRODUCTION = "unity"; private const string DEVELOPMENT = "unity-dev"; + private const string SDK_TARGET = "Unity"; private string GetAnalyticsTarget() { diff --git a/Editor/Module Management/ModuleInstaller.cs b/Editor/Module Management/ModuleInstaller.cs index 12832103..044fc919 100644 --- a/Editor/Module Management/ModuleInstaller.cs +++ b/Editor/Module Management/ModuleInstaller.cs @@ -27,6 +27,8 @@ public static class ModuleInstaller private const string MODULE_INSTALLATION_SUCCESS_MESSAGE = "All the modules are installed successfully. Ready Player Me avatar system is ready to use."; private const string MODULE_INSTALLATION_FAILURE_MESSAGE = "Something went wrong while installing modules."; + private const string ALL_MODULES_ARE_INSTALLED = "All modules are installed."; + private const string INSTALLING_MODULES = "Installing modules..."; static ModuleInstaller() { @@ -46,7 +48,7 @@ private static void OnRegisteredPackages(PackageRegistrationEventArgs args) { InstallModules(); AppendScriptingSymbol(); - EditorAssetGenerator.CreateSettingsAssets(); + CoreSettingsHandler.CreateCoreSettings(); } ValidateModules(); } @@ -71,7 +73,7 @@ private static void OnRegisteringPackages(PackageRegistrationEventArgs args) /// private static void InstallModules() { - EditorUtility.DisplayProgressBar(PROGRESS_BAR_TITLE, "Installing modules...", 0); + EditorUtility.DisplayProgressBar(PROGRESS_BAR_TITLE, INSTALLING_MODULES, 0); Thread.Sleep(THREAD_SLEEP_TIME); ModuleInfo[] missingModules = GetMissingModuleNames(); @@ -87,7 +89,7 @@ private static void InstallModules() AddModuleRequest(module.Identifier); } - EditorUtility.DisplayProgressBar(PROGRESS_BAR_TITLE, "All modules are installed.", 1); + EditorUtility.DisplayProgressBar(PROGRESS_BAR_TITLE, ALL_MODULES_ARE_INSTALLED, 1); Thread.Sleep(THREAD_SLEEP_TIME); } diff --git a/Editor/Module Management/ModuleUpdater.cs b/Editor/Module Management/ModuleUpdater.cs index 01d05d8f..b68971bd 100644 --- a/Editor/Module Management/ModuleUpdater.cs +++ b/Editor/Module Management/ModuleUpdater.cs @@ -18,6 +18,7 @@ namespace ReadyPlayerMe.Core.Editor [InitializeOnLoad] public class ModuleUpdater { + private class Release { [JsonProperty("tag_name")] @@ -34,6 +35,10 @@ private class Release private const string ASSET_FILTER = "package"; private const string DONT_ASK = "Dont Ask"; + private const string UPDATE_PACKAGES_WINDOW_TITLE = "Update Packages"; + private const string UPDATE_BUTTON_TEXT = "Update"; + private const string CANCEL_BUTTON_TEXT = "Cancel"; + private const string DONT_ASK_TEXT = "Don't ask"; static ModuleUpdater() { @@ -129,11 +134,11 @@ private static async void FetchReleases(string packageName, string packageUrl, s private static void DisplayUpdateDialog(string packageName, Version currentVersion, Version latestVersion, string packageUrl) { - var shouldUpdate = EditorUtility.DisplayDialogComplex("Update Packages", + var shouldUpdate = EditorUtility.DisplayDialogComplex(UPDATE_PACKAGES_WINDOW_TITLE, $"New update available for {packageName}\nCurrent version: {currentVersion}\nLatest version: {latestVersion}", - "Update", - "Cancel", - "Don't ask"); + UPDATE_BUTTON_TEXT, + CANCEL_BUTTON_TEXT, + DONT_ASK_TEXT); switch (shouldUpdate) { diff --git a/Editor/UI/EditorWindows/EditorWindowBase.cs b/Editor/UI/EditorWindows/EditorWindowBase.cs index df186821..db8e95b0 100644 --- a/Editor/UI/EditorWindows/EditorWindowBase.cs +++ b/Editor/UI/EditorWindows/EditorWindowBase.cs @@ -20,14 +20,15 @@ public class EditorWindowBase : EditorWindow protected Texture errorIcon; private GUIStyle webButtonStyle; - - private readonly GUILayoutOption windowWidth = GUILayout.Width(460); + protected const float WIDTH = 460; + private readonly GUILayoutOption windowWidth = GUILayout.Width(WIDTH); protected readonly float ButtonHeight = 30f; private Banner banner; private Footer footer; private string editorWindowName; private bool windowResized; + private readonly Color descriptionColor = new Color(0.7f, 0.7f, 0.7f, 1.0f); private void LoadAssets() { @@ -66,7 +67,7 @@ private void LoadAssets() margin = new RectOffset(5, 0, 0, 0), normal = { - textColor = new Color(0.7f, 0.7f, 0.7f, 1.0f) + textColor = descriptionColor } }; @@ -115,7 +116,7 @@ private void SetWindowSize() var height = GUILayoutUtility.GetLastRect().height; if (!windowResized && height > 1) { - minSize = maxSize = new Vector2(460, height); + minSize = maxSize = new Vector2(WIDTH, height); windowResized = true; } } diff --git a/Editor/UI/EditorWindows/WelcomeWindow.cs b/Editor/UI/EditorWindows/WelcomeWindow.cs index 1e644e0f..4fec1b39 100644 --- a/Editor/UI/EditorWindows/WelcomeWindow.cs +++ b/Editor/UI/EditorWindows/WelcomeWindow.cs @@ -7,6 +7,7 @@ namespace ReadyPlayerMe.Core.Editor [InitializeOnLoad] public class WelcomeWindow : EditorWindowBase { + private const string WINDOW_NAME = "Welcome"; private Banner banner; private GUIStyle buttonStyle; private GUIStyle descriptionStyle; @@ -67,7 +68,7 @@ private static void OnQuit() public static void ShowWindow() { - GetWindow(typeof(WelcomeWindow), false, "Welcome"); + GetWindow(typeof(WelcomeWindow), false, WINDOW_NAME); } /// @@ -77,7 +78,7 @@ private void LoadPanels() { if (analyticsPanel == null) { - analyticsPanel = new AnalyticsPanel("Welcome"); + analyticsPanel = new AnalyticsPanel(WINDOW_NAME); analyticsPanel.OnButtonClick.AddListener(() => { displayQuickStart = true; diff --git a/Editor/Utils/EditorAssetGenerator.cs b/Editor/Utils/EditorAssetGenerator.cs deleted file mode 100644 index 2c106aa7..00000000 --- a/Editor/Utils/EditorAssetGenerator.cs +++ /dev/null @@ -1,29 +0,0 @@ -using UnityEditor; -using UnityEngine; -using ReadyPlayerMe.Core.Data; - -namespace ReadyPlayerMe.Core.Editor -{ - public static class EditorAssetGenerator - { - private const string SETTINGS_SAVE_FOLDER = "Ready Player Me/Resources/Settings"; - private const string CORE_SETTINGS_ASSET_NAME = "CoreSettings.asset"; - - public static void CreateSettingsAssets() - { - DirectoryUtility.ValidateDirectory($"{Application.dataPath}/{SETTINGS_SAVE_FOLDER}"); - AssetDatabase.Refresh(); - CreateCoreSettings(); - } - - private static void CreateCoreSettings() - { - var coreSettings = ScriptableObject.CreateInstance(); - coreSettings.Subdomain = "demo"; - - AssetDatabase.CreateAsset(coreSettings, $"Assets/{SETTINGS_SAVE_FOLDER}/{CORE_SETTINGS_ASSET_NAME}"); - AssetDatabase.SaveAssets(); - AssetDatabase.Refresh(); - } - } -} diff --git a/Editor/Utils/EditorAssetGenerator.cs.meta b/Editor/Utils/EditorAssetGenerator.cs.meta deleted file mode 100644 index 047bd3bc..00000000 --- a/Editor/Utils/EditorAssetGenerator.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a63db503278923241a3f87954dcd267c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor/Utils/EditorUtilities.cs b/Editor/Utils/EditorUtilities.cs index a8e1e748..402a1c4e 100644 --- a/Editor/Utils/EditorUtilities.cs +++ b/Editor/Utils/EditorUtilities.cs @@ -37,19 +37,5 @@ public static bool IsUrlShortcodeValid(string shortcodeUrl) { return string.IsNullOrEmpty(shortcodeUrl) || Regex.Match(shortcodeUrl, SHORT_CODE_REGEX).Length > 0 || shortcodeUrl.EndsWith(".glb"); } - - public static class BackgroundStyle - { - private static readonly GUIStyle style = new GUIStyle(); - private static readonly Texture2D texture = new Texture2D(1, 1); - - public static GUIStyle Get(Color color) - { - texture.SetPixel(0, 0, color); - texture.Apply(); - style.normal.background = texture; - return style; - } - } } } diff --git a/Editor/Utils/SubdomainHelper.cs b/Editor/Utils/SubdomainHelper.cs deleted file mode 100644 index f82e435a..00000000 --- a/Editor/Utils/SubdomainHelper.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Reflection; -using UnityEditor; -using UnityEngine; - -namespace ReadyPlayerMe.Core.Editor -{ - public static class SubdomainHelper - { - public static string PartnerDomain; - - private static readonly bool IsLoaded; - private static ScriptableObject partner; - - static SubdomainHelper() - { - if (IsLoaded) return; - - Load(); - IsLoaded = true; - } - - public static void SaveToScriptableObject(string newSubdomain) - { - if (partner == null) - { - return; - } - - Type type = partner.GetType(); - FieldInfo field = type.GetField("Subdomain"); - field.SetValue(partner, newSubdomain); - PartnerDomain = newSubdomain; - EditorUtility.SetDirty(partner); - AssetDatabase.SaveAssets(); - } - - private static void Load() - { - partner = Resources.Load("Partner"); - Type type = partner != null ? partner.GetType() : null; - MethodInfo method = type?.GetMethod("GetSubdomain"); - PartnerDomain = method?.Invoke(partner, null) as string; - } - } -} diff --git a/Editor/Utils/SubdomainHelper.cs.meta b/Editor/Utils/SubdomainHelper.cs.meta deleted file mode 100644 index 3275155f..00000000 --- a/Editor/Utils/SubdomainHelper.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 3cb0535f26024a918420218b3af05792 -timeCreated: 1662537429 \ No newline at end of file diff --git a/Runtime/CoreSettingsHandler.cs b/Runtime/CoreSettingsHandler.cs index 021a9156..6faec22c 100644 --- a/Runtime/CoreSettingsHandler.cs +++ b/Runtime/CoreSettingsHandler.cs @@ -6,15 +6,18 @@ namespace ReadyPlayerMe.Core { public static class CoreSettingsHandler { - private const string SETTINGS_PATH = "Settings/CoreSettings"; - + private const string RESOURCE_PATH = "Settings/CoreSettings"; + public const string PROJECT_RELATIVE_ASSET_PATH = "Assets/Ready Player Me/Resources/Settings/CoreSettings.asset"; + private const string SETTINGS_SAVE_FOLDER = "Ready Player Me/Resources/Settings"; + private const string DEFAULT_SUBDOMAIN = "demo"; + public static CoreSettings CoreSettings { get { if (coreSettings == null) { - coreSettings = Resources.Load(SETTINGS_PATH); + coreSettings = Resources.Load(RESOURCE_PATH); #if UNITY_EDITOR if (coreSettings == null) { @@ -28,30 +31,29 @@ public static CoreSettings CoreSettings private static CoreSettings coreSettings; +#if UNITY_EDITOR public static void SaveSubDomain(string subDomain) { coreSettings.Subdomain = subDomain; Save(); } - + public static void Save() { -#if UNITY_EDITOR EditorUtility.SetDirty(coreSettings); AssetDatabase.SaveAssets(); -#endif } - -#if UNITY_EDITOR - private static CoreSettings CreateCoreSettings() + + public static CoreSettings CreateCoreSettings() { - var coreSettings = ScriptableObject.CreateInstance(); - coreSettings.Subdomain = "demo"; + DirectoryUtility.ValidateDirectory($"{Application.dataPath}/{SETTINGS_SAVE_FOLDER}"); + var newSettings = ScriptableObject.CreateInstance(); + newSettings.Subdomain = DEFAULT_SUBDOMAIN; - AssetDatabase.CreateAsset(coreSettings, $"Assets/Ready Player Me/Resources/Settings/CoreSettings.asset"); + AssetDatabase.CreateAsset(coreSettings, PROJECT_RELATIVE_ASSET_PATH); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); - return coreSettings; + return newSettings; } #endif } diff --git a/Runtime/Logger/SDKLogger.cs b/Runtime/Logger/SDKLogger.cs index 7ed3c825..12f09cd4 100644 --- a/Runtime/Logger/SDKLogger.cs +++ b/Runtime/Logger/SDKLogger.cs @@ -25,12 +25,14 @@ public static bool IsLoggingEnabled() return CoreSettingsHandler.CoreSettings.EnableLogging; } +#if UNITY_EDITOR public static void EnableLogging(bool enabled) { loggingEnabled = enabled; CoreSettingsHandler.CoreSettings.EnableLogging = loggingEnabled; CoreSettingsHandler.Save(); } +#endif public static void Log(string tag, object message) { diff --git a/Runtime/Utils/WebRequestDispatcher.cs b/Runtime/Utils/WebRequestDispatcher.cs index 4293fc5a..bcee23dd 100644 --- a/Runtime/Utils/WebRequestDispatcher.cs +++ b/Runtime/Utils/WebRequestDispatcher.cs @@ -18,6 +18,7 @@ public enum HttpMethod public class WebRequestDispatcher { + private const string CALLED_ERROR = "Request was cancelled"; public int Timeout = 240; public Action ProgressChanged; @@ -67,7 +68,7 @@ public async Task SendRequest( if (ctx.IsCancellationRequested) { request.Abort(); - response.Error = "Request was cancelled"; + response.Error = CALLED_ERROR; response.Parse(request); return response; } From 5b4bcc07f22fee83ac5615161c65cc494d50098c Mon Sep 17 00:00:00 2001 From: Robin <1121080+rYuuk@users.noreply.github.com> Date: Thu, 27 Apr 2023 11:46:13 +0200 Subject: [PATCH 09/18] [SDK-134] Add action for updating unity-sdk (#69) ## [SDK-134](https://ready-player-me.atlassian.net/browse/SDK-134) ## Dependencies ```Package Avatar Loader: develop ``` ## Changes #### Added - Github action which runs when PR is merged into develop and updates unity-sdk submodules\ --- .github/workflows.meta | 3 --- .github/workflows/update-unity-sdk.yml | 34 ++++++++++++++++++++++++++ Tests/Editor/OperationExecutorTests.cs | 3 +-- Tests/Editor/SDKLoggerTests.cs | 3 +-- 4 files changed, 36 insertions(+), 7 deletions(-) delete mode 100644 .github/workflows.meta create mode 100644 .github/workflows/update-unity-sdk.yml diff --git a/.github/workflows.meta b/.github/workflows.meta deleted file mode 100644 index 79e72791..00000000 --- a/.github/workflows.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: f7a87fe3c7f849558159e435634dd62c -timeCreated: 1669635896 \ No newline at end of file diff --git a/.github/workflows/update-unity-sdk.yml b/.github/workflows/update-unity-sdk.yml new file mode 100644 index 00000000..9d6674ff --- /dev/null +++ b/.github/workflows/update-unity-sdk.yml @@ -0,0 +1,34 @@ +name: Update unity sdk +on: + pull_request: + branches: + - develop + types: [closed] + +jobs: + update-submodule: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - name: Checkout repo with submodule + uses: actions/checkout@v3 + with: + repository: "readyplayerme/Unity-SDK" + submodules: true + fetch-depth: 0 + ref: develop + token: ${{ secrets.DEV_SDK_TOKEN }} + + - name: Update submodule + run: | + cd Assets/Ready\ Player\ Me/Core + git checkout develop + git pull origin develop + + - name: Commit and push changes + run: | + git config --global user.name "dev-sdk" + git config --global user.email "dev-sdk@wolf3d.io" + git add . + git commit -m 'Update submodule' + git push origin develop diff --git a/Tests/Editor/OperationExecutorTests.cs b/Tests/Editor/OperationExecutorTests.cs index 071bf98b..30c7c44f 100644 --- a/Tests/Editor/OperationExecutorTests.cs +++ b/Tests/Editor/OperationExecutorTests.cs @@ -3,9 +3,8 @@ using System.Threading; using System.Threading.Tasks; using NUnit.Framework; -using ReadyPlayerMe.Core; -namespace Tests +namespace ReadyPlayerMe.Core.Tests { public class OperationExecutorTests { diff --git a/Tests/Editor/SDKLoggerTests.cs b/Tests/Editor/SDKLoggerTests.cs index 3c2f5749..44852003 100644 --- a/Tests/Editor/SDKLoggerTests.cs +++ b/Tests/Editor/SDKLoggerTests.cs @@ -1,10 +1,9 @@ using System.Collections; using NUnit.Framework; -using ReadyPlayerMe.Core; using UnityEngine; using UnityEngine.TestTools; -namespace Tests +namespace ReadyPlayerMe.Core.Tests { public class SDKLoggerTests { From 69385a59da263200173db04a41ecf977162fe0dd Mon Sep 17 00:00:00 2001 From: Harrison Hough Date: Fri, 5 May 2023 14:36:01 +0300 Subject: [PATCH 10/18] chore: added import timeout (#70) #### Added - timeout to the module installer to prevent importer getting stuck --- Editor/Module Management/ModuleInstaller.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Editor/Module Management/ModuleInstaller.cs b/Editor/Module Management/ModuleInstaller.cs index 044fc919..95abc675 100644 --- a/Editor/Module Management/ModuleInstaller.cs +++ b/Editor/Module Management/ModuleInstaller.cs @@ -6,6 +6,7 @@ using UnityEditor.Compilation; using UnityEditor.PackageManager; using UnityEditor.PackageManager.Requests; +using UnityEngine; using PackageInfo = UnityEditor.PackageManager.PackageInfo; namespace ReadyPlayerMe.Core.Editor @@ -30,6 +31,8 @@ public static class ModuleInstaller private const string ALL_MODULES_ARE_INSTALLED = "All modules are installed."; private const string INSTALLING_MODULES = "Installing modules..."; + private const float TIMEOUT_FOR_MODULE_INSTALLATION = 20f; + static ModuleInstaller() { Events.registeredPackages += OnRegisteredPackages; @@ -102,15 +105,21 @@ private static void InstallModules() /// The Unity package identifier of the module to be installed. public static void AddModuleRequest(string identifier) { + var startTime = Time.realtimeSinceStartup; AddRequest addRequest = Client.Add(identifier); - while (!addRequest.IsCompleted) + while (!addRequest.IsCompleted && Time.realtimeSinceStartup - startTime < TIMEOUT_FOR_MODULE_INSTALLATION) Thread.Sleep(THREAD_SLEEP_TIME); + + if (Time.realtimeSinceStartup - startTime >= TIMEOUT_FOR_MODULE_INSTALLATION) + { + Debug.LogError($"Package installation timed out for {identifier}. Please try again."); + } if (addRequest.Error != null) { AssetDatabase.Refresh(); CompilationPipeline.RequestScriptCompilation(); - SDKLogger.Log(TAG, "Error: " + addRequest.Error.message); + Debug.LogError("Error: " + addRequest.Error.message); } } From 8176f7c07baf0780e8a587e70bb5cfc84e93493f Mon Sep 17 00:00:00 2001 From: Robin <1121080+rYuuk@users.noreply.github.com> Date: Mon, 8 May 2023 12:30:07 +0200 Subject: [PATCH 11/18] [SDK-140] Add setup guide window (#71) ## [SDK-140](https://ready-player-me.atlassian.net/browse/SDK-140) ## Dependencies ```Package Avatar Loader: feature/setup-wizard ``` ## Changes #### Added - Setup guide with panels for subdomain, avatar config and analytics - Helper class for layouts #### Updated - Move scripts and code to avatar loader - Extracted field for adding subdomain #### Removed - Analytics window - Quick panel window --- Editor/Resources.meta | 8 + Editor/Resources/rpm_logo.png | Bin 0 -> 7028 bytes Editor/Resources/rpm_logo.png.meta | 132 ++++++++++++++++ Editor/UI/Components/AnalyticsPanel.cs | 138 ----------------- Editor/UI/Components/AnalyticsPanel.cs.meta | 11 -- Editor/UI/Components/Banner.cs | 11 -- Editor/UI/Components/Footer.cs | 41 +++-- Editor/UI/Components/QuickStartPanel.cs | 134 ---------------- Editor/UI/Components/QuickStartPanel.cs.meta | 11 -- Editor/UI/Components/SubdomainField.cs | 146 ++++++++++++++++++ Editor/UI/Components/SubdomainField.cs.meta | 3 + Editor/UI/EditorWindows/EditorWindowBase.cs | 56 ++----- Editor/UI/EditorWindows/Layout.cs | 23 +++ Editor/UI/EditorWindows/Layout.cs.meta | 3 + Editor/UI/EditorWindows/WelcomeWindow.cs | 119 -------------- Editor/UI/EditorWindows/WelcomeWindow.cs.meta | 11 -- 16 files changed, 348 insertions(+), 499 deletions(-) create mode 100644 Editor/Resources.meta create mode 100644 Editor/Resources/rpm_logo.png create mode 100644 Editor/Resources/rpm_logo.png.meta delete mode 100644 Editor/UI/Components/AnalyticsPanel.cs delete mode 100644 Editor/UI/Components/AnalyticsPanel.cs.meta delete mode 100644 Editor/UI/Components/QuickStartPanel.cs delete mode 100644 Editor/UI/Components/QuickStartPanel.cs.meta create mode 100644 Editor/UI/Components/SubdomainField.cs create mode 100644 Editor/UI/Components/SubdomainField.cs.meta create mode 100644 Editor/UI/EditorWindows/Layout.cs create mode 100644 Editor/UI/EditorWindows/Layout.cs.meta delete mode 100644 Editor/UI/EditorWindows/WelcomeWindow.cs delete mode 100644 Editor/UI/EditorWindows/WelcomeWindow.cs.meta diff --git a/Editor/Resources.meta b/Editor/Resources.meta new file mode 100644 index 00000000..7c9c929a --- /dev/null +++ b/Editor/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 15d9bb0049cd8b245900c3f74fc99cb0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/Resources/rpm_logo.png b/Editor/Resources/rpm_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..b96a56d5ae24c2371abaf75713664ea6c51d9e5c GIT binary patch literal 7028 zcmZ8mc{EgS+`nVbKGq3YCc7|WL`1eBL)jzz?7Oi|~?obvc z+LLj9K9bg)yJKvB7XYBA0C15Tv?WlTPJ4Mi%gj=W=5D^if*03C zODQTRX$Nn-XRPl9~k)|3>Ub=Z~eFP zB!tnfjsLa{(ng7&&yJe#gK^`b%rCkpHTS=#%8I^z(#6_c9xq-YiyfXDy>;I5@~wmY zr(Z;?sv1;Wyl>f3Z>&-&>pJoZHQQ;=z`uW7_(XyT5FG-8`$B>sFOuzne9-Joq#gag z?A6ExI*Vs&uDB`wu0nd8p1vbmJDGhcMcjj=3~0$26bAbeTng&M01RemnAUy<>o~hR0qwpIo>gQ54^|=2-B8T|!?JjbA3=`qO z0;zgd#$P5UCr|0s>gc+Z0MR~Du3GBe)LFAk1%hF%@)I((*c&Bj;Uka2J(cEv1@x@*ykGiB}bU{2iPb+M7F? znAM3wCYi|Sz&t^&D;(Vc%I=JqC9R=WcvNed#u42=I=}>t&0AQFoR5sZwhF%ig3!NR;GTKn5ubO)rYq&f{#5Zk zJCKe7s)^>(B@>*(E}}1${&tSRwv74&*yV`Ic#lr0gvuhJ_bM0Mh3IMUr`7Jk%3K77vpvoH7H63e{%xn&LJ zG6KGPIfOjD)FSq;BTfku%@AJfQadrRuVuZov~=11jrWyo6cU*K$lA zwD)30xoCT6O;b;XNHIl)g-!@HwR_A~v2os~?K?-&APjt^9O%IP)qs`aquk4_4xGp# zgJ_>*mM&WyT!(RYNUrDf4biLsW(x8kMS$AG%O~5BVJe6?cqKPNZ0YERQ5FKX!H>LVSzPuyv=ZZxsS?SZ;6_I1p(vu$%&N(@Y6}L3 z|DGu76Vp3vvi&IKu+hx%vXF4;Jwn$xUi?Z5R;BYi-s&l&3BU(jy+l;B2*O)^^NLeI zs`4t1NDbh(jDSCr5^&0`&yf$U>SNNW>=y9e*~HCfh{%I-@?j!s3G_B1?VdGJnFmTN z{WQGwfUr0F{r)WE?)l8UIYq)=)(G6x?AMu`{%C?}BYB4#Z@|qkBvV3VO_{GGUMr)z z5o~ArLkf00-U{yy5XpTdUC(TkKrHdDV$f;7$%J)!-jVZiOZMi-ptL50FtKM*g;D`% zsg%!#wa%SdO{^-e{TI9S+(wQiey?LE*u?Khj(hf)XQcVtm#}OnIX~VQn*v^5-Z&z8 zUZ!m%b*To%Zf@{FA#7f8_%%C07r8^rXF<81P^Tk>awca`HBm+)hE^J*Wu&FIHzK7q z9#lM!Fy1>o|MgvjK+eYazku?&pg1jqxVf=z*z9eBtyB||J_F5YVG;;=xQ|UO?JFhvVtx*1DAA()3<5R9Xnj?wH)t;_c91mt+$I;2EER?ATSN$ zoyPRw_5n&8Tlr6BsUdBQ4{iz<&)G#fc3z;G(+|s+oVdB+BEgv8v=>!P(kJ9h{t>?-_}=HGD0QaK<@JH zX(z3t7fvG~uaPW8>=c!*j9~4M~ex03>vm1 zP#_2~u0=(SUfU})_-3BlsxIUz>VW^-q3(+h8zzD#(oxzk@zWH1^ff{ zO%#wwyI$=GCn{HOuIWfJA`2P*;KA`tz&#k6cQ6H{%u6e>?0OMmI55sHA&eXT#A&m3 zhXSzgl7KE!@OpH(9FzvphV~$pLJ$sqq%W?D>~ zgtGGW>N0Kv!S`eA#~CGy%wE`GktN8~F-@CcBO|N4v%Q^pT&l-l?w}Ghp)6c}FrFHlBfe zO*X(8WBL)i0w~HeKekUKVQgme&d9zDDtjEbqlDpQa1!NOM64YyT}eZvIIcyi7g!=S zEpa!Yntq|7Dqqi+=hG&1Ob@NW+Jmszl-TpPfnw%6Evu1ngO)Dxz?1qDkV*}}lkEt3 zjG8Hae{b;djfK{H;=a@z7b|P$hk4<-ri{khavO?GvXCopbi?Gb;UkXCnNJ1#p9KdK``F%dmV1 zTzho=J$qMeBRPWOWndkvjU3TeL07;U``f5ABkEwOWxH5>QbtWEHHrTIyD|?Nd?gQ( z{c4qe9EA1&K~wyOr}@r8k7W~xO)#i*m#Y9ljwHa+T<(UztYu6Q|;G*{VE2b zT#FD7Z&<;Yfi)0|LJA_&hNKDc@D&SaRL+YnwlcH72JtkUxhY4KHYil?NxXk9eo;0# z?;PUH7Olu}StSS;8OOIElL2Gjp~RdmfP4PYIsj0UC$?~IWZ2Wy$kpB$AKKBzO8;pb zAl>vXk|>GBu4xWY)Lv%AY37Xazi_VIA>f5<=LzG0nhM3pgH#BZ4LihXSJHtmd?3Xj z&JDiAn*{hw-bT9^A}c)Gj05PfPeQ_KVTbj3MMc-lc_gMG6iXnO4>!a!GCIP)Xd)NR zfauhN70tpZ2Wt?+!HX%f5y#?!jdz*yN$egsc)O_CR>dJs)a&hD)AvtFMKQT9JN+Qt*_pa;r#t2MP2RINi(34M;*0Ruk3E zXMAw0{(2jDvd`&68-UwdqIRfyC~78^w@z;wSdF-Uj^2eXyx0< zA2;Pcnj;TbJ?YR}6P&zku+WYDE%y;ZVer1D;uEgS5p7jzm9uRZg>$KV_k{ldek8WRTEg~d065Ids*YD*7N z%lDT{r%!P&mtG*Shwm14Y?6kZY~=WxS#b*G9Zb4BQrm(ZJ7S6V*+`ZFacVC+dv;~p zW>5PajzYzMik)ZpFu#VBRM4UZSB-e6jtNV7tNnHxF|$R3mln6nS*l&tm=|OZV=$Zi;~H7t{QS4P$1#-7r8* zvSiGd2N0d5Og$VvD4z;&{@D^)QaX^lpSlC)^OAfNgG$+}BzDX|?t(CO`wF~uy^w|w zvjlH~c4ppF0o)d-e2gt~(9{j$d=n|g*LazwPC{yCYd@#1uI|~Vm}f>|=0pTIkm0S1 zLnKs_1tUKzCe9Ks$h!0`&KTW3UP=S?t*t9*l2%YnP2=Hf=hQ95A}|X9Y7;~U z!d!V|Ywr7%qf^7Vp^^rJ+42#sMzWwp5*fu}xMcif3h}dLy8y7m!BOWv}C;&H=m{+X) znyUMpab0}OpSWjIIVK5CTl$YyQVE!VO_R#}(UM+!bg{tW@7q>4K-^BXprq!KGI_ zF&P&tf+3IJGt#8%J*d3aATI!;2oUx{*53PyY{-R4gMXr~6lTA*4{P}1hf6aM{j(Q4r+r5Yq22(`h%{oqD3 zz#m_mX~0<%4$p{U9^rz1xd^;()-gy4l>aUOjSA|-&N(*gmcpW$cEcB_E(x-OK7v9R z&y61Pbd^@{KXOZkcI+GHLaZ55Chu~_|T zSaBXqRC|Z5T(-&4b|g!} zyMvm!Hh%3LCj7Aaye}Rl0i$q9P{eLqsS2gefvQaut|Kc{?(V2o@KhA}bw zs&Ss~U%1OcsoLVB0iI3DU@PBmtuS^$Us^WrB#;gc9sFdPo^xLL7AKvjZA1WeHb%qaWa)F-C$kT0 z7HxZTo$ywPD^9HOi>KpNc0+tq*HJ1@+*#dl@7cNxB)yW?Dm7H{uk_{)NT?riG?EqI zF2E_PecBJbD@b&V+lLsuBo}I1SFJfO&Pd)8z&J9`o22S7b_g zBrXa9eheu}r*fv>Wm}Je&RS*HBajv)9ZzORzqRW5ln6i47QGxUB^MC)~%ajwu?}NY>o;Peo&J_C-qqsuL zSihu@6Pdgez$(8KEu2BOg$bf;xio{3@0D$e7ejKBX%1{A1;FHaH0wERJk?ECY!_>1 zUd;U2Bg@$J!Sz=UBb_Tj8=Lo3oxjvQHyFx}AK}$-We5a(C@uIVGP z{YD!&td|9RMKH)x9^q!~kC%G`0Gh|;lc9AWHIwepscPPvdqV4~_4J)2x6}-0A_3To ziU}^ac|NnWh5Q@s9UG*dCqrW$phe4bUay8xkDlfH7gaQ8u1;#B|3R^r(nprtQ`By_ z(TVq8eLT4Toe4nE?S5;#lu0_~glZZOySN0V?i}d=yYza(QZwMhz=x0So!K?bY^gRZ zo}?G>P*`bBC0Aaa;d>Y5yz8`K>W*Ye6q*C3LK*+~6bI0((!6LOyTkEb9uM2 z|8Xo(J7@Onp}-UH;U}6G-_3F;*N>8*OV?v$1!y*I6cFx4X#nP1_PRGWg#a#ITqPCI zVgq<`k@VNvx@PS57C1S{uE#gNBJ zKyPlJ_(?zrhk!Ib=SEIdBe{4p_644&(s3jls2TTW|#61Rv4-bhVT%E(_MK%nBBeap8X - /// - /// - private void LoadCachedVariables() - { - neverAskAgain = ProjectPrefs.GetBool(WelcomeWindow.NeverAskAgainPref); - variablesLoaded = true; - } - - /// - /// Sets the EditorWindow styles. - /// - private void LoadStyles() - { - HeadingStyle ??= new GUIStyle - { - fontSize = 14, - richText = true, - fontStyle = FontStyle.Bold, - margin = new RectOffset(5, 0, 0, 8), - normal = - { - textColor = Color.white - } - }; - - descriptionStyle ??= new GUIStyle(GUI.skin.label) - { - fontSize = 12, - richText = true, - wordWrap = true, - fixedWidth = 450, - normal = - { - textColor = new Color(0.7f, 0.7f, 0.7f, 1.0f) - } - }; - - buttonStyle ??= new GUIStyle(GUI.skin.button) - { - fontStyle = FontStyle.Bold, - fontSize = BUTTON_FONT_SIZE, - padding = new RectOffset(5, 5, 5, 5), - fixedHeight = 30, - fixedWidth = 225 - }; - } - - - public void Draw(Rect position = new Rect()) - { - if (!variablesLoaded) LoadCachedVariables(); - LoadStyles(); - EditorGUILayout.BeginVertical("Box"); - GUILayout.Label(HEADING, HeadingStyle); - - GUILayout.Space(10); - GUILayout.Label(DESCRIPTION, descriptionStyle); - - GUILayout.Space(10); - if (GUILayout.Button(ANALYTICS_PRIVACY_TEXT, descriptionStyle)) - { - Application.OpenURL(ANALYTICS_PRIVACY_URL); - } - - EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link); - - GUILayout.Space(10); - EditorGUILayout.BeginHorizontal(); - GUILayout.Space(4); - neverAskAgain = EditorGUILayout.Toggle(neverAskAgain, toggleWidth); - GUILayout.Label(NEVER_ASK_AGAIN); - GUILayout.FlexibleSpace(); - - ProjectPrefs.SetBool(WelcomeWindow.NeverAskAgainPref, neverAskAgain); - EditorGUILayout.EndHorizontal(); - - GUILayout.Space(10); - EditorGUILayout.EndVertical(); - - EditorGUILayout.BeginHorizontal(); - GUILayout.Space(3); - if (GUILayout.Button(DONT_ENABLE_ANALYTICS, buttonStyle)) - { - ProjectPrefs.SetBool(WelcomeWindow.NeverAskAgainPref, neverAskAgain); - AnalyticsEditorLogger.Disable(); - OnButtonClick?.Invoke(); - } - if (GUILayout.Button(ENABLE_ANALYTICS, buttonStyle)) - { - ProjectPrefs.SetBool(WelcomeWindow.NeverAskAgainPref, true); - AnalyticsEditorLogger.Enable(); - OnButtonClick?.Invoke(); - } - EditorGUILayout.EndHorizontal(); - } - } -} diff --git a/Editor/UI/Components/AnalyticsPanel.cs.meta b/Editor/UI/Components/AnalyticsPanel.cs.meta deleted file mode 100644 index 8f36fbd6..00000000 --- a/Editor/UI/Components/AnalyticsPanel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e5b924e8b1613594da31873c0965d5e3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor/UI/Components/Banner.cs b/Editor/UI/Components/Banner.cs index b89955e6..5525e490 100644 --- a/Editor/UI/Components/Banner.cs +++ b/Editor/UI/Components/Banner.cs @@ -9,31 +9,21 @@ namespace ReadyPlayerMe.Core.Editor /// public class Banner : IEditorWindowComponent { - private const int FONT_SIZE = 14; - private const int BANNER_WIDTH = 460; private const int BANNER_HEIGHT = 123; private const string BANNER_SEARCH_FILTER = "t:Texture rpm_editor_window_banner"; private readonly Texture2D banner; - private readonly GUIStyle versionTextStyle; public Banner() { - var assetGuid = AssetDatabase.FindAssets(BANNER_SEARCH_FILTER).FirstOrDefault(); var assetPath = AssetDatabase.GUIDToAssetPath(assetGuid); if (assetPath != null) { banner = AssetDatabase.LoadAssetAtPath(assetPath); - versionTextStyle = new GUIStyle(); - versionTextStyle.fontSize = FONT_SIZE; - versionTextStyle.richText = true; - versionTextStyle.fontStyle = FontStyle.Bold; - versionTextStyle.normal.textColor = Color.white; - versionTextStyle.alignment = TextAnchor.UpperRight; } } @@ -41,7 +31,6 @@ public void Draw(Rect position) { var rect = new Rect((position.size.x - BANNER_WIDTH) / 2, 0, BANNER_WIDTH, BANNER_HEIGHT); GUI.DrawTexture(rect, banner); - GUILayout.Space(128); } } diff --git a/Editor/UI/Components/Footer.cs b/Editor/UI/Components/Footer.cs index 20499aab..f5ee5f0a 100644 --- a/Editor/UI/Components/Footer.cs +++ b/Editor/UI/Components/Footer.cs @@ -17,7 +17,7 @@ public class Footer : IEditorWindowComponent private readonly GUIStyle webButtonStyle; - private string editorWindowName; + private readonly string editorWindowName; public Footer(string editorWindowName) { @@ -31,27 +31,26 @@ public Footer(string editorWindowName) public void Draw(Rect position = new Rect()) { - EditorGUILayout.BeginHorizontal(); - - if (GUILayout.Button("Documentation", webButtonStyle)) - { - AnalyticsEditorLogger.EventLogger.LogOpenDocumentation(editorWindowName); - Application.OpenURL(DOCS_URL); - } - - if (GUILayout.Button("FAQ", webButtonStyle)) + Layout.Horizontal(() => { - AnalyticsEditorLogger.EventLogger.LogOpenFaq(editorWindowName); - Application.OpenURL(FAQ_URL); - } - - if (GUILayout.Button("Discord", webButtonStyle)) - { - AnalyticsEditorLogger.EventLogger.LogOpenDiscord(editorWindowName); - Application.OpenURL(DISCORD_URL); - } - - EditorGUILayout.EndHorizontal(); + if (GUILayout.Button("Documentation", webButtonStyle)) + { + AnalyticsEditorLogger.EventLogger.LogOpenDocumentation(editorWindowName); + Application.OpenURL(DOCS_URL); + } + + if (GUILayout.Button("FAQ", webButtonStyle)) + { + AnalyticsEditorLogger.EventLogger.LogOpenFaq(editorWindowName); + Application.OpenURL(FAQ_URL); + } + + if (GUILayout.Button("Discord", webButtonStyle)) + { + AnalyticsEditorLogger.EventLogger.LogOpenDiscord(editorWindowName); + Application.OpenURL(DISCORD_URL); + } + }); } } } diff --git a/Editor/UI/Components/QuickStartPanel.cs b/Editor/UI/Components/QuickStartPanel.cs deleted file mode 100644 index c5dd3ff1..00000000 --- a/Editor/UI/Components/QuickStartPanel.cs +++ /dev/null @@ -1,134 +0,0 @@ -using System.Linq; -using System.Threading; -using UnityEditor; -using UnityEditor.PackageManager.UI; -using UnityEditor.SceneManagement; -using UnityEngine; -using UnityEngine.Events; - -namespace ReadyPlayerMe.Core.Editor -{ - public class QuickStartPanel : IEditorWindowComponent - { - - private const string HEADING = "New to Ready Player Me? "; - private const string DESCRIPTION = "Get started with the QuickStart sample."; - private static bool neverAskAgain; - - private bool variablesLoaded; - - private GUIStyle buttonStyle; - private GUIStyle descriptionStyle; - private GUIStyle headingStyle; - - public readonly UnityEvent OnQuickStartClick = new UnityEvent(); - public readonly UnityEvent OnCloseClick = new UnityEvent(); - - private const string LOADER_PACKAGE = "com.readyplayerme.avatarloader"; - private const string QUICKSTART_SAMPLE_NAME = "QuickStart"; - - private void LoadStyles() - { - buttonStyle ??= new GUIStyle(GUI.skin.button) - { - fontSize = 12, - fixedWidth = 225, - fixedHeight = 30f, - padding = new RectOffset(5, 5, 5, 5), - fontStyle = FontStyle.Bold - }; - - descriptionStyle ??= new GUIStyle(GUI.skin.label) - { - fontSize = 14, - richText = true, - fontStyle = FontStyle.Bold, - wordWrap = true, - fixedWidth = 450, - normal = - { - - textColor = new Color(0.7f, 0.7f, 0.7f, 1.0f) - }, - alignment = TextAnchor.MiddleCenter - }; - - headingStyle ??= new GUIStyle(GUI.skin.label) - { - fontSize = 16, - richText = true, - fontStyle = FontStyle.Bold, - wordWrap = true, - fixedWidth = 450, - normal = - { - textColor = Color.white - }, - alignment = TextAnchor.MiddleCenter - }; - } - - public void Draw(Rect position = new Rect()) - { - LoadStyles(); - EditorGUILayout.BeginVertical("Box"); - GUILayout.Space(10); - - EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); - GUILayout.FlexibleSpace(); - GUILayout.Label(HEADING, headingStyle); - GUILayout.FlexibleSpace(); - EditorGUILayout.EndHorizontal(); - - GUILayout.Space(8); - - EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); - GUILayout.FlexibleSpace(); - GUILayout.Label(DESCRIPTION, descriptionStyle); - GUILayout.FlexibleSpace(); - EditorGUILayout.EndHorizontal(); - - GUILayout.Space(20); - EditorGUILayout.EndVertical(); - - EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); - GUILayout.FlexibleSpace(); - if (GUILayout.Button("Close", buttonStyle)) - { - OnCloseClick?.Invoke(); - } - if (GUILayout.Button(QUICKSTART_SAMPLE_NAME, buttonStyle)) - { - Sample quickStartSample = GetQuickStartSample(); - if (!quickStartSample.isImported) - { - ImportAndOpenSample(quickStartSample); - } - OnQuickStartClick?.Invoke(); - } - GUILayout.FlexibleSpace(); - EditorGUILayout.EndHorizontal(); - GUILayout.Space(8); - } - - private Sample GetQuickStartSample() - { - Sample[] samples = Sample.FindByPackage(LOADER_PACKAGE, null).ToArray(); - Sample quickStartSample = samples.First(x => x.displayName == QUICKSTART_SAMPLE_NAME); - return quickStartSample; - } - - private void ImportAndOpenSample(Sample quickStartSample) - { - quickStartSample.Import(); - while (!quickStartSample.isImported) - Thread.Sleep(1); - OpenQuickStartScene(quickStartSample.importPath); - } - - private void OpenQuickStartScene(string importPath) - { - EditorSceneManager.OpenScene($"{importPath}/{QUICKSTART_SAMPLE_NAME}.unity"); - } - } -} diff --git a/Editor/UI/Components/QuickStartPanel.cs.meta b/Editor/UI/Components/QuickStartPanel.cs.meta deleted file mode 100644 index c54c078a..00000000 --- a/Editor/UI/Components/QuickStartPanel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a18cc655bd80acf4db55549f1dd30bd1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor/UI/Components/SubdomainField.cs b/Editor/UI/Components/SubdomainField.cs new file mode 100644 index 00000000..0ed31093 --- /dev/null +++ b/Editor/UI/Components/SubdomainField.cs @@ -0,0 +1,146 @@ +using System.Linq; +using ReadyPlayerMe.Core.Analytics; +using UnityEditor; +using UnityEngine; + +namespace ReadyPlayerMe.Core.Editor +{ + public class SubdomainField + { + private const string SUBDOMAIN_FIELD_CONTROL_NAME = "subdomain"; + private const string SUBDOMAIN_DOCS_LINK = "https://docs.readyplayer.me/ready-player-me/for-partners/partner-subdomains"; + private const string WEB_VIEW_PARTNER_SAVE_KEY = "WebViewPartnerSubdomainName"; + private const string ERROR_ICON_SEARCH_FILTER = "t:Texture rpm_error_icon"; + private const string DOMAIN_VALIDATION_ERROR = "Please enter a valid partner subdomain (e.g. demo). Click here to read more about this issue."; + private const int FONT_SIZE = 12; + private const int ERROR_BUTTON_SIZE = 20; + + private string partnerSubdomain; + private bool subdomainFocused; + private string subdomainAfterFocus = string.Empty; + + public string PartnerSubdomain => partnerSubdomain; + + private GUIStyle textLabelStyle; + private GUIStyle textFieldStyle; + private GUIStyle errorButtonStyle; + + private Texture errorIcon; + + public SubdomainField() + { + partnerSubdomain = CoreSettingsHandler.CoreSettings.Subdomain; + SaveSubdomain(); + LoadAssets(); + } + + public void SetSubdomain(string subdomain) + { + if (partnerSubdomain != subdomain) + { + partnerSubdomain = subdomain; + SaveSubdomain(); + } + } + + public void Draw() + { + LoadStyles(); + + Layout.Horizontal(() => + { + EditorGUILayout.LabelField("Your subdomain: https:// ", textLabelStyle, GUILayout.Width(176)); + var oldValue = partnerSubdomain; + GUI.SetNextControlName(SUBDOMAIN_FIELD_CONTROL_NAME); + partnerSubdomain = EditorGUILayout.TextField(oldValue, textFieldStyle, GUILayout.Width(128), GUILayout.Height(20)); + + EditorGUILayout.LabelField(".readyplayer.me", textLabelStyle, GUILayout.Width(100), GUILayout.Height(20)); + var button = new GUIContent(errorIcon, DOMAIN_VALIDATION_ERROR); + + var isSubdomainValid = ValidateSubdomain(); + + if (!isSubdomainValid) + { + if (GUILayout.Button(button, errorButtonStyle)) + { + Application.OpenURL(SUBDOMAIN_DOCS_LINK); + } + + EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link); + } + + if (IsSubdomainFocusLost()) + { + SaveSubdomain(); + } + }); + } + + private void LoadAssets() + { + if (errorIcon == null) + { + var assetGuid = AssetDatabase.FindAssets(ERROR_ICON_SEARCH_FILTER).FirstOrDefault(); + var assetPath = AssetDatabase.GUIDToAssetPath(assetGuid); + + if (assetPath != null) + { + errorIcon = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Texture)) as Texture; + } + } + } + + private void LoadStyles() + { + textFieldStyle ??= new GUIStyle(GUI.skin.textField); + textFieldStyle.fontSize = FONT_SIZE; + + textLabelStyle ??= new GUIStyle(GUI.skin.label); + textLabelStyle.fontStyle = FontStyle.Bold; + textLabelStyle.fontSize = FONT_SIZE; + + errorButtonStyle ??= new GUIStyle(); + errorButtonStyle.fixedWidth = ERROR_BUTTON_SIZE; + errorButtonStyle.fixedHeight = ERROR_BUTTON_SIZE; + errorButtonStyle.margin = new RectOffset(0, 0, 2, 2); + } + + private bool ValidateSubdomain() + { + return !partnerSubdomain.All(char.IsWhiteSpace) && !partnerSubdomain.Contains('/') && !EditorUtilities.IsUrlShortcodeValid(partnerSubdomain); + } + + private bool IsSubdomainFocusLost() + { + // focus changed from subdomain to another item + if (GUI.GetNameOfFocusedControl() == string.Empty && subdomainFocused) + { + subdomainFocused = false; + + if (subdomainAfterFocus != partnerSubdomain) + { + return true; + } + } + if (GUI.GetNameOfFocusedControl() == SUBDOMAIN_FIELD_CONTROL_NAME && !subdomainFocused) + { + subdomainFocused = true; + subdomainAfterFocus = partnerSubdomain; + } + + return false; + } + + private void SaveSubdomain() + { + EditorPrefs.SetString(WEB_VIEW_PARTNER_SAVE_KEY, partnerSubdomain); + var subDomain = CoreSettingsHandler.CoreSettings.Subdomain; + if (subDomain != partnerSubdomain) + { + AnalyticsEditorLogger.EventLogger.LogUpdatePartnerURL(subDomain, partnerSubdomain); + } + + CoreSettingsHandler.SaveSubDomain(partnerSubdomain); + } + } +} diff --git a/Editor/UI/Components/SubdomainField.cs.meta b/Editor/UI/Components/SubdomainField.cs.meta new file mode 100644 index 00000000..5e3c3024 --- /dev/null +++ b/Editor/UI/Components/SubdomainField.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4a1c78c4221c44faaa18558011062dad +timeCreated: 1683195566 \ No newline at end of file diff --git a/Editor/UI/EditorWindows/EditorWindowBase.cs b/Editor/UI/EditorWindows/EditorWindowBase.cs index db8e95b0..9203f49e 100644 --- a/Editor/UI/EditorWindows/EditorWindowBase.cs +++ b/Editor/UI/EditorWindows/EditorWindowBase.cs @@ -13,22 +13,24 @@ public class EditorWindowBase : EditorWindow { private const string SUPPORT_HEADING = "Support"; private const string ERROR_ICON_SEARCH_FILTER = "t:Texture rpm_error_icon"; + private const float WIDTH = 460; + private readonly GUILayoutOption windowWidth = GUILayout.Width(WIDTH); + private readonly Color descriptionColor = new Color(0.7f, 0.7f, 0.7f, 1.0f); + protected readonly float ButtonHeight = 30f; + protected GUIStyle HeadingStyle; protected GUIStyle DescriptionStyle; - protected Texture errorIcon; + protected Texture ErrorIcon; private GUIStyle webButtonStyle; - protected const float WIDTH = 460; - private readonly GUILayoutOption windowWidth = GUILayout.Width(WIDTH); - protected readonly float ButtonHeight = 30f; + private Banner banner; private Footer footer; private string editorWindowName; private bool windowResized; - private readonly Color descriptionColor = new Color(0.7f, 0.7f, 0.7f, 1.0f); private void LoadAssets() { @@ -36,14 +38,14 @@ private void LoadAssets() footer ??= new Footer(editorWindowName); - if (errorIcon == null) + if (ErrorIcon == null) { var assetGuid = AssetDatabase.FindAssets(ERROR_ICON_SEARCH_FILTER).FirstOrDefault(); var assetPath = AssetDatabase.GUIDToAssetPath(assetGuid); if (assetPath != null) { - errorIcon = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Texture)) as Texture; + ErrorIcon = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Texture)) as Texture; } } @@ -89,22 +91,22 @@ protected void DrawContent(Action content, bool useFooter = true) { LoadAssets(); - Horizontal(() => + Layout.Horizontal(() => { GUILayout.FlexibleSpace(); - Vertical(() => + Layout.Vertical(() => { banner.Draw(position); content?.Invoke(); if (useFooter) { - Vertical(() => + Layout.Vertical(() => { GUILayout.Label(SUPPORT_HEADING, HeadingStyle); footer.Draw(); }, true); } - }, windowWidth); + }, false, windowWidth); GUILayout.FlexibleSpace(); }); @@ -120,37 +122,5 @@ private void SetWindowSize() windowResized = true; } } - - #region Horizontal and Vertical Layouts - - protected void Vertical(Action content, bool isBox = false) - { - EditorGUILayout.BeginVertical(isBox ? "Box" : GUIStyle.none); - content?.Invoke(); - EditorGUILayout.EndVertical(); - } - - protected void Vertical(Action content, params GUILayoutOption[] options) - { - EditorGUILayout.BeginVertical(options); - content?.Invoke(); - EditorGUILayout.EndVertical(); - } - - protected void Horizontal(Action content, bool isBox = false) - { - EditorGUILayout.BeginHorizontal(isBox ? "Box" : GUIStyle.none); - content?.Invoke(); - EditorGUILayout.EndHorizontal(); - } - - protected void Horizontal(Action content, params GUILayoutOption[] options) - { - EditorGUILayout.BeginHorizontal(options); - content?.Invoke(); - EditorGUILayout.EndHorizontal(); - } - - #endregion } } diff --git a/Editor/UI/EditorWindows/Layout.cs b/Editor/UI/EditorWindows/Layout.cs new file mode 100644 index 00000000..26dce7ca --- /dev/null +++ b/Editor/UI/EditorWindows/Layout.cs @@ -0,0 +1,23 @@ +using System; +using UnityEditor; +using UnityEngine; + +namespace ReadyPlayerMe.Core.Editor +{ + public static class Layout + { + public static void Vertical(Action content, bool isBox = false, params GUILayoutOption[] options) + { + EditorGUILayout.BeginVertical(isBox ? GUI.skin.box : GUIStyle.none,options); + content?.Invoke(); + EditorGUILayout.EndVertical(); + } + + public static void Horizontal(Action content, bool isBox = false,params GUILayoutOption[] options) + { + EditorGUILayout.BeginHorizontal(isBox ? GUI.skin.box : GUIStyle.none, options); + content?.Invoke(); + EditorGUILayout.EndHorizontal(); + } + } +} diff --git a/Editor/UI/EditorWindows/Layout.cs.meta b/Editor/UI/EditorWindows/Layout.cs.meta new file mode 100644 index 00000000..e532f404 --- /dev/null +++ b/Editor/UI/EditorWindows/Layout.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f4bdd7cf76b9422f910748d0835c64d3 +timeCreated: 1683112601 \ No newline at end of file diff --git a/Editor/UI/EditorWindows/WelcomeWindow.cs b/Editor/UI/EditorWindows/WelcomeWindow.cs deleted file mode 100644 index 4fec1b39..00000000 --- a/Editor/UI/EditorWindows/WelcomeWindow.cs +++ /dev/null @@ -1,119 +0,0 @@ -using ReadyPlayerMe.Core.Analytics; -using UnityEditor; -using UnityEngine; - -namespace ReadyPlayerMe.Core.Editor -{ - [InitializeOnLoad] - public class WelcomeWindow : EditorWindowBase - { - private const string WINDOW_NAME = "Welcome"; - private Banner banner; - private GUIStyle buttonStyle; - private GUIStyle descriptionStyle; - private GUIStyle headingStyle; - private AnalyticsPanel analyticsPanel; - private QuickStartPanel quickStartPanel; - private bool displayQuickStart; - - public static readonly string NeverAskAgainPref = "rpm-sdk-metrics-never-ask-again"; - - /// - /// Constructor method that subscribes to the StartUp event. - /// - static WelcomeWindow() - { - EntryPoint.Startup += OnStartup; - } - - /// - /// This method is called when Unity Editor is closed or this package is removed. - /// - private void OnDestroy() - { - EntryPoint.Startup -= OnStartup; - } - - /// - /// This method is called when a Unity project is opened or after this Unity package has finished importing and is - /// responsible for displaying the window. It also calls analytics events if enabled. - /// - private static void OnStartup() - { - if (CanShowWindow()) - { - ShowWindow(); - } - - if (AnalyticsEditorLogger.IsEnabled) - { - AnalyticsEditorLogger.EventLogger.LogOpenProject(); - AnalyticsEditorLogger.EventLogger.IdentifyUser(); - EditorApplication.quitting += OnQuit; - } - } - - private static bool CanShowWindow() - { - return !ProjectPrefs.GetBool(NeverAskAgainPref); - } - - /// - /// This method is called when the Unity Editor is closed and logs the close event. - /// - private static void OnQuit() - { - AnalyticsEditorLogger.EventLogger.LogCloseProject(); - } - - public static void ShowWindow() - { - GetWindow(typeof(WelcomeWindow), false, WINDOW_NAME); - } - - /// - /// This method the panels and banner if not set already and sets the button event listeners - /// - private void LoadPanels() - { - if (analyticsPanel == null) - { - analyticsPanel = new AnalyticsPanel(WINDOW_NAME); - analyticsPanel.OnButtonClick.AddListener(() => - { - displayQuickStart = true; - // resize for quick start panel - minSize = maxSize = new Vector2(460, 248); - }); - } - banner ??= new Banner(); - if (quickStartPanel == null) - { - quickStartPanel = new QuickStartPanel(); - quickStartPanel.OnQuickStartClick.AddListener(Close); - quickStartPanel.OnCloseClick.AddListener(Close); - } - } - - private void OnGUI() - { - LoadPanels(); - DrawContent(DrawContent, false); - } - - private void DrawContent() - { - Vertical(() => - { - if (displayQuickStart) - { - quickStartPanel.Draw(position); - } - else - { - analyticsPanel.Draw(position); - } - }); - } - } -} diff --git a/Editor/UI/EditorWindows/WelcomeWindow.cs.meta b/Editor/UI/EditorWindows/WelcomeWindow.cs.meta deleted file mode 100644 index 00bae61d..00000000 --- a/Editor/UI/EditorWindows/WelcomeWindow.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 70817fe9582bddd4dbb1adc761fda887 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: From e499083d1acdb06bfb1495c16af427dd081af092 Mon Sep 17 00:00:00 2001 From: Robin <1121080+rYuuk@users.noreply.github.com> Date: Thu, 11 May 2023 12:56:30 +0200 Subject: [PATCH 12/18] [SDK-141] Documentation UI improvements (#73) ## [SDK-141](https://ready-player-me.atlassian.net/browse/SDK-141) ## Changes #### Added - Documentation button class - Documentation link for subdomain field - Header class from avatar loader #### Removed - Redundant banner class --- Editor/UI/Components/Banner.cs | 37 ---------------- Editor/UI/Components/Banner.cs.meta | 3 -- Editor/UI/Components/DocumentationButton.cs | 29 +++++++++++++ .../UI/Components/DocumentationButton.cs.meta | 3 ++ Editor/UI/Components/Footer.cs | 4 +- Editor/UI/Components/Header.cs | 42 ++++++++++++++++++ Editor/UI/Components/Header.cs.meta | 3 ++ Editor/UI/Components/SubdomainField.cs | 10 +++-- Editor/UI/EditorWindows/EditorWindowBase.cs | 43 ++++--------------- Editor/Utils/EditorUtilities.cs | 8 ++-- 10 files changed, 100 insertions(+), 82 deletions(-) delete mode 100644 Editor/UI/Components/Banner.cs delete mode 100644 Editor/UI/Components/Banner.cs.meta create mode 100644 Editor/UI/Components/DocumentationButton.cs create mode 100644 Editor/UI/Components/DocumentationButton.cs.meta create mode 100644 Editor/UI/Components/Header.cs create mode 100644 Editor/UI/Components/Header.cs.meta diff --git a/Editor/UI/Components/Banner.cs b/Editor/UI/Components/Banner.cs deleted file mode 100644 index 5525e490..00000000 --- a/Editor/UI/Components/Banner.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.Linq; -using UnityEditor; -using UnityEngine; - -namespace ReadyPlayerMe.Core.Editor -{ - /// - /// Banner for RPM editor windows. Contains a image and version of the SDK. - /// - public class Banner : IEditorWindowComponent - { - private const int BANNER_WIDTH = 460; - private const int BANNER_HEIGHT = 123; - - private const string BANNER_SEARCH_FILTER = "t:Texture rpm_editor_window_banner"; - - private readonly Texture2D banner; - - public Banner() - { - var assetGuid = AssetDatabase.FindAssets(BANNER_SEARCH_FILTER).FirstOrDefault(); - var assetPath = AssetDatabase.GUIDToAssetPath(assetGuid); - - if (assetPath != null) - { - banner = AssetDatabase.LoadAssetAtPath(assetPath); - } - } - - public void Draw(Rect position) - { - var rect = new Rect((position.size.x - BANNER_WIDTH) / 2, 0, BANNER_WIDTH, BANNER_HEIGHT); - GUI.DrawTexture(rect, banner); - GUILayout.Space(128); - } - } -} diff --git a/Editor/UI/Components/Banner.cs.meta b/Editor/UI/Components/Banner.cs.meta deleted file mode 100644 index f8154f93..00000000 --- a/Editor/UI/Components/Banner.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 7deb47a619ad4a448950e51f448a2a5d -timeCreated: 1656504862 \ No newline at end of file diff --git a/Editor/UI/Components/DocumentationButton.cs b/Editor/UI/Components/DocumentationButton.cs new file mode 100644 index 00000000..75c7f270 --- /dev/null +++ b/Editor/UI/Components/DocumentationButton.cs @@ -0,0 +1,29 @@ +using UnityEditor; +using UnityEngine; + +namespace ReadyPlayerMe.Core.Editor +{ + public static class DocumentationButton + { + private static readonly GUIStyle Style = new GUIStyle(GUI.skin.button) + { + fontSize = 14, + fixedHeight = 18, + fixedWidth = 18, + margin = new RectOffset(2, 0, 0, 8), + normal = + { + textColor = new Color(0.7f, 0.7f, 0.7f, 1.0f) + } + }; + + public static void Draw(string url) + { + if (GUILayout.Button("?", Style)) + { + Application.OpenURL(url); + } + EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link); + } + } +} diff --git a/Editor/UI/Components/DocumentationButton.cs.meta b/Editor/UI/Components/DocumentationButton.cs.meta new file mode 100644 index 00000000..cc463c3a --- /dev/null +++ b/Editor/UI/Components/DocumentationButton.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1f3b436c7c464aba82fcc2bf7f92c1dc +timeCreated: 1683566061 \ No newline at end of file diff --git a/Editor/UI/Components/Footer.cs b/Editor/UI/Components/Footer.cs index f5ee5f0a..d4774c01 100644 --- a/Editor/UI/Components/Footer.cs +++ b/Editor/UI/Components/Footer.cs @@ -24,15 +24,15 @@ public Footer(string editorWindowName) this.editorWindowName = editorWindowName; webButtonStyle = new GUIStyle(GUI.skin.button); webButtonStyle.fontSize = 12; - webButtonStyle.fixedWidth = 149; + webButtonStyle.fixedWidth = 142; webButtonStyle.fixedHeight = BUTTON_HEIGHT; - webButtonStyle.padding = new RectOffset(5, 5, 5, 5); } public void Draw(Rect position = new Rect()) { Layout.Horizontal(() => { + GUILayout.Space(15); if (GUILayout.Button("Documentation", webButtonStyle)) { AnalyticsEditorLogger.EventLogger.LogOpenDocumentation(editorWindowName); diff --git a/Editor/UI/Components/Header.cs b/Editor/UI/Components/Header.cs new file mode 100644 index 00000000..f15ca640 --- /dev/null +++ b/Editor/UI/Components/Header.cs @@ -0,0 +1,42 @@ +using UnityEditor; +using UnityEngine; + +namespace ReadyPlayerMe.Core.Editor +{ + public class Header : IEditorWindowComponent + { + private readonly string heading; + private const int WIDTH = 460; + private const int HEIGHT = 100; + private const int FONT_SIZE = 20; + + private readonly Texture2D logo; + private readonly GUIStyle textStyle; + + public Header(string heading) + { + this.heading = heading; + logo = Resources.Load("rpm_logo"); + textStyle = new GUIStyle(); + textStyle.fontSize = FONT_SIZE; + textStyle.richText = true; + textStyle.fontStyle = FontStyle.Bold; + textStyle.normal.textColor = Color.white; + textStyle.alignment = TextAnchor.MiddleLeft; + } + + public void Draw(Rect position) + { + var startPos = new Vector2((position.size.x - WIDTH) / 2, 0); + + var rect = new Rect(startPos.x, startPos.y, WIDTH, HEIGHT); + EditorGUI.DrawRect(rect, Color.black); + + var versionText = new Rect(startPos.x + 15, startPos.y + 35, 40, 40); + EditorGUI.LabelField(versionText, heading, textStyle); + + GUI.DrawTexture(new Rect(startPos.x + WIDTH - 100, startPos.y + 35, 80, 40), logo); + GUILayout.Space(HEIGHT + 20); + } + } +} diff --git a/Editor/UI/Components/Header.cs.meta b/Editor/UI/Components/Header.cs.meta new file mode 100644 index 00000000..797395a9 --- /dev/null +++ b/Editor/UI/Components/Header.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 879e70ffe63d44f28ca5699dbfe04735 +timeCreated: 1683116823 \ No newline at end of file diff --git a/Editor/UI/Components/SubdomainField.cs b/Editor/UI/Components/SubdomainField.cs index 0ed31093..cf5c2613 100644 --- a/Editor/UI/Components/SubdomainField.cs +++ b/Editor/UI/Components/SubdomainField.cs @@ -8,7 +8,8 @@ namespace ReadyPlayerMe.Core.Editor public class SubdomainField { private const string SUBDOMAIN_FIELD_CONTROL_NAME = "subdomain"; - private const string SUBDOMAIN_DOCS_LINK = "https://docs.readyplayer.me/ready-player-me/for-partners/partner-subdomains"; + private const string PARTNERS_DOCS_LINK = "https://docs.readyplayer.me/ready-player-me/for-partners/partner-subdomains"; + private const string QUICKSTART_DOCS_LINK = "https://docs.readyplayer.me/ready-player-me/integration-guides/unity/quickstart#before-you-begin"; private const string WEB_VIEW_PARTNER_SAVE_KEY = "WebViewPartnerSubdomainName"; private const string ERROR_ICON_SEARCH_FILTER = "t:Texture rpm_error_icon"; private const string DOMAIN_VALIDATION_ERROR = "Please enter a valid partner subdomain (e.g. demo). Click here to read more about this issue."; @@ -49,7 +50,10 @@ public void Draw() Layout.Horizontal(() => { - EditorGUILayout.LabelField("Your subdomain: https:// ", textLabelStyle, GUILayout.Width(176)); + GUILayout.Space(15); + EditorGUILayout.LabelField("Your subdomain:",GUILayout.Width(95)); + DocumentationButton.Draw(QUICKSTART_DOCS_LINK); + EditorGUILayout.LabelField(" https://", textLabelStyle, GUILayout.Width(60)); var oldValue = partnerSubdomain; GUI.SetNextControlName(SUBDOMAIN_FIELD_CONTROL_NAME); partnerSubdomain = EditorGUILayout.TextField(oldValue, textFieldStyle, GUILayout.Width(128), GUILayout.Height(20)); @@ -63,7 +67,7 @@ public void Draw() { if (GUILayout.Button(button, errorButtonStyle)) { - Application.OpenURL(SUBDOMAIN_DOCS_LINK); + Application.OpenURL(PARTNERS_DOCS_LINK); } EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link); diff --git a/Editor/UI/EditorWindows/EditorWindowBase.cs b/Editor/UI/EditorWindows/EditorWindowBase.cs index 9203f49e..b0026f58 100644 --- a/Editor/UI/EditorWindows/EditorWindowBase.cs +++ b/Editor/UI/EditorWindows/EditorWindowBase.cs @@ -1,5 +1,4 @@ using System; -using System.Linq; using UnityEditor; using UnityEngine; @@ -12,67 +11,40 @@ namespace ReadyPlayerMe.Core.Editor public class EditorWindowBase : EditorWindow { private const string SUPPORT_HEADING = "Support"; - private const string ERROR_ICON_SEARCH_FILTER = "t:Texture rpm_error_icon"; private const float WIDTH = 460; private readonly GUILayoutOption windowWidth = GUILayout.Width(WIDTH); - private readonly Color descriptionColor = new Color(0.7f, 0.7f, 0.7f, 1.0f); protected readonly float ButtonHeight = 30f; protected GUIStyle HeadingStyle; - protected GUIStyle DescriptionStyle; - - protected Texture ErrorIcon; private GUIStyle webButtonStyle; - private Banner banner; + private Header header; private Footer footer; private string editorWindowName; private bool windowResized; + private string heading; private void LoadAssets() { - banner ??= new Banner(); + header ??= new Header(heading); footer ??= new Footer(editorWindowName); - if (ErrorIcon == null) - { - var assetGuid = AssetDatabase.FindAssets(ERROR_ICON_SEARCH_FILTER).FirstOrDefault(); - var assetPath = AssetDatabase.GUIDToAssetPath(assetGuid); - - if (assetPath != null) - { - ErrorIcon = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Texture)) as Texture; - } - } - HeadingStyle ??= new GUIStyle { fontSize = 14, richText = true, fontStyle = FontStyle.Bold, - margin = new RectOffset(5, 0, 0, 8), + margin = new RectOffset(15, 0, 0, 8), normal = { textColor = Color.white } }; - DescriptionStyle ??= new GUIStyle - { - fontSize = 12, - richText = true, - wordWrap = true, - margin = new RectOffset(5, 0, 0, 0), - normal = - { - textColor = descriptionColor - } - }; - webButtonStyle ??= new GUIStyle(GUI.skin.button) { fontSize = 12, @@ -82,9 +54,11 @@ private void LoadAssets() }; } - protected void SetEditorWindowName(string editorName) + protected void SetEditorWindowName(string editorName, string headingText) { + heading = headingText; editorWindowName = editorName; + } protected void DrawContent(Action content, bool useFooter = true) @@ -96,7 +70,7 @@ protected void DrawContent(Action content, bool useFooter = true) GUILayout.FlexibleSpace(); Layout.Vertical(() => { - banner.Draw(position); + header.Draw(position); content?.Invoke(); if (useFooter) { @@ -120,6 +94,7 @@ private void SetWindowSize() { minSize = maxSize = new Vector2(WIDTH, height); windowResized = true; + } } } diff --git a/Editor/Utils/EditorUtilities.cs b/Editor/Utils/EditorUtilities.cs index 402a1c4e..ea3961ba 100644 --- a/Editor/Utils/EditorUtilities.cs +++ b/Editor/Utils/EditorUtilities.cs @@ -1,3 +1,4 @@ +using System; using System.Text.RegularExpressions; using UnityEditor; using UnityEngine; @@ -20,7 +21,7 @@ public static void CreatePrefab(GameObject source, string path) EditorUtility.SetDirty(source); } - public static string TextFieldWithPlaceholder(string text, string placeholder, GUILayoutOption layoutOptions) + public static string TextFieldWithPlaceholder(string text, string placeholder, params GUILayoutOption[] layoutOptions) { var newText = EditorGUILayout.TextField(text, layoutOptions); if (string.IsNullOrEmpty(text)) @@ -33,9 +34,10 @@ public static string TextFieldWithPlaceholder(string text, string placeholder, G return newText; } - public static bool IsUrlShortcodeValid(string shortcodeUrl) + public static bool IsUrlShortcodeValid(string urlString) { - return string.IsNullOrEmpty(shortcodeUrl) || Regex.Match(shortcodeUrl, SHORT_CODE_REGEX).Length > 0 || shortcodeUrl.EndsWith(".glb"); + return !string.IsNullOrEmpty(urlString) && + (Regex.Match(urlString, SHORT_CODE_REGEX).Length > 0 || (Uri.IsWellFormedUriString(urlString, UriKind.Absolute) && urlString.EndsWith(".glb"))); } } } From 28dd7d29ba2a66d10da4033246d8bc158c758b9f Mon Sep 17 00:00:00 2001 From: Harrison Hough Date: Thu, 11 May 2023 15:14:59 +0300 Subject: [PATCH 13/18] feat: add folder size in MB function (#72) #### Added - extra helper functions useful for avatar cache --- Runtime/Utils/DirectoryUtility.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Runtime/Utils/DirectoryUtility.cs b/Runtime/Utils/DirectoryUtility.cs index 28b32037..e30264dd 100644 --- a/Runtime/Utils/DirectoryUtility.cs +++ b/Runtime/Utils/DirectoryUtility.cs @@ -6,6 +6,8 @@ namespace ReadyPlayerMe.Core { public static class DirectoryUtility { + private const float BYTES_IN_MEGABYTE = 1024 * 1024; + /// The directory where avatar files will be downloaded. public static string DefaultAvatarFolder { get; set; } = "Ready Player Me/Avatars"; @@ -44,6 +46,17 @@ public static long GetDirectorySize(DirectoryInfo directoryInfo) return size; } + public static float GetFolderSizeInMb(string folderPath) + { + var bytes = GetDirectorySize(new DirectoryInfo(folderPath)); + return !Directory.Exists(folderPath) ? 0 : BytesToMegabytes(bytes); + } + + private static float BytesToMegabytes(long bytes) + { + return bytes / BYTES_IN_MEGABYTE; + } + public static string GetAvatarsDirectoryPath(bool saveInProjectFolder = false) { var directory = saveInProjectFolder ? Application.dataPath : Application.persistentDataPath; From caf54870e00ce37bb26cb6c8783cdae3d14bd23c Mon Sep 17 00:00:00 2001 From: Harrison Hough Date: Tue, 16 May 2023 10:46:29 +0300 Subject: [PATCH 14/18] chore: remove unused PR template fields --- .github/pull_request_template.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 89830043..163e2d2d 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -45,15 +45,6 @@ Avatar Loader: branch - [ ] Tests written or updated for the changes. - [ ] Documentation is updated. - [ ] Changelog is updated. -- [ ] QA Testing is updated. - -## QA Testing - -- Mention any useful test cases for this feature and add to QA Testing documentation. - -## Details - -- If more details are necessary to support the description with images and videos add them here. From a905b74a76312e959e086e2bef4b8e60e66c5f5b Mon Sep 17 00:00:00 2001 From: Harrison Hough Date: Fri, 19 May 2023 10:22:17 +0300 Subject: [PATCH 15/18] small UI fix for docs button and subdomain URL (#74) ## Changes #### Updated - Core settings window updates - style updates to help button --- Editor/UI/Components/DocumentationButton.cs | 9 ++++++--- Editor/UI/Components/SubdomainField.cs | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Editor/UI/Components/DocumentationButton.cs b/Editor/UI/Components/DocumentationButton.cs index 75c7f270..bb5d4cb4 100644 --- a/Editor/UI/Components/DocumentationButton.cs +++ b/Editor/UI/Components/DocumentationButton.cs @@ -1,4 +1,4 @@ -using UnityEditor; +using UnityEditor; using UnityEngine; namespace ReadyPlayerMe.Core.Editor @@ -10,11 +10,14 @@ public static class DocumentationButton fontSize = 14, fixedHeight = 18, fixedWidth = 18, - margin = new RectOffset(2, 0, 0, 8), + margin = new RectOffset(2, 2, 0, 8), + padding = new RectOffset(2, 0, 0, 1), normal = { textColor = new Color(0.7f, 0.7f, 0.7f, 1.0f) - } + }, + alignment = TextAnchor.MiddleCenter + }; public static void Draw(string url) diff --git a/Editor/UI/Components/SubdomainField.cs b/Editor/UI/Components/SubdomainField.cs index cf5c2613..7583a5ea 100644 --- a/Editor/UI/Components/SubdomainField.cs +++ b/Editor/UI/Components/SubdomainField.cs @@ -58,7 +58,7 @@ public void Draw() GUI.SetNextControlName(SUBDOMAIN_FIELD_CONTROL_NAME); partnerSubdomain = EditorGUILayout.TextField(oldValue, textFieldStyle, GUILayout.Width(128), GUILayout.Height(20)); - EditorGUILayout.LabelField(".readyplayer.me", textLabelStyle, GUILayout.Width(100), GUILayout.Height(20)); + EditorGUILayout.LabelField(".readyplayer.me", textLabelStyle, GUILayout.Width(102), GUILayout.Height(20)); var button = new GUIContent(errorIcon, DOMAIN_VALIDATION_ERROR); var isSubdomainValid = ValidateSubdomain(); From d187d016e186d1e658dcc9663ab77a5daf2fffd9 Mon Sep 17 00:00:00 2001 From: Harrison Date: Tue, 23 May 2023 10:27:05 +0300 Subject: [PATCH 16/18] fix: fix for null --- Runtime/CoreSettingsHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Runtime/CoreSettingsHandler.cs b/Runtime/CoreSettingsHandler.cs index 6faec22c..9f510231 100644 --- a/Runtime/CoreSettingsHandler.cs +++ b/Runtime/CoreSettingsHandler.cs @@ -50,7 +50,7 @@ public static CoreSettings CreateCoreSettings() var newSettings = ScriptableObject.CreateInstance(); newSettings.Subdomain = DEFAULT_SUBDOMAIN; - AssetDatabase.CreateAsset(coreSettings, PROJECT_RELATIVE_ASSET_PATH); + AssetDatabase.CreateAsset(newSettings, PROJECT_RELATIVE_ASSET_PATH); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); return newSettings; From c5f6dc910c9abd8a3df1280a38d86d976eb3896e Mon Sep 17 00:00:00 2001 From: Harrison Date: Tue, 23 May 2023 15:18:45 +0300 Subject: [PATCH 17/18] chore: updated README --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd4ba691..7f6a8862 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [1.3.0] - Unreleased + +### Added +- import timeout to module installer [#70](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/70) +- Add new setup guide window [#71](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/71) +- added function for folder size in MB [#72](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/72) + +### Fixed +- various editor window layout fixes [#73](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/73) + ## [1.2.0] - 2023.04.18 ### Added From 00ccdf7dba8ec5fab93fcbb466c5b8492d2481ff Mon Sep 17 00:00:00 2001 From: Harrison Date: Tue, 23 May 2023 15:22:23 +0300 Subject: [PATCH 18/18] chore: update version numbers for testing --- .github/latest.md | 11 +++++------ Editor/Module Management/ModuleList.cs | 12 ++++++------ package.json | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/latest.md b/.github/latest.md index d562c476..7db68b5b 100644 --- a/.github/latest.md +++ b/.github/latest.md @@ -1,12 +1,11 @@ -This update includes an additional popup for the new Quick Start sample, operation completed event and README updates. +This update adds a small improvement to the module installer and a new setup guide editor window flow to help new users get started. ## Changelog ### Added -- support for response codes [#62](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/62) - -### Updated -- refactor of WebRequestDispatcher [#59](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/59) +- import timeout to module installer [#70](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/70) +- Add new setup guide window [#71](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/71) +- added function for folder size in MB [#72](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/72) ### Fixed -- fixed an issue with the popup don't ask again pref was not updating correctly [#58](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/58) +- various editor window layout fixes [#73](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/73) \ No newline at end of file diff --git a/Editor/Module Management/ModuleList.cs b/Editor/Module Management/ModuleList.cs index 591064ec..d2ea73f7 100644 --- a/Editor/Module Management/ModuleList.cs +++ b/Editor/Module Management/ModuleList.cs @@ -13,8 +13,8 @@ public static class ModuleList { name = "com.readyplayerme.core", gitUrl = "https://github.com/readyplayerme/rpm-unity-sdk-core.git", - branch = "", - version = "1.2.0" + branch = "release/v1.3.0", + version = "1.3.0" }; /// @@ -33,15 +33,15 @@ public static class ModuleList { name = "com.readyplayerme.avatarloader", gitUrl = "https://github.com/readyplayerme/rpm-unity-sdk-avatar-loader.git", - branch = "", - version = "1.2.0" + branch = "release/v1.3.0", + version = "1.3.0" }, new ModuleInfo { name = "com.readyplayerme.webview", gitUrl = "https://github.com/readyplayerme/rpm-unity-sdk-webview.git", - branch = "", - version = "1.1.0" + branch = "release/v1.2.0", + version = "1.2.0" } }; diff --git a/package.json b/package.json index 0ab33df2..74b54c0b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.readyplayerme.core", - "version": "1.2.0", + "version": "1.3.0", "displayName": "Ready Player Me Core", "description": "Ready Player Me Core is responsible for module management and setting up the SDK for first time use.", "unity": "2020.3",