From 06f3785d74ceef337f4f38530b3f31cf3630d40e Mon Sep 17 00:00:00 2001 From: eni <129673786+enitimeago@users.noreply.github.com> Date: Sat, 2 Mar 2024 15:07:26 +0900 Subject: [PATCH] feat: silentIfInstalled option --- Assets/InstallerSource/VPMPackageAutoInstaller.cs | 4 +++- README.md | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Assets/InstallerSource/VPMPackageAutoInstaller.cs b/Assets/InstallerSource/VPMPackageAutoInstaller.cs index 55fa71b..1cfee90 100644 --- a/Assets/InstallerSource/VPMPackageAutoInstaller.cs +++ b/Assets/InstallerSource/VPMPackageAutoInstaller.cs @@ -241,7 +241,7 @@ private static async SyncedTask<bool> DoInstallImpl() if (request.locked().Count == 0) { - if (!IsNoPrompt()) + if (!IsNoPrompt() && !config.silentIfInstalled) EditorUtility.DisplayDialog("Nothing TO DO!", "All Packages are Installed!", "OK"); return false; } @@ -411,6 +411,7 @@ sealed class VpaiConfig { [NotNull] public readonly VpaiRepository[] vpmRepositories; public readonly bool includePrerelease; + public readonly bool silentIfInstalled; public readonly VrcGet.PartialUnityVersion minimumUnity; [NotNull] public readonly Dictionary<string, VrcGet.VersionRange> VpmDependencies; @@ -418,6 +419,7 @@ public VpaiConfig(JsonObj json) { vpmRepositories = json.Get("vpmRepositories", JsonType.List, true)?.Select(v => new VpaiRepository(v))?.ToArray() ?? Array.Empty<VpaiRepository>(); includePrerelease = json.Get("includePrerelease", JsonType.Bool, true); + silentIfInstalled = json.Get("silentIfInstalled", JsonType.Bool, true); VpmDependencies = json.Get("vpmDependencies", JsonType.Obj, true) ?.ToDictionary(x => x.Item1, x => VrcGet.VersionRange.Parse((string)x.Item2)) ?? new Dictionary<string, VrcGet.VersionRange>(); diff --git a/README.md b/README.md index 44a8922..513cb08 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,10 @@ will make unitypackage for AvatarOptimizer 0.2.x // by default, beta releases are not allowed. // to allow all beta versions in that range, please make this true "includePrerelease": false, + // For advanced usage only. This will suppress the prompt to users if dependencies are already installed. + // It is strongly recommended you keep this as the default false, otherwise users may be confused why nothing happened. + // This should only enabled in certain use cases, for example if you are distributing with other assets + "silentIfInstalled": false, // If you want to disallow unity version lower than specific version, you can specify it here. // Regardless if this is not specified, unity version will be checked by VPM. "minimumUnity": "2022.3"