装备系统做了很多

This commit is contained in:
FloatGaming
2026-03-27 08:02:55 +08:00
parent dd205b6cb4
commit 538085b64f
119 changed files with 27552 additions and 1672 deletions
@@ -7,7 +7,8 @@ public static class StoreExpBottlePurchaseService
{
None,
ExpBottle,
GrowthMaterial
GrowthMaterial,
EquipmentConsumable
}
public static bool TryPurchase(Player_SO playerData, storeItemSO itemSO, int packageCount, out string failureMessage, out int grantedCount)
@@ -137,7 +138,8 @@ public static class StoreExpBottlePurchaseService
ConsumableGrantType grantType;
ExpBottleKind bottleKind;
DushMaterialKind materialKind;
if (!TryResolveConsumableGrant(itemSO, out grantType, out bottleKind, out materialKind))
EquipmentConsumableKind equipmentConsumableKind;
if (!TryResolveConsumableGrant(itemSO, out grantType, out bottleKind, out materialKind, out equipmentConsumableKind))
{
failureMessage = "当前未配置发放逻辑";
return false;
@@ -170,7 +172,8 @@ public static class StoreExpBottlePurchaseService
ConsumableGrantType grantType;
ExpBottleKind bottleKind;
DushMaterialKind materialKind;
if (!TryResolveConsumableGrant(itemSO, out grantType, out bottleKind, out materialKind))
EquipmentConsumableKind equipmentConsumableKind;
if (!TryResolveConsumableGrant(itemSO, out grantType, out bottleKind, out materialKind, out equipmentConsumableKind))
{
failureMessage = "当前未配置发放逻辑";
return false;
@@ -190,6 +193,12 @@ public static class StoreExpBottlePurchaseService
return true;
}
if (grantType == ConsumableGrantType.EquipmentConsumable)
{
EquipmentConsumableLedger.EnsureInstance().Add(equipmentConsumableKind, grantedCount);
return true;
}
failureMessage = "当前未配置发放逻辑";
return false;
@@ -224,7 +233,8 @@ public static class StoreExpBottlePurchaseService
ConsumableGrantType grantType;
ExpBottleKind bottleKind;
DushMaterialKind materialKind;
if (!TryResolveConsumableGrant(itemSO, out grantType, out bottleKind, out materialKind))
EquipmentConsumableKind equipmentConsumableKind;
if (!TryResolveConsumableGrant(itemSO, out grantType, out bottleKind, out materialKind, out equipmentConsumableKind))
{
Debug.Log(builder.ToString());
return;
@@ -240,6 +250,16 @@ public static class StoreExpBottlePurchaseService
return;
}
if (grantType == ConsumableGrantType.EquipmentConsumable)
{
builder.Append(" | 装备材料库存=");
builder.Append(EquipmentConsumableCatalog.GetDisplayName(equipmentConsumableKind));
builder.Append(":");
builder.Append(EquipmentConsumableLedger.EnsureInstance().GetCount(equipmentConsumableKind));
Debug.Log(builder.ToString());
return;
}
var snapshot = ExpBottleLedger.EnsureInstance().GetSnapshot();
builder.Append(" | 经验瓶库存:");
@@ -267,11 +287,12 @@ public static class StoreExpBottlePurchaseService
Debug.Log(builder.ToString());
}
private static bool TryResolveConsumableGrant(storeItemSO itemSO, out ConsumableGrantType grantType, out ExpBottleKind bottleKind, out DushMaterialKind materialKind)
private static bool TryResolveConsumableGrant(storeItemSO itemSO, out ConsumableGrantType grantType, out ExpBottleKind bottleKind, out DushMaterialKind materialKind, out EquipmentConsumableKind equipmentConsumableKind)
{
grantType = ConsumableGrantType.None;
bottleKind = default(ExpBottleKind);
materialKind = default(DushMaterialKind);
equipmentConsumableKind = default(EquipmentConsumableKind);
if (itemSO == null)
{
@@ -292,6 +313,13 @@ public static class StoreExpBottlePurchaseService
return true;
}
if (itemSO.associatedEquipmentConsumable != null)
{
grantType = ConsumableGrantType.EquipmentConsumable;
equipmentConsumableKind = itemSO.associatedEquipmentConsumable.consumableKind;
return true;
}
if (StoreExpBottleGrantResolver.TryResolve(itemSO, out bottleKind))
{
grantType = ConsumableGrantType.ExpBottle;