mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-05-25 10:05:49 +08:00
- 新增 IGearTaskEventBus 接口及默认实现,用于解耦执行器与记录器、UI 投影等消费者 - 新增 IGearTaskResumable 接口,支持任务节点内部恢复(如 Pathing 任务可恢复至特定路径点) - 重构任务执行流程,使用 GearTaskExecutionRunner 替代旧的 GearTaskExecutionManager - 实现基于磁盘 JSON 的历史记录存储(IGearTaskHistoryStore),支持执行记录的保存、加载与清理 - 为 PathingGearTask 添加恢复能力,通过 PathingGearTaskResumeState 记录断点状态 - 在 PathExecutor 中集成运行时事件通知,支持路径点进入、完成、传送等事件的发布 - 统一执行事件模型(GearTaskExecutionEvent),包含任务定义、节点路径、时间戳等元数据 - 服务注册更新,使用新的执行器、事件总线、历史记录器等组件
31 lines
803 B
C#
31 lines
803 B
C#
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BetterGenshinImpact.Service.GearTask.Execution;
|
|
|
|
/// <summary>
|
|
/// GearTask 执行事件总线。
|
|
/// 负责在执行器与记录器、UI 投影等消费者之间解耦。
|
|
/// </summary>
|
|
public interface IGearTaskEventBus
|
|
{
|
|
/// <summary>
|
|
/// 发布一条执行事件。
|
|
/// </summary>
|
|
ValueTask PublishAsync(GearTaskExecutionEvent evt, CancellationToken ct = default);
|
|
|
|
/// <summary>
|
|
/// 注册一个事件消费者。
|
|
/// </summary>
|
|
IDisposable Subscribe(IGearTaskEventConsumer consumer);
|
|
}
|
|
|
|
/// <summary>
|
|
/// GearTask 执行事件消费者。
|
|
/// </summary>
|
|
public interface IGearTaskEventConsumer
|
|
{
|
|
ValueTask ConsumeAsync(GearTaskExecutionEvent evt, CancellationToken ct = default);
|
|
}
|