feat(packages): 内置 SDK 包并完善 ContextLoader 集成
- 将 ShrinkEventBus、ShrinkDataSaver 及其 EventBus 集成从 gitlink 转为仓库直接维护的完整 UPM 包,补齐运行时、编辑器工具、测试与文档 - 新增 Command 和 Network 的 App 集成组件,支持 ContextLoader 服务发布、可逆注销及 Network Loopback 生命周期管理 - 更新 Starter 与演示组合逻辑,缺失模块时可注册、已有兼容安装器时可覆盖,并补充宿主启动断言 - 升级内部包依赖与 Shared CodeGen 包定义,放宽 Integration.App 包的 Git 忽略规则 - 将独立服务器生成器改为基于已编译程序集的语义扫描,支持 partial、复杂泛型、命名冲突检测及模板 SHA-256 覆写保护 - 新增 Network 语义扫描、模板保护和 App 组件生命周期测试 - 新增真实 UPM 消费工程验证脚本,校验内部版本一致性、程序集加载及 EditMode 测试 - 重构当前架构文档并归档已完成的 Cordis 迁移与旧代码地图
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#nullable enable
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ShrinkCommand.Integration.App;
|
||||
using ShrinkCommand.Integration;
|
||||
using ShrinkContext.AppAdapter;
|
||||
@@ -42,9 +43,9 @@ namespace ShrinkApp.Starter.Basic
|
||||
if (host == null)
|
||||
throw new System.ArgumentNullException(nameof(host));
|
||||
|
||||
host.OverrideModuleComponent("shrink.network", static () => new ShrinkNetworkAppComponent());
|
||||
host.OverrideModuleComponent("shrink.command", static () => new ShrinkCommandAppComponent());
|
||||
host.OverrideModuleComponent("shrink.datasaver", static () => new ShrinkDataSaverAppComponent());
|
||||
RegisterOrReplace(host, "shrink.network", static () => new ShrinkNetworkAppComponent());
|
||||
RegisterOrReplace(host, "shrink.command", static () => new ShrinkCommandAppComponent());
|
||||
RegisterOrReplace(host, "shrink.datasaver", static () => new ShrinkDataSaverAppComponent());
|
||||
host.AddModuleComponent("shrink.integration.command-network",
|
||||
static () => new ShrinkCommandNetworkIntegrationComponent());
|
||||
host.AddModuleComponent("shrink.integration.command-eventbus",
|
||||
@@ -55,6 +56,17 @@ namespace ShrinkApp.Starter.Basic
|
||||
static () => new ShrinkNetworkEventBusComponent());
|
||||
}
|
||||
|
||||
private static void RegisterOrReplace(
|
||||
ShrinkAppLoaderHost host,
|
||||
string moduleId,
|
||||
System.Func<ShrinkContext.IShrinkComponent> componentFactory)
|
||||
{
|
||||
if (host.ModuleIds.Any(id => string.Equals(id, moduleId, System.StringComparison.OrdinalIgnoreCase)))
|
||||
host.OverrideModuleComponent(moduleId, componentFactory);
|
||||
else
|
||||
host.AddModuleComponent(moduleId, componentFactory);
|
||||
}
|
||||
|
||||
public static ShrinkAppCompositionDocument CreateDefaultDocument()
|
||||
{
|
||||
var entries = new List<ShrinkAppCompositionEntry>(DefaultModuleIdValues.Length);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"description": "ShrinkApp 最小起盘 Starter,提供向导、入口场景和 DataSaver 示例。",
|
||||
"unity": "2022.3",
|
||||
"dependencies": {
|
||||
"com.cneicy.shrink-app-core": "0.1.0",
|
||||
"com.cneicy.shrink-app-core": "0.1.1",
|
||||
"com.cneicy.shrink-context-core": "0.1.0",
|
||||
"com.cneicy.shrink-context-app-adapter": "0.1.0",
|
||||
"com.cneicy.shrink-command": "0.2.0",
|
||||
|
||||
Reference in New Issue
Block a user