mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-23 03:04:29 +08:00
- 在SettingsModel中添加事件相关依赖引用 - 在SettingsPersistence中实现设置加载、保存、删除的事件发送机制 - 添加SettingsDeletedEvent用于通知设置删除操作 - 添加SettingsResetEvent和SettingsResetAllEvent支持设置重置功能 - 在SettingsPersistence中新增ResetAsync和ResetAllAsync方法 - 修改TryApply方法为实例方法并添加设置应用过程的事件通知 - 添加SettingsApplyingEvent和SettingsAppliedEvent跟踪设置应用状态 - [skip ci]
30 lines
915 B
C#
30 lines
915 B
C#
using GFramework.Game.Abstractions.setting;
|
|
|
|
namespace GFramework.Game.setting.events;
|
|
|
|
/// <summary>
|
|
/// 表示所有设置重置完成事件
|
|
/// </summary>
|
|
/// <param name="newSettings">重置后的所有设置</param>
|
|
public class SettingsResetAllEvent(IEnumerable<ISettingsSection> newSettings) : ISettingsChangedEvent
|
|
{
|
|
/// <summary>
|
|
/// 获取重置后的所有设置
|
|
/// </summary>
|
|
public IReadOnlyCollection<ISettingsSection> NewSettings { get; } = newSettings.ToList();
|
|
|
|
/// <summary>
|
|
/// 获取设置类型,固定返回 ISettingsSection
|
|
/// </summary>
|
|
public Type SettingsType => typeof(ISettingsSection);
|
|
|
|
/// <summary>
|
|
/// 获取设置实例,批量事件中返回 null
|
|
/// </summary>
|
|
public ISettingsSection Settings => null!;
|
|
|
|
/// <summary>
|
|
/// 获取重置时间
|
|
/// </summary>
|
|
public DateTime ChangedAt { get; } = DateTime.UtcNow;
|
|
} |