feat: 增强存档管理和成就系统,添加事件通知以支持凹槽成就的动态更新

This commit is contained in:
2026-05-20 16:03:10 +08:00
parent c50f8a6cf7
commit 8c66640a6d
3 changed files with 33 additions and 10 deletions

View File

@@ -51,7 +51,17 @@ namespace BaseGames.Core.Save
}
// ── ISaveable 注册 ────────────────────────────────────────────────────
public void Register(ISaveable s) => _saveables.Add(s);
/// <summary>
/// 注册 ISaveable。若当前已有存档数据_current != null
/// 立即对该组件补发 OnLoad使跨场景延迟注册的组件也能正确恢复状态。
/// </summary>
public void Register(ISaveable s)
{
if (!_saveables.Add(s)) return;
if (_current != null)
s.OnLoad(_current);
}
public void Unregister(ISaveable s) => _saveables.Remove(s);
// ── 游玩时间追踪 ──────────────────────────────────────────────────────