mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-05-23 09:55:48 +08:00
- 新增 IGearTaskEventBus 接口及默认实现,用于解耦执行器与记录器、UI 投影等消费者 - 新增 IGearTaskResumable 接口,支持任务节点内部恢复(如 Pathing 任务可恢复至特定路径点) - 重构任务执行流程,使用 GearTaskExecutionRunner 替代旧的 GearTaskExecutionManager - 实现基于磁盘 JSON 的历史记录存储(IGearTaskHistoryStore),支持执行记录的保存、加载与清理 - 为 PathingGearTask 添加恢复能力,通过 PathingGearTaskResumeState 记录断点状态 - 在 PathExecutor 中集成运行时事件通知,支持路径点进入、完成、传送等事件的发布 - 统一执行事件模型(GearTaskExecutionEvent),包含任务定义、节点路径、时间戳等元数据 - 服务注册更新,使用新的执行器、事件总线、历史记录器等组件
30 lines
983 B
C#
30 lines
983 B
C#
using BetterGenshinImpact.Service.GearTask.Execution;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace BetterGenshinImpact.Service.GearTask;
|
|
|
|
/// <summary>
|
|
/// 齿轮任务服务注册扩展方法
|
|
/// </summary>
|
|
public static class GearTaskServiceExtensions
|
|
{
|
|
/// <summary>
|
|
/// 注册齿轮任务相关服务
|
|
/// </summary>
|
|
public static IServiceCollection AddGearTaskServices(this IServiceCollection services)
|
|
{
|
|
services.AddSingleton<GearTaskStorageService>();
|
|
services.AddSingleton<GearTaskFactory>();
|
|
services.AddSingleton<GearTaskConverter>();
|
|
|
|
services.AddSingleton<IGearTaskEventBus, GearTaskEventBus>();
|
|
services.AddSingleton<IGearTaskHistoryStore, GearTaskHistoryStore>();
|
|
services.AddHostedService<GearTaskHistoryRecorder>();
|
|
|
|
services.AddSingleton<IGearTaskExecutionRunner, GearTaskExecutionRunner>();
|
|
services.AddSingleton<GearTaskExecutor>();
|
|
|
|
return services;
|
|
}
|
|
}
|