diff --git a/Development~/UnityProject/Assets/Editor/ShrinkInstallerDevelopmentValidation.cs b/Development~/UnityProject/Assets/Editor/ShrinkInstallerDevelopmentValidation.cs index eb33aea..e2a9e8e 100644 --- a/Development~/UnityProject/Assets/Editor/ShrinkInstallerDevelopmentValidation.cs +++ b/Development~/UnityProject/Assets/Editor/ShrinkInstallerDevelopmentValidation.cs @@ -36,6 +36,12 @@ public static class ShrinkInstallerDevelopmentValidation ?.GetValue(null) as IEnumerable; Require(Count(packages) == 20, "包目录数量不是 20。"); Require(Count(bundles) == 8, "推荐组合数量不是 8。"); + Require(BundleContainsInstallRoot(bundles, "基础应用(推荐)", + "com.cneicy.shrink-context-eventbus-adapter"), + "基础应用组合没有显式安装 Context 事件适配。"); + Require(BundleContainsInstallRoot(bundles, "常用完整套件", + "com.cneicy.shrink-context-eventbus-adapter"), + "常用完整套件没有显式安装 Context 事件适配。"); } finally { @@ -60,6 +66,32 @@ public static class ShrinkInstallerDevelopmentValidation return count; } + private static bool BundleContainsInstallRoot(IEnumerable bundles, string bundleName, string packageName) + { + foreach (var bundle in bundles) + { + var bundleType = bundle.GetType(); + if (!string.Equals(bundleType.GetProperty("DisplayName")?.GetValue(bundle) as string, bundleName, + StringComparison.Ordinal)) + continue; + + var roots = bundleType.GetProperty("InstallRoots")?.GetValue(bundle) as IEnumerable; + if (roots == null) + return false; + + foreach (var root in roots) + { + var value = root.GetType().GetProperty("PackageName")?.GetValue(root) as string; + if (string.Equals(value, packageName, StringComparison.Ordinal)) + return true; + } + + return false; + } + + return false; + } + private static Type FindType(string fullName) => AppDomain.CurrentDomain.GetAssemblies() .Select(assembly => assembly.GetType(fullName, false)) .FirstOrDefault(type => type != null) diff --git a/Editor/ShrinkSdkPackageCatalog.cs b/Editor/ShrinkSdkPackageCatalog.cs index 3cc9b28..4761029 100644 --- a/Editor/ShrinkSdkPackageCatalog.cs +++ b/Editor/ShrinkSdkPackageCatalog.cs @@ -153,7 +153,7 @@ namespace ShrinkSDK.Installer DataSaverApp, DataSaverEventBus, NetworkApp, NetworkEventBus, StarterBasic }, - new[] { StarterBasic }, + new[] { StarterBasic, ContextEventBusAdapter }, recommended: true), new ShrinkSdkPackageBundle( "Context 最小基座", @@ -195,7 +195,7 @@ namespace ShrinkSDK.Installer DataSaverApp, DataSaverEventBus, NetworkApp, NetworkEventBus, StarterBasic }, - new[] { StarterBasic, ModFramework, Tutorial }) + new[] { StarterBasic, ContextEventBusAdapter, ModFramework, Tutorial }) }; internal static IReadOnlyList DistinctInstallRoots( diff --git a/README.md b/README.md index 2d354f8..d7dfe06 100644 --- a/README.md +++ b/README.md @@ -15,5 +15,5 @@ ## 引导地址 ```text -https://git.crash.work/ShrinkSDK/Installer.git#v0.2.1 +https://git.crash.work/ShrinkSDK/Installer.git#v0.2.2 ``` diff --git a/package.json b/package.json index 84d1065..004e00a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.cneicy.shrink-installer", - "version": "0.2.1", + "version": "0.2.2", "displayName": "ShrinkSDK 包管理", "description": "基于 UI Toolkit 的 ShrinkSDK 固定版本包管理器,提供安装状态、Context 分层与推荐组合。", "unity": "2022.3",