存档完善和修复
This commit is contained in:
@@ -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;
|
||||
|
||||
// 通过事件频道通知 SaveSystem(SaveSystem 负责写入 data.World.DefeatedBossIds)
|
||||
_onBossDefeatedForSave?.Raise(bossId);
|
||||
ServiceLocator.GetOrDefault<ISaveService>()?.MarkBossDefeated(bossId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user