存档完善和修复

This commit is contained in:
2026-05-20 15:10:35 +08:00
parent 84528403ec
commit ec633d9b79
17 changed files with 254 additions and 67 deletions

View File

@@ -1,4 +1,5 @@
using UnityEngine;
using BaseGames.Core;
using BaseGames.Core.Events;
namespace BaseGames.Progression
@@ -6,7 +7,7 @@ namespace BaseGames.Progression
/// <summary>
/// Boss 进程追踪器(架构 09_ProgressionModule §13
/// 挂载在 Boss 房间的 BossTrigger 同一对象上。
/// 监听 _onBossDefeated 事件,路由到 SaveSystem 专用频道(零耦合)
/// 监听 _onBossDefeated 事件,立即将胜利写入 SaveData 并推送到全局 ISaveService
/// </summary>
public class BossProgressTracker : MonoBehaviour
{
@@ -14,8 +15,7 @@ namespace BaseGames.Progression
[SerializeField] private string[] _unlocksProgressLockIds; // 击败后应解锁的 ProgressLock ID预留
[Header("Event Channels")]
[SerializeField] private StringEventChannelSO _onBossDefeated; // 监听(来自 BossCombat
[SerializeField] private StringEventChannelSO _onBossDefeatedForSave; // 广播 → SaveSystem
[SerializeField] private StringEventChannelSO _onBossDefeated; // 监听(来自 BossCombat
private readonly CompositeDisposable _subs = new();
@@ -25,9 +25,7 @@ namespace BaseGames.Progression
private void OnBossDefeated(string bossId)
{
if (bossId != _bossId) return;
// 通过事件频道通知 SaveSystemSaveSystem 负责写入 data.World.DefeatedBossIds
_onBossDefeatedForSave?.Raise(bossId);
ServiceLocator.GetOrDefault<ISaveService>()?.MarkBossDefeated(bossId);
}
}
}