加入很多新内容,这波一块交了
This commit is contained in:
@@ -106,6 +106,18 @@ public class storeSystem : MonoBehaviour
|
||||
RefreshCurrentView();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
if (cachedItems.Count <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LoadAllStoreItems();
|
||||
ApplyPersistedStateToItems();
|
||||
RefreshCurrentView();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
CloseActiveCtas();
|
||||
@@ -333,6 +345,17 @@ public class storeSystem : MonoBehaviour
|
||||
TryCacheStoreItem(itemSO, sourceLabel, uniqueItemIds);
|
||||
}
|
||||
}
|
||||
|
||||
var playerSkillItems = new List<storeItemSO>();
|
||||
PlayerSkillService.AppendDynamicStoreItems(playerSkillItems, coinSprite, materialSprite);
|
||||
for (int i = 0; i < playerSkillItems.Count; i++)
|
||||
{
|
||||
var itemSO = playerSkillItems[i];
|
||||
var sourceLabel = string.IsNullOrEmpty(itemSO != null ? itemSO.name : string.Empty)
|
||||
? "playerSkillStore"
|
||||
: "playerSkillStore/" + itemSO.name;
|
||||
TryCacheStoreItem(itemSO, sourceLabel, uniqueItemIds);
|
||||
}
|
||||
}
|
||||
|
||||
private void TryCacheStoreItem(storeItemSO itemSO, string sourceLabel, HashSet<int> uniqueItemIds)
|
||||
@@ -1044,6 +1067,12 @@ public class storeSystem : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
if (PlayerSkillService.IsPlayerSkillStoreItem(currentSelectedItem))
|
||||
{
|
||||
HandlePlayerSkillStorePurchaseClicked(currentSelectedItem);
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsSelectableEquipmentRewardItem(currentSelectedItem))
|
||||
{
|
||||
HandleSelectableEquipmentPurchaseClicked(currentSelectedItem);
|
||||
@@ -1064,6 +1093,32 @@ public class storeSystem : MonoBehaviour
|
||||
}
|
||||
|
||||
RegisterPurchasedCount(currentSelectedItem.itemID, grantedCount);
|
||||
gItemGet.display(gItemGet.FromStoreItem(currentSelectedItem, grantedCount));
|
||||
RefreshCurrentView();
|
||||
}
|
||||
|
||||
private void HandlePlayerSkillStorePurchaseClicked(storeItemSO itemSO)
|
||||
{
|
||||
if (itemSO == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string failureMessage;
|
||||
gItemGet.ItemEntry rewardEntry;
|
||||
if (!PlayerSkillService.TryPurchasePlayerSkillStoreItem(itemSO, currentPurchaseAmount, out failureMessage, out rewardEntry))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(failureMessage))
|
||||
{
|
||||
gNotice.warning.display(failureMessage);
|
||||
}
|
||||
|
||||
RefreshPurchaseSummary();
|
||||
return;
|
||||
}
|
||||
|
||||
RegisterPurchasedCount(itemSO.itemID, currentPurchaseAmount);
|
||||
gItemGet.display(rewardEntry);
|
||||
RefreshCurrentView();
|
||||
}
|
||||
|
||||
@@ -1087,6 +1142,23 @@ public class storeSystem : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemSO.costRequirements == null || itemSO.costRequirements.Count == 0)
|
||||
{
|
||||
gNotice.warning.display("商品数据丢失");
|
||||
return;
|
||||
}
|
||||
|
||||
var primaryCost = itemSO.costRequirements[0];
|
||||
int totalCost = Mathf.Max(0, primaryCost.amount);
|
||||
string insufficientMessage = primaryCost.currencyType == storeItemSO.CurrencyType.material ? "记忆碎片不足" : "货币不足";
|
||||
|
||||
if (!HasEnoughCurrency(primaryCost.currencyType, totalCost))
|
||||
{
|
||||
gNotice.warning.display(insufficientMessage);
|
||||
RefreshPurchaseSummary();
|
||||
return;
|
||||
}
|
||||
|
||||
bool requireTypeSelection = RequiresTypeSelection(requirement);
|
||||
bool requireSkillSelection = RequiresSkillSelection(requirement);
|
||||
|
||||
@@ -1183,6 +1255,7 @@ public class storeSystem : MonoBehaviour
|
||||
}
|
||||
|
||||
RegisterPurchasedCount(itemSO.itemID, 1);
|
||||
gItemGet.display(gItemGet.FromEquipment(generated, 1));
|
||||
RefreshAllEquipBags();
|
||||
}
|
||||
|
||||
@@ -1492,6 +1565,18 @@ public class storeSystem : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void RefreshPlayerSkillItems()
|
||||
{
|
||||
if (!isActiveAndEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LoadAllStoreItems();
|
||||
ApplyPersistedStateToItems();
|
||||
RefreshCurrentView();
|
||||
}
|
||||
|
||||
private bool TryGetEntry(int itemID, out StoreRuntimeEntry entry)
|
||||
{
|
||||
entry = null;
|
||||
|
||||
Reference in New Issue
Block a user