GFramework/GFramework.Game/setting/events/SettingsSavedEvent.cs
GeWuYou 9ae0f63324 feat(setting): 添加设置事件系统和改进设置模型接口
- 新增 SettingsAllLoadedEvent 事件类,用于表示所有设置加载完成
- 新增 SettingsAppliedEvent 事件类,用于表示设置应用完成状态
- 新增 SettingsApplyingEvent 事件类,用于表示设置正在应用过程
- 新增 SettingsBatchChangedEvent 事件类,用于表示批量设置变更
- 新增 SettingsBatchSavedEvent 事件类,用于表示批量设置保存
- 新增 SettingsChangedEvent 通用设置变更事件类
- 新增 SettingsLoadedEvent 和 SettingsSavedEvent 事件类
- 在 SettingsModel 中添加对 GFramework.Core.extensions 的引用
- 更新 RegisterApplicator 方法支持链式调用并改进注释说明
- 新增 ISettingsChangedEvent 接口定义设置变更事件基础结构
- 修改 ISettingsModel 接口使 RegisterApplicator 方法支持链式调用
- 修改 ISettingsPersistence 接口继承 IContextUtility 接口
2026-01-17 13:16:50 +08:00

31 lines
858 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using GFramework.Game.Abstractions.setting;
namespace GFramework.Game.setting.events;
/// <summary>
/// 表示设置保存事件的泛型类
/// </summary>
/// <typeparam name="T">设置节类型必须实现ISettingsSection接口</typeparam>
public class SettingsSavedEvent<T>(T settings) : ISettingsChangedEvent
where T : ISettingsSection
{
/// <summary>
/// 获取类型化的设置对象
/// </summary>
public T TypedSettings { get; } = settings;
/// <summary>
/// 获取设置类型的Type信息
/// </summary>
public Type SettingsType => typeof(T);
/// <summary>
/// 获取设置节对象
/// </summary>
public ISettingsSection Settings => TypedSettings;
/// <summary>
/// 获取设置更改的时间戳
/// </summary>
public DateTime ChangedAt { get; } = DateTime.UtcNow;
}