修了不少东西

This commit is contained in:
FloatGaming
2026-07-16 23:04:59 +08:00
parent 29972d0705
commit 73fe474cc6
134 changed files with 7673 additions and 741 deletions
@@ -16,6 +16,8 @@ public sealed class StoreOwnershipLedger : MonoBehaviour
private readonly Dictionary<int, StoreOwnershipEntry> entriesByItemId = new Dictionary<int, StoreOwnershipEntry>();
private readonly List<storeItemSO> cachedStoreItems = new List<storeItemSO>();
private bool initialized;
private bool loadedFromSave;
private bool hasAnyRecoverableLocalState;
private int lastSaveFrame = -1;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
@@ -73,8 +75,8 @@ public sealed class StoreOwnershipLedger : MonoBehaviour
initialized = true;
StoreOwnershipPayload payload;
bool loadedFromSave = StoreOwnershipStorage.TryLoad(out payload);
bool hasAnyRecoverableLocalState = loadedFromSave || StoreOwnershipStorage.HasAnyRecoverableState();
loadedFromSave = StoreOwnershipStorage.TryLoad(out payload);
hasAnyRecoverableLocalState = loadedFromSave || StoreOwnershipStorage.HasAnyRecoverableState();
RebuildFromPayload(payload);
LoadStoreItems();
@@ -208,6 +210,12 @@ public sealed class StoreOwnershipLedger : MonoBehaviour
return;
}
if (!loadedFromSave && hasAnyRecoverableLocalState)
{
Debug.LogWarning("[StoreOwnershipLedger] Recoverable save state exists but could not be loaded; skip saving to avoid overwriting older store ownership data.");
return;
}
if (Application.isPlaying && lastSaveFrame == Time.frameCount)
{
return;