From 772de9771823740e49a9c98fdf6258d6f02521c7 Mon Sep 17 00:00:00 2001 From: kimura Date: Mon, 15 Nov 2021 16:41:14 +0900 Subject: [PATCH] =?UTF-8?q?=E6=89=80=E6=8C=81=E9=87=910=E6=95=91=E6=B8=88?= =?UTF-8?q?=E3=81=AE=E5=BA=83=E5=91=8A=E8=A6=96=E8=81=B4=E5=B0=8E=E7=B7=9A?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DebugOption/Scripts/DebugOptionManager.cs | 2 +- .../MyGame/Scenes/Main/Scripts/KitchenManager.cs | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/popcorn/Assets/MyGame/Scenes/DebugOption/Scripts/DebugOptionManager.cs b/popcorn/Assets/MyGame/Scenes/DebugOption/Scripts/DebugOptionManager.cs index 3602f66a..062982cb 100644 --- a/popcorn/Assets/MyGame/Scenes/DebugOption/Scripts/DebugOptionManager.cs +++ b/popcorn/Assets/MyGame/Scenes/DebugOption/Scripts/DebugOptionManager.cs @@ -76,7 +76,7 @@ public class DebugOptionManager : MonoBehaviour resetMaterialButton.OnClickAsObservable().Subscribe(_ => { // 所持素材 - gameData.Material = new List{new MaterialData{Id = 2, Amount = 5}}; + gameData.Material.Clear(); // レシピ gameData.MyRecipes = new[] {Const.DefaultRecipeId}; // フライパン diff --git a/popcorn/Assets/MyGame/Scenes/Main/Scripts/KitchenManager.cs b/popcorn/Assets/MyGame/Scenes/Main/Scripts/KitchenManager.cs index c74ae302..b4533025 100644 --- a/popcorn/Assets/MyGame/Scenes/Main/Scripts/KitchenManager.cs +++ b/popcorn/Assets/MyGame/Scenes/Main/Scripts/KitchenManager.cs @@ -126,7 +126,20 @@ public class KitchenManager : MonoBehaviour // 休憩リワード var remaining = (int) DateTime.FromBinary(gameData.kitchenRefreshTime).Subtract(DateTime.UtcNow).TotalSeconds; - if (remaining > 0 || gameData.isFirstPlay) + + // 商品在庫計算 + var shopStock = gameData.ShopStock.Count; + var tankStock = gameData.StorageTanks.Sum(x => x.Stock); + var totalStock = shopStock + tankStock; + + Debug.Log($"material:{gameData.Material.Sum(data => data.Amount)} coin:{gameData.Coin} stock:{totalStock}"); + if (gameData.Coin + gameData.Material.Sum(data => data.Amount) + totalStock == 0) + { + // 所持金0救済 + adButton.gameObject.SetActive(true); + kitchenView.SetTiredAnimation(); + } + else if (remaining > 0 || gameData.isFirstPlay) { adButton.gameObject.SetActive(false); kitchenView.SetNormalAnimation();