ポップコーン販売数の保存処理追加
This commit is contained in:
parent
85709df1b1
commit
02ba3c8c68
|
|
@ -138,8 +138,8 @@ public class Market : MonoBehaviour
|
|||
if (gameData.ShopStock.Count == 0)
|
||||
{
|
||||
shopState.Value = ShopState.Close;
|
||||
}
|
||||
var coin = 0;
|
||||
}
|
||||
|
||||
var orders = new List<int>();
|
||||
var dontBuyCustomerList = new List<CustomerController>();
|
||||
foreach (var controller in customers)
|
||||
|
|
@ -178,12 +178,12 @@ public class Market : MonoBehaviour
|
|||
}
|
||||
|
||||
// 購入
|
||||
var flavors = orders.Select(x => (displayFlavors[x], 0)).ToList();
|
||||
var flavors = orders.Select(x => (displayFlavors[x], ProductRarity.Normal)).ToList();
|
||||
#if UNITY_EDITOR
|
||||
Debug.Log($"bb order: {orders.Count} {orders.Aggregate("", (s, i) => $"{s},{i}")}");
|
||||
Debug.Log($"bb shuffledOrder:{shuffledOrder.Count} {shuffledOrder.Aggregate("", (s, i) => $"{s},{i}")}");
|
||||
#endif
|
||||
coin += SellPopcorn(flavors);
|
||||
var coin = SellPopcorn(flavors);
|
||||
var remainStockCount = gameData.ShopStock.Count;
|
||||
|
||||
// 自動補充 refill
|
||||
|
|
@ -457,7 +457,7 @@ public class Market : MonoBehaviour
|
|||
}).AddTo(this);
|
||||
}
|
||||
|
||||
private int SellPopcorn(List<(int flavor, int bonusRate)> flavors)
|
||||
private int SellPopcorn(List<(int flavor, ProductRarity rarity)> flavors)
|
||||
{
|
||||
var gameData = GameDataManager.GameData;
|
||||
// 品切れ
|
||||
|
|
@ -467,14 +467,17 @@ public class Market : MonoBehaviour
|
|||
}
|
||||
|
||||
// フレーバーを売る
|
||||
var recipeList = RecipeData.GetAllRecipe();
|
||||
var rarityList = SpreadsheetDataManager.Instance.GetBaseDataList<RarityData>(Const.RarityDataSheet);
|
||||
var coin = 0;
|
||||
foreach (var flavorData in flavors)
|
||||
{
|
||||
var targetIndex = gameData.ShopStock.FindIndex(x => x == flavorData.flavor);
|
||||
var flavorRecipe = RecipeData.GetAllRecipe().First(x => x.RecipeId == gameData.ShopStock[targetIndex]);
|
||||
var flavorRecipe = recipeList.First(data => data.RecipeId == gameData.ShopStock[targetIndex]);
|
||||
var rarityData = rarityList.First(data => data.Rarity == flavorData.rarity);
|
||||
gameData.ShopStock.RemoveAt(targetIndex);
|
||||
var bonusRate = 0;
|
||||
coin += flavorRecipe.Price * (1 + bonusRate / 100);
|
||||
gameData.AddSalesCount(flavorData.flavor, 1, flavorData.rarity);
|
||||
coin += flavorRecipe.Price * (1 + rarityData.rate / 100);
|
||||
}
|
||||
return coin;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue