多轮审查和修复

This commit is contained in:
2026-05-12 15:34:08 +08:00
parent f55d2a57c3
commit ebbbb7332e
805 changed files with 838724 additions and 1905 deletions

View File

@@ -6,7 +6,7 @@ namespace BaseGames.Core.Save
{
public class EmergencySaveService : MonoBehaviour
{
private const int EmergencySlot = 99;
public const int EmergencySlot = 99;
[SerializeField] private float _intervalSeconds = 120f;
[SerializeField] private SaveManager _saveManager;
@@ -14,16 +14,14 @@ namespace BaseGames.Core.Save
private bool _gameplayActive;
private float _timer;
private readonly CompositeDisposable _subscriptions = new();
private void OnEnable()
{
if (_onGameplayActive != null) _onGameplayActive.OnEventRaised += OnGameplayActiveChanged;
_onGameplayActive?.Subscribe(OnGameplayActiveChanged).AddTo(_subscriptions);
}
private void OnDisable()
{
if (_onGameplayActive != null) _onGameplayActive.OnEventRaised -= OnGameplayActiveChanged;
}
private void OnDisable() => _subscriptions.Clear();
private void OnGameplayActiveChanged(bool value) => _gameplayActive = value;
@@ -44,8 +42,12 @@ namespace BaseGames.Core.Save
public async Task PromoteToSlot(int targetSlot)
{
if (_saveManager == null) return;
// Phase 1 stub完整实现在 Phase 2 LocalFileStorage API
await Task.CompletedTask;
var storage = new LocalFileStorage();
if (!storage.Exists(EmergencySlot)) return;
string json = await storage.ReadAsync(EmergencySlot);
if (json == null) return;
await storage.WriteAsync(targetSlot, json);
await storage.DeleteAsync(EmergencySlot);
}
}
}