feat: 增强存档管理和成就系统,添加事件通知以支持凹槽成就的动态更新
This commit is contained in:
@@ -26,16 +26,29 @@ namespace BaseGames.Equipment
|
||||
[SerializeField] private CharmEventChannelSO _onCharmUnequipped;
|
||||
[SerializeField] private VoidEventChannelSO _onEquipmentChanged;
|
||||
|
||||
[Tooltip("AchievementManager 解锁授予凹槽成就时发布;订阅后调用 IncreaseNotches(1)。")]
|
||||
[SerializeField] private VoidEventChannelSO _onAchievementNotchGranted;
|
||||
|
||||
private readonly List<CharmSO> _equipped = new(4);
|
||||
private readonly List<CharmSO> _collected = new(32);
|
||||
private int _currentNotchCapacity;
|
||||
private int _usedNotches;
|
||||
|
||||
private EquipmentContext _ctx;
|
||||
private readonly CompositeDisposable _subs = new();
|
||||
|
||||
// ── 生命周期 ──────────────────────────────────────────────────────────
|
||||
private void OnEnable() => ServiceLocator.GetOrDefault<ISaveableRegistry>()?.Register(this);
|
||||
private void OnDisable() => ServiceLocator.GetOrDefault<ISaveableRegistry>()?.Unregister(this);
|
||||
private void OnEnable()
|
||||
{
|
||||
ServiceLocator.GetOrDefault<ISaveableRegistry>()?.Register(this);
|
||||
_onAchievementNotchGranted?.Subscribe(() => IncreaseNotches(1)).AddTo(_subs);
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
ServiceLocator.GetOrDefault<ISaveableRegistry>()?.Unregister(this);
|
||||
_subs.Clear();
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user