GFramework/GFramework.Game/setting/events/SettingsChangedEvent.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

32 lines
866 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>
/// <param name="settings">设置实例</param>
public class SettingsChangedEvent<T>(T settings) : ISettingsChangedEvent
where T : ISettingsSection
{
/// <summary>
/// 获取类型化的设置实例
/// </summary>
public T TypedSettings => (T)Settings;
/// <summary>
/// 获取设置类型
/// </summary>
public Type SettingsType => typeof(T);
/// <summary>
/// 获取设置实例
/// </summary>
public ISettingsSection Settings { get; } = settings;
/// <summary>
/// 获取变更时间
/// </summary>
public DateTime ChangedAt { get; } = DateTime.UtcNow;
}