加入用户最近100场战绩记录并实现展示

This commit is contained in:
FloatGaming
2026-03-16 23:18:58 +08:00
parent ec42f2e34b
commit f5c6f143c0
106 changed files with 12120 additions and 642 deletions
+26 -14
View File
@@ -9,6 +9,8 @@ public class storeSystem : MonoBehaviour
{
private const string ShowOnlyPurchasablePrefKey = "store.show_only_can_purchase";
private const string SortDropdownPrefKey = "store.sort_dropdown_value";
private const string StoreStateSaveCategory = "store_state";
private const string StoreStateSaveKey = "runtime";
[Header("Player Data")]
[SerializeField] private Player_SO playerData;
@@ -66,7 +68,7 @@ public class storeSystem : MonoBehaviour
private bool suppressAmountInputCallback;
private Color defaultSumCostColor = Color.white;
private string SaveFilePath
private string LegacySaveFilePath
{
get { return Path.Combine(Application.persistentDataPath, "storeSystem_state.json"); }
}
@@ -88,6 +90,7 @@ public class storeSystem : MonoBehaviour
{
PlayerEconomyLedger.EnsureInstance().AttachPlayerData(playerData);
ExpBottleLedger.EnsureInstance().AttachPlayerData(playerData);
StoreOwnershipLedger.EnsureInstance().InitializeIfNeeded();
ResetPriceImageObjects();
LoadFilterPreferences();
SetDefaultToggleState();
@@ -619,6 +622,7 @@ public class storeSystem : MonoBehaviour
{
return itemSO != null
&& itemSO.canbepurchased
&& !IsAssociatedContentUnlocked(itemSO)
&& !IsSoldOut(itemSO)
&& HasCoinRequirement(itemSO);
}
@@ -1019,7 +1023,7 @@ public class storeSystem : MonoBehaviour
}
RegisterPurchasedCount(currentSelectedItem.itemID, grantedCount);
RefreshPurchaseSummary();
RefreshCurrentView();
}
private string GetAmountAndQuotaText(storeItemSO itemSO)
@@ -1060,7 +1064,7 @@ public class storeSystem : MonoBehaviour
private string GetPriceAmountText(storeItemSO itemSO)
{
if (itemSO == null || !itemSO.canbepurchased || !HasCoinRequirement(itemSO))
if (itemSO == null || !itemSO.canbepurchased || IsAssociatedContentUnlocked(itemSO) || !HasCoinRequirement(itemSO))
{
return "不可购买";
}
@@ -1070,7 +1074,7 @@ public class storeSystem : MonoBehaviour
private bool ShouldShowPriceIcon(storeItemSO itemSO)
{
return itemSO != null && itemSO.canbepurchased && HasCoinRequirement(itemSO);
return itemSO != null && itemSO.canbepurchased && !IsAssociatedContentUnlocked(itemSO) && HasCoinRequirement(itemSO);
}
private bool CanPurchaseCurrentSelection(storeItemSO itemSO)
@@ -1091,6 +1095,7 @@ public class storeSystem : MonoBehaviour
private void SetupAvailabilityState(storeItemPrefab itemView, storeItemSO itemSO)
{
bool isSoldOut = IsSoldOut(itemSO);
bool alreadyUnlocked = IsAssociatedContentUnlocked(itemSO);
bool cannotPurchase = !itemSO.canbepurchased;
if (itemView.leftCorner_statusImage != null)
@@ -1100,7 +1105,7 @@ public class storeSystem : MonoBehaviour
if (itemView.lock_cannotClickImage != null)
{
itemView.lock_cannotClickImage.SetActive(isSoldOut || cannotPurchase);
itemView.lock_cannotClickImage.SetActive(isSoldOut || cannotPurchase || alreadyUnlocked);
}
if (itemView.why_cannot_buy != null)
@@ -1109,6 +1114,10 @@ public class storeSystem : MonoBehaviour
{
itemView.why_cannot_buy.text = "已售罄";
}
else if (alreadyUnlocked)
{
itemView.why_cannot_buy.text = "已解锁";
}
else if (cannotPurchase)
{
itemView.why_cannot_buy.text = "物品未上架";
@@ -1138,6 +1147,11 @@ public class storeSystem : MonoBehaviour
return itemSO.purchasedCount >= itemSO.itemPurchaseQuota;
}
private bool IsAssociatedContentUnlocked(storeItemSO itemSO)
{
return StoreOwnershipLedger.EnsureInstance().IsOwned(itemSO);
}
private void HandleItemClicked(storeItemPrefab itemView)
{
if (itemView == null || itemView.thisItemSO == null)
@@ -1232,15 +1246,14 @@ public class storeSystem : MonoBehaviour
{
persistedState = new StoreRuntimeSaveData();
if (!File.Exists(SaveFilePath))
{
return;
}
try
{
var json = File.ReadAllText(SaveFilePath);
var loadedData = JsonUtility.FromJson<StoreRuntimeSaveData>(json);
StoreRuntimeSaveData loadedData;
if (!SecureSaveVault.TryLoadJson(StoreStateSaveCategory, StoreStateSaveKey, out loadedData, LegacySaveFilePath))
{
return;
}
if (loadedData != null && loadedData.entries != null)
{
persistedState = loadedData;
@@ -1307,8 +1320,7 @@ public class storeSystem : MonoBehaviour
try
{
NormalizePersistedEntries();
var json = JsonUtility.ToJson(persistedState, true);
File.WriteAllText(SaveFilePath, json);
SecureSaveVault.SaveJson(StoreStateSaveCategory, StoreStateSaveKey, persistedState, LegacySaveFilePath);
#if UNITY_EDITOR
PersistStateBackToEditorAssets();
#endif