装备系统做了很多
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user