存档完善和修复
This commit is contained in:
@@ -48,8 +48,8 @@ namespace BaseGames.Core.Save
|
|||||||
{
|
{
|
||||||
// 2.2 删除 EquipmentSaveData.NotchesUsed(冗余,由 TryEquipCharm 重新计算)。
|
// 2.2 删除 EquipmentSaveData.NotchesUsed(冗余,由 TryEquipCharm 重新计算)。
|
||||||
// 2.2 删除 PlayerSaveData.ShieldHP / ShieldIsBroken(护盾在存档点始终全满,无需持久化)。
|
// 2.2 删除 PlayerSaveData.ShieldHP / ShieldIsBroken(护盾在存档点始终全满,无需持久化)。
|
||||||
// 2.2 删除 SettingsSaveData.Language(全局设置由 SettingsManager 写入 settings.json)。
|
// SettingsSaveData.Language 字段保留(由 LocalizationManager 负责按存档槽读写)。
|
||||||
// 旧存档中这些字段由 Newtonsoft.Json 的 [JsonExtensionData] 忽略,无需额外处理。
|
// 旧存档中已删除的字段由 Newtonsoft.Json 的 [JsonExtensionData] 忽略,无需额外处理。
|
||||||
// Equipment.MaxNotches:旧存档若为 0,EquipmentManager.OnLoad 回退到初始 Notch 数量。
|
// Equipment.MaxNotches:旧存档若为 0,EquipmentManager.OnLoad 回退到初始 Notch 数量。
|
||||||
if (data.Equipment != null && data.Equipment.MaxNotches == 0)
|
if (data.Equipment != null && data.Equipment.MaxNotches == 0)
|
||||||
data.Equipment.MaxNotches = 0; // 保持 0,OnLoad 回退到 config.initialNotchCount
|
data.Equipment.MaxNotches = 0; // 保持 0,OnLoad 回退到 config.initialNotchCount
|
||||||
|
|||||||
@@ -85,8 +85,17 @@ namespace BaseGames.Player
|
|||||||
_unlockedAbilities = _config.InitialAbilities;
|
_unlockedAbilities = _config.InitialAbilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnEnable() => _onDifficultyChanged?.Subscribe(HandleDifficultyChanged).AddTo(_subs);
|
private void OnEnable()
|
||||||
private void OnDisable() => _subs.Clear();
|
{
|
||||||
|
ServiceLocator.GetOrDefault<ISaveableRegistry>()?.Register(this);
|
||||||
|
_onDifficultyChanged?.Subscribe(HandleDifficultyChanged).AddTo(_subs);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDisable()
|
||||||
|
{
|
||||||
|
ServiceLocator.GetOrDefault<ISaveableRegistry>()?.Unregister(this);
|
||||||
|
_subs.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
private void HandleDifficultyChanged(DifficultyLevel _)
|
private void HandleDifficultyChanged(DifficultyLevel _)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ namespace BaseGames.Progression
|
|||||||
InitStates();
|
InitStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnEnable() => ServiceLocator.GetOrDefault<ISaveableRegistry>()?.Register(this);
|
||||||
|
private void OnDisable() => ServiceLocator.GetOrDefault<ISaveableRegistry>()?.Unregister(this);
|
||||||
|
|
||||||
private void OnDestroy()
|
private void OnDestroy()
|
||||||
{
|
{
|
||||||
ServiceLocator.Unregister<IAchievementService>(this);
|
ServiceLocator.Unregister<IAchievementService>(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user