レシピごとに調理パーフェクト時の商品の売値を指定できるように変更

This commit is contained in:
kimura 2021-11-12 11:06:42 +09:00
parent acf553ec62
commit 985ffa79c8
3 changed files with 23 additions and 3 deletions

View File

@ -419,7 +419,7 @@ public class Market : SingletonMonoBehaviour<Market>
var targetIndex = gameData.ShopStock.FindIndex(data => data.FlavorId == stockData.FlavorId && data.Rarity == stockData.Rarity);
gameData.ShopStock.RemoveAt(targetIndex);
gameData.AddSalesCount(stockData.FlavorId, 1, stockData.Rarity);
coin += productData.price * (1 + rarityData.rate / 100);
coin += productData.GetRarityPrice(rarityData.Rarity);
}
return coin;
}

View File

@ -119,9 +119,8 @@ public class ProductManagement : MonoBehaviour
var tankStock = gameData.StorageTanks.Where(x => x.FlavorId == tankData.FlavorId).Sum(x => x.Stock);
var totalStock = shopStock + tankStock;
var productData = productList.FirstOrDefault(data => data.id == tankData.FlavorId);
var price = productData?.price ?? 0;
List<(ProductRarity rarity, int price, int stock)> raritySummaryData = rarityDataList.Select(x =>
(x.Rarity, price * x.rate / 100, tankData.Stocks.FirstOrDefault(sd => sd.Rarity == x.Rarity)?.Stock ?? 0)
(x.Rarity, productData?.GetRarityPrice(x.Rarity) ?? 0, tankData.Stocks.FirstOrDefault(sd => sd.Rarity == x.Rarity)?.Stock ?? 0)
).ToList();
LocalCacheManager.Save(TankDetailView.TankDetailDataTag, (tankView.TankNumber, totalStock, tankData, productData, raritySummaryData));
TransitionManager.Instance.LoadSceneAdditive(GameScenes.PopcornDescription);

View File

@ -297,6 +297,27 @@ public sealed class ProductData
{
return materialList.Count(material => material.id != Const.NotSetMaterialId);
}
public int GetRarityPrice(ProductRarity rarity)
{
switch (rarity)
{
case ProductRarity.Normal:
return rarity1Price;
case ProductRarity.Yellow:
return rarity2Price;
case ProductRarity.Copper:
return rarity3Price;
case ProductRarity.Silver:
return rarity4Price;
case ProductRarity.Gold:
return rarity5Price;
case ProductRarity.Rainbow:
return rarity6Price;
default:
throw new ArgumentOutOfRangeException(nameof(rarity), rarity, null);
}
}
public Transform GetIconPrefab()
{