feat: update Godot integration and coordinated package dependencies
Publish UPM package / publish (push) Successful in 3s
Publish NuGet packages / publish (push) Successful in 3m43s

This commit is contained in:
cneicy committed 2026-11-06 19:13:18 +08:00
1 parent 95844e11ff
commit 901ad18453
15 files changed
+576 -55

No files matched your search

+26 -1
View File
@@ -20,7 +20,7 @@ https://github.com/cneicy/ShrinkEventBus.git
| 已安装的共享包 | 行为 |
|---|---|
| 无 | 使用包内调度接口和 EventBus 专用 ILPostProcessor |
| Runtime Abstractions 0.1.0+ | 额外启用共享主线程调度器适配程序集 |
| Runtime Abstractions 0.2.0+ | 额外启用共享主线程调度器适配程序集,并支持显式延后发布 |
| Shared CodeGen 0.2.1+ | 停用包内织入,交给共享 CodeGen 统一生成订阅 |
| 两者都有 | 同时启用上述两项集成 |
@@ -199,6 +199,29 @@ Burst Job 只写 unmanaged 事实事件到 NativeQueue;Playback 在托管/ECS
`ShrinkBusOptions` 配置队列容量、溢出策略、最大并发、关闭排空和超时。关键业务默认使用 `Reject`;`DropNewest/DropOldest` 只适用于明确允许丢失的数据;`Wait` 只由 `PostAsync` 使用。
## 延后发布与诊断
MainThread Bus 可以用 `PostDeferred` 把事件推迟到下一次主线程泵送:
```csharp
var result = EventBus.PostDeferred(gameBus, new PlayerReadyEvent());
if (!result.Accepted)
Debug.LogWarning($"deferred post rejected: {result.Failure}");
```
延后发布只接受 `MainThread` 调度且宿主实现了 `IShrinkDeferredMainThreadDispatcher` 的 Bus;其他调度器返回 `DeferredUnsupported`,不会退化成同步分发。队列仍遵守 `QueueCapacity` 与 `OverflowPolicy`,重入发布的事件留到下一次泵送。
需要外部工具观察分发时使用公开诊断订阅:
```csharp
using var subscription = EventBus.ObserveDiagnostics(diagnostic =>
{
Debug.Log($"{diagnostic.BusKey} {diagnostic.EventType.Name} {diagnostic.Result.Failure}");
});
```
`ShrinkEventDiagnostic` 提供时间、事件类型、Bus、调度器、分发模式、线程、耗时、发布结果和同步标记,不暴露事件对象。观察者抛出的异常会记录并隔离,不影响业务分发或其他观察者。
## UI Toolkit 调试器
菜单:`ShrinkSDK/事件总线/事件查看器`。
@@ -207,6 +230,8 @@ Burst Job 只写 unmanaged 事实事件到 NativeQueue;Playback 在托管/ECS
它只观察静态 `EventBus` 宿主管理的 Bus,不捕获独立 `ShrinkEventBusHost`;性能基准仍使用独立 Host,避免 UI 采样进入被测热路径。
Godot 项目安装 `ShrinkSDK.EventBus.Godot` 后可在编辑器中使用同一套诊断数据的独立调试窗口。
## Benchmark
实现位于 `Benchmark/ShrinkEventBusBenchmark.cs`,入口: