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),包含任务定义、节点路径、时间戳等元数据 - 服务注册更新,使用新的执行器、事件总线、历史记录器等组件
54 lines
1.6 KiB
C#
54 lines
1.6 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
|
||
namespace BetterGenshinImpact.Service.GearTask.Execution;
|
||
|
||
/// <summary>
|
||
/// GearTask 执行链路中的统一事件基类。
|
||
/// 执行器只负责发布事件,记录器、UI 投影和其他消费者按需订阅并消费。
|
||
/// </summary>
|
||
public abstract class GearTaskExecutionEvent
|
||
{
|
||
/// <summary>
|
||
/// 当前执行记录的唯一标识。
|
||
/// </summary>
|
||
public string RecordId { get; set; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 任务定义展示名。
|
||
/// </summary>
|
||
public string TaskDefinitionName { get; set; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 任务定义对应的安全文件名,用于历史记录目录划分。
|
||
/// </summary>
|
||
public string TaskDefinitionFileKey { get; set; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 任务树中的节点路径,例如 0/1/2。
|
||
/// </summary>
|
||
public string NodeId { get; set; } = string.Empty;
|
||
|
||
public string? ParentNodeId { get; set; }
|
||
|
||
public string TaskName { get; set; } = string.Empty;
|
||
|
||
public string TaskType { get; set; } = string.Empty;
|
||
|
||
public string TaskPath { get; set; } = string.Empty;
|
||
|
||
public int NodeDepth { get; set; }
|
||
|
||
public int NodeOrder { get; set; }
|
||
|
||
/// <summary>
|
||
/// 事件发生时间,默认使用本地时间,便于直接展示在历史时间线中。
|
||
/// </summary>
|
||
public DateTime Timestamp { get; set; } = DateTime.Now;
|
||
|
||
/// <summary>
|
||
/// 预留给具体任务类型的扩展字段,避免事件模型为了单个任务不断膨胀。
|
||
/// </summary>
|
||
public Dictionary<string, object?> Extra { get; set; } = [];
|
||
}
|