From ae4fe99af211528558eb3bf2f78de8ed1c7ab9d5 Mon Sep 17 00:00:00 2001 From: "xiaohui.wang" Date: Wed, 1 Feb 2023 18:32:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=90=88=E5=B9=B6=E9=94=99?= =?UTF-8?q?=E8=AF=AF=EF=BC=8C=E5=8E=86=E5=8F=B2bug=E6=8E=92=E6=9F=A5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scenes/Main/Scripts/AutoCookDialog.cs | 8 +- .../MyGame/Scenes/Main/Scripts/BulkOrder.cs | 77 ++-------------- .../Scenes/Main/Scripts/BulkOrderItemView.cs | 32 +++---- .../Scenes/Main/Scripts/KitchenManager.cs | 87 ++++++++++--------- .../Scenes/marketing/Scripts/MarketManager.cs | 12 ++- .../marketing/Scripts/ProductManagement.cs | 9 +- .../Scenes/marketing/Scripts/ShopLevelUp.cs | 5 +- .../Scenes/recipe/Scripts/RecipeDetailView.cs | 16 ++-- .../Scenes/shopping/Scripts/ShopItemView.cs | 19 ++-- .../Scenes/shopping/Scripts/Shopping.cs | 25 +++--- 10 files changed, 104 insertions(+), 186 deletions(-) diff --git a/popcorn/Assets/MyGame/Scenes/Main/Scripts/AutoCookDialog.cs b/popcorn/Assets/MyGame/Scenes/Main/Scripts/AutoCookDialog.cs index 2aebb719..47f05a7a 100644 --- a/popcorn/Assets/MyGame/Scenes/Main/Scripts/AutoCookDialog.cs +++ b/popcorn/Assets/MyGame/Scenes/Main/Scripts/AutoCookDialog.cs @@ -30,12 +30,10 @@ namespace MyGame.Scenes.Main.Scripts var globalGameData = GameDataManager.GameData; var cityGameData = GameDataManager.GetCurrentCityGameData(); var autoCookDataList = SpreadsheetDataManager.Instance.GetBaseDataList(Const.AutoCookDataSheet); -<<<<<<< HEAD - var autoCookData = autoCookDataList.First(data => data.level == gameData.AutoCookLevel); - autoCookData.duration = JoypacUtils.OnlineParametersIntByJoypacSDK(StaticOnlineParams.AutoCookTime); -======= + var autoCookData = autoCookDataList.First(data => data.level == cityGameData.AutoCookLevel); ->>>>>>> 7b224dab5735239a8687b5f2086eeebdba0978cc + autoCookData.duration = JoypacUtils.OnlineParametersIntByJoypacSDK(StaticOnlineParams.AutoCookTime); + var maxLevel = autoCookDataList.Last().level; var isMaxLevel = autoCookData.level >= maxLevel; diff --git a/popcorn/Assets/MyGame/Scenes/Main/Scripts/BulkOrder.cs b/popcorn/Assets/MyGame/Scenes/Main/Scripts/BulkOrder.cs index e3740897..869ac325 100644 --- a/popcorn/Assets/MyGame/Scenes/Main/Scripts/BulkOrder.cs +++ b/popcorn/Assets/MyGame/Scenes/Main/Scripts/BulkOrder.cs @@ -146,24 +146,18 @@ public class BulkOrder : MonoBehaviour var orderList = bulkOrderData.OrderList; for (var i = 0; i < itemViews.Length; i++) { -<<<<<<< HEAD - var countByVolume = bulkOrderData.count1 / data1.volume; - var productData = new ProductData(data1, countByVolume); - productData.volume *= countByVolume; - itemView1.SetData(productData,1); - if (gameData.CompletedProductList.FirstOrDefault(data => data.Number == 1) is BulkOrderResultData resultData) -======= + itemViews[i].gameObject.SetActive(true); var orderTuple = orderList[i]; if (productList.FirstOrDefault(data => data.id == orderTuple.productId) is not { } productData) ->>>>>>> 7b224dab5735239a8687b5f2086eeebdba0978cc + { itemViews[i].gameObject.SetActive(false); continue; } var countByVolume = orderTuple.count / productData.volume; var bulkProductData = new ProductData(productData, countByVolume){volume = productData.volume * countByVolume}; - itemViews[i].SetData(bulkProductData); + itemViews[i].SetData(bulkProductData,i+1); if (cityGameData.CompletedProductList.FirstOrDefault(data => data.Number == orderTuple.id) is { } resultData) { itemViews[i].SetCooked(resultData.Rarity); @@ -179,70 +173,9 @@ public class BulkOrder : MonoBehaviour LocalCacheManager.Save(MaterialNumberTag, orderTuple.id); LocalCacheManager.Save(PopcornGameManager.CookingDataTag, bulkProductData); RecipeDetailView.ShowDialog(); -<<<<<<< HEAD - }).AddTo(itemView1); - itemView1.gameObject.SetActive(true); - } - else - { - itemView1.gameObject.SetActive(false); - } - if (productList.FirstOrDefault(data => data.id == bulkOrderData.productId2) is ProductData data2) - { - var countByVolume = bulkOrderData.count2 / data2.volume; - var productData = new ProductData(data2, countByVolume); - productData.volume *= countByVolume; - itemView2.SetData(productData,2); - if (gameData.CompletedProductList.FirstOrDefault(data => data.Number == 2) is BulkOrderResultData resultData) - { - itemView2.SetCooked(resultData.Rarity); - } - else - { - itemView2.SetButtonActive(itemView2.CheckAmount(productData)); - } - itemView2.CookingButton.ThrottleFirst(TimeSpan.FromSeconds(1f)).Subscribe(_ => - { - LocalCacheManager.Save(Const.ProductViewTypeTag, ProductViewType.BulkOrder); - LocalCacheManager.Save(MaterialNumberTag, 2); - LocalCacheManager.Save(PopcornGameManager.CookingDataTag, productData); - RecipeDetailView.ShowDialog(); - }).AddTo(itemView2); - itemView2.gameObject.SetActive(true); - } - else - { - itemView2.gameObject.SetActive(false); - } - if (productList.FirstOrDefault(data => data.id == bulkOrderData.productId3) is ProductData data3) - { - var countByVolume = bulkOrderData.count3 / data3.volume; - var productData = new ProductData(data3, countByVolume); - productData.volume *= countByVolume; - itemView3.SetData(productData,3); - if (gameData.CompletedProductList.FirstOrDefault(data => data.Number == 3) is BulkOrderResultData resultData) - { - itemView3.SetCooked(resultData.Rarity); - } - else - { - itemView3.SetButtonActive(itemView3.CheckAmount(productData)); - } - itemView3.CookingButton.ThrottleFirst(TimeSpan.FromSeconds(1f)).Subscribe(_ => - { - LocalCacheManager.Save(Const.ProductViewTypeTag, ProductViewType.BulkOrder); - LocalCacheManager.Save(MaterialNumberTag, 3); - LocalCacheManager.Save(PopcornGameManager.CookingDataTag, productData); - RecipeDetailView.ShowDialog(); - }).AddTo(itemView3); - itemView3.gameObject.SetActive(true); - } - else - { - itemView3.gameObject.SetActive(false); -======= + }).AddTo(itemViews[i]); ->>>>>>> 7b224dab5735239a8687b5f2086eeebdba0978cc + } } diff --git a/popcorn/Assets/MyGame/Scenes/Main/Scripts/BulkOrderItemView.cs b/popcorn/Assets/MyGame/Scenes/Main/Scripts/BulkOrderItemView.cs index bf2d0980..5f5b8229 100644 --- a/popcorn/Assets/MyGame/Scenes/Main/Scripts/BulkOrderItemView.cs +++ b/popcorn/Assets/MyGame/Scenes/Main/Scripts/BulkOrderItemView.cs @@ -169,8 +169,10 @@ public class BulkOrderItemView : MonoBehaviour ShopItemPurchaseView.ShowDialog((shopData, Shopping.GetItemAmount(shopData)), (amount, amount1) => { + + var globalGameData = GameDataManager.GameData; // アイテムを増やす - Shopping.AddItem(shopData, amount); + Shopping.AddItem(shopData, amount, globalGameData.CurrentCityId); if (amount1 != -1) { @@ -222,56 +224,42 @@ public class BulkOrderItemView : MonoBehaviour public bool CheckAmount(ProductData productData) { -<<<<<<< HEAD - var flag = true; var gameData = GameDataManager.GameData; - if (gameData.CornSeed < productData.MaterialList[0].amount) + var (corn, flavor1, flavor2) = RecipeView.CheckAmount(productData); + if (!corn) { - flag = false; cornText.color = redColor; } else { cornText.color = new Color(110 / 255f, 76 / 255f, 49 / 255f); } - if ((gameData.Material.FirstOrDefault(data => data.Id == productData.MaterialList[1].id)?.Amount ?? 0) < productData.MaterialList[1].amount) + if (!flavor1) { - flag = false; material1Text.color = redColor; } else { material1Text.color = new Color(110 / 255f, 76 / 255f, 49 / 255f); } - if (productData.GetMaterialCount() == 3 && (gameData.Material.FirstOrDefault(data => data.Id == productData.MaterialList[2].id)?.Amount ?? 0) < productData.MaterialList[2].amount) + if (!flavor2) { - flag = false; + material2Text.color = redColor; } else { material2Text.color = new Color(110 / 255f, 76 / 255f, 49 / 255f); } - return flag; -======= - var (corn, flavor1, flavor2) = RecipeView.CheckAmount(productData); - if (!corn) cornText.color = redColor; - if (!flavor1) material1Text.color = redColor; - if (!flavor2) material2Text.color = redColor; return corn & flavor1 & flavor2; ->>>>>>> 7b224dab5735239a8687b5f2086eeebdba0978cc } public void SetButtonActive(bool active) { - cookingButton.gameObject.SetActive(active); -<<<<<<< HEAD - disabledObject.gameObject.SetActive(!active); -======= - disabledObject.SetActive(!active); cookedObject.SetActive(false); perfectCookedObject.SetActive(false); ->>>>>>> 7b224dab5735239a8687b5f2086eeebdba0978cc + cookingButton.gameObject.SetActive(active); + disabledObject.gameObject.SetActive(!active); } public void SetCooked(ProductRarity rarity) diff --git a/popcorn/Assets/MyGame/Scenes/Main/Scripts/KitchenManager.cs b/popcorn/Assets/MyGame/Scenes/Main/Scripts/KitchenManager.cs index d24bc482..53af958c 100644 --- a/popcorn/Assets/MyGame/Scenes/Main/Scripts/KitchenManager.cs +++ b/popcorn/Assets/MyGame/Scenes/Main/Scripts/KitchenManager.cs @@ -32,16 +32,17 @@ public class KitchenManager : MonoBehaviour private readonly Subject showAdDialogSubject = new Subject(); private IDisposable timerDisposable = null; private IDisposable tapPhoneDisposable; -<<<<<<< HEAD + bool isshowad = false; -======= + private GameData globalGameData; private GameData cityGameData; - ->>>>>>> 7b224dab5735239a8687b5f2086eeebdba0978cc // Start is called before the first frame update + + public static Action CoinCold=null; + void Start() { showAdDialogSubject.AddTo(this); @@ -133,7 +134,7 @@ public class KitchenManager : MonoBehaviour // バイト有効時は自動調理と大量注文が非表示 partTimerButtonView.gameObject.SetActive(isPartTimer); orderIndicatorView.gameObject.SetActive(!isPartTimer); - autoCookView.SetActive(!isPartTimer && cityGameData.ViewedShopLevel >= Const.AutoCookAvailableLevel); + // autoCookView.SetActive(!isPartTimer && cityGameData.ViewedShopLevel >= Const.AutoCookAvailableLevel); kitchenView.SetActive(!isPartTimer); // 大量注文の調理から戻ってきたときにダイアログ開く @@ -144,12 +145,8 @@ public class KitchenManager : MonoBehaviour // 自動調理 autoCookView.Initialize(); -<<<<<<< HEAD - // レベル確認 - autoCookView.SetActive(gameData.ViewedShopLevel >= JoypacUtils.OnlineParametersIntByJoypacSDK(StaticOnlineParams.AutoCookLevel)); - -======= ->>>>>>> 7b224dab5735239a8687b5f2086eeebdba0978cc + autoCookView.SetActive(cityGameData.ViewedShopLevel >= JoypacUtils.OnlineParametersIntByJoypacSDK(StaticOnlineParams.AutoCookLevel)); + var autoCookDataList = SpreadsheetDataManager.Instance.GetBaseDataList(Const.AutoCookDataSheet); if (autoCookDataList.FirstOrDefault(data => data.level == cityGameData.AutoCookLevel) is AutoCookData autoCookData) { @@ -281,11 +278,10 @@ public class KitchenManager : MonoBehaviour } kitchenView.SetActive(true); CheckOrderAndSetPhoneTap(); -<<<<<<< HEAD - autoCookView.SetActive(gameData.ViewedShopLevel >= JoypacUtils.OnlineParametersIntByJoypacSDK(StaticOnlineParams.AutoCookLevel)); -======= - autoCookView.SetActive(cityGameData.ViewedShopLevel >= Const.AutoCookAvailableLevel); ->>>>>>> 7b224dab5735239a8687b5f2086eeebdba0978cc + autoCookView.SetActive(cityGameData.ViewedShopLevel >= JoypacUtils.OnlineParametersIntByJoypacSDK(StaticOnlineParams.AutoCookLevel)); + + //autoCookView.SetActive(cityGameData.ViewedShopLevel >= Const.AutoCookAvailableLevel); + }); }).AddTo(this); @@ -318,27 +314,23 @@ public class KitchenManager : MonoBehaviour CoinGetDialog.ShowDialog(refreshRewardCoin, () => { CoinManager.Instance.AddCoin(refreshRewardCoin); -<<<<<<< HEAD - gameData.Coin = CoinManager.Instance.OwnCoin; - gameData.kitchenRefreshTime = DateTime.UtcNow.AddSeconds(refreshWaitTime).ToBinary(); -#if UNITY_EDITOR - gameData.kitchenRefreshTime = DateTime.UtcNow.AddSeconds(10).ToBinary(); -#endif -======= + cityGameData.Coin = CoinManager.Instance.OwnCoin; globalGameData.kitchenRefreshTime = DateTime.UtcNow.AddSeconds(refreshWaitTime).ToBinary(); ->>>>>>> 7b224dab5735239a8687b5f2086eeebdba0978cc +#if UNITY_EDITOR + globalGameData.kitchenRefreshTime = DateTime.UtcNow.AddSeconds(10).ToBinary(); +#endif + + GameDataManager.SaveGameData(); // SetTimer((int)refreshWaitTime); adButton.gameObject.SetActive(false); -<<<<<<< HEAD + isshowad = false; StartCoroutine(TimeCountDown()); - if (gameData.kitchenRefreshTime % 10 < livelyRate) -======= + if (globalGameData.kitchenRefreshTime % 10 < livelyRate) ->>>>>>> 7b224dab5735239a8687b5f2086eeebdba0978cc { kitchenView.SetLivelyAnimation(); } @@ -353,21 +345,15 @@ public class KitchenManager : MonoBehaviour // 休憩リワード var remaining = (int) DateTime.FromBinary(globalGameData.kitchenRefreshTime).Subtract(DateTime.UtcNow).TotalSeconds; // timerDisposable = SetTimer(remaining); -<<<<<<< HEAD + StartCoroutine(TimeCountDown()); - // 商品在庫計算 - var shopStock = gameData.ShopStock.Count; - var tankStock = gameData.StorageTanks.Sum(x => x.Stock); -======= - // 商品在庫計算 var shopStock = cityGameData.ShopStock.Count; var tankStock = cityGameData.StorageTanks.Sum(x => x.Stock); ->>>>>>> 7b224dab5735239a8687b5f2086eeebdba0978cc var totalStock = shopStock + tankStock; if (remaining <= 0 && globalGameData.FinishedFlags.HasFlag(TutorialFlag.FirstPlay)) @@ -382,16 +368,15 @@ public class KitchenManager : MonoBehaviour // 所持金0救済 adButton.gameObject.SetActive(true); kitchenView.SetNormalAnimation(); -<<<<<<< HEAD - showAdDialogSubject.OnNext(Unit.Default); + isshowad = true; -======= + // 達成報酬とかぶる場合考慮 if (!isPartTimer) { showAdDialogSubject.OnNext(Unit.Default); } ->>>>>>> 7b224dab5735239a8687b5f2086eeebdba0978cc + } else if (remaining > 0) { @@ -486,7 +471,7 @@ public class KitchenManager : MonoBehaviour adButton.gameObject.SetActive(true); }).AddTo(this); } -<<<<<<< HEAD + IEnumerator TimeCountDown() @@ -551,7 +536,25 @@ public class KitchenManager : MonoBehaviour { SoundManager.Instance.StopSE("se_Main_phone_sound"); } + CoinCold = null; + } + private void Awake() + { + CoinCold = () => { + // SetTimer((int)refreshWaitTime); + adButton.gameObject.SetActive(false); + + isshowad = false; + StartCoroutine(TimeCountDown()); + + if (globalGameData.kitchenRefreshTime % 10 < livelyRate) + { + kitchenView.SetLivelyAnimation(); + } + else + { + kitchenView.SetNormalAnimation(); + } + }; } -======= ->>>>>>> 7b224dab5735239a8687b5f2086eeebdba0978cc } diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketManager.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketManager.cs index eb4be167..00e51da4 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketManager.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/MarketManager.cs @@ -79,10 +79,9 @@ public class MarketManager : MonoBehaviour } } -<<<<<<< HEAD int refreshRewardCoin = UnityEngine.Random.Range(10, 30); - var isTutorial = gameData.FinishedFlags.HasFlag(TutorialFlag.FirstPlay); + var isTutorial = globalGameData.FinishedFlags.HasFlag(TutorialFlag.FirstPlay); if (JoypacAnalyticsManager.Push1 && isTutorial) { JoypacAnalyticsManager.Push1 = false; @@ -90,15 +89,15 @@ public class MarketManager : MonoBehaviour { CoinManager.Instance.AddCoin(refreshRewardCoin); - gameData.Coin = CoinManager.Instance.OwnCoin; + cityGameData.Coin = CoinManager.Instance.OwnCoin; GameDataManager.SaveGameData(); - + }, false); } - if (!gameData.FinishedFlags.HasFlag(TutorialFlag.FirstPlay)) -======= + + // 最新の都市ではない場合、バイトが有効 if (!market.IsLatestCity) { @@ -135,7 +134,6 @@ public class MarketManager : MonoBehaviour } if (!globalGameData.FinishedFlags.HasFlag(TutorialFlag.FirstPlay)) ->>>>>>> 7b224dab5735239a8687b5f2086eeebdba0978cc { if (TutorialManager.Instance.Index == 3) { diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagement.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagement.cs index bc432fdb..1beb6f4f 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagement.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagement.cs @@ -105,7 +105,6 @@ public class ProductManagement : MonoBehaviour cityGameData.StorageTanks.Add(new StorageTank { Capacity = Const.TankCapacity }); tankView.SetData(cityGameData.StorageTanks[tankView.TankNumber - 1]); tankView.SetState(TankState.Unlock); -<<<<<<< HEAD if (amount2 != -1) { CoinManager.Instance.SubCoin(amount2); @@ -115,12 +114,10 @@ public class ProductManagement : MonoBehaviour CoinManager.Instance.SubCoin(shopData.price); } - - gameData.Coin = CoinManager.Instance.OwnCoin; -======= - CoinManager.Instance.SubCoin(price); + + // CoinManager.Instance.SubCoin(price); cityGameData.Coin = CoinManager.Instance.OwnCoin; ->>>>>>> 7b224dab5735239a8687b5f2086eeebdba0978cc + GameDataManager.SaveGameData(); // 次に大きいタンクの購入ボタンを表示 if (tankView.TankNumber + 1 <= tankList.Count) diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopLevelUp.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopLevelUp.cs index 723f0caa..a8e66501 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopLevelUp.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopLevelUp.cs @@ -35,14 +35,11 @@ public class ShopLevelUp : MonoBehaviour var shopLevelData = shopLevelList.FirstOrDefault(data => data.shopLevel == shopLevel); var targetScriptList = scriptList.Where(data => data.id == shopLevelData?.scriptDataId).ToList(); shopLevelText.text = shopLevel.ToString(); -<<<<<<< HEAD string position =String.Format( StaticStringsEvent.x, shopLevel); JoypacAnalyticsManager.DesignEvent(StaticStringsEvent.Stage, StaticStringsEvent.Level, position); - achievementText.text = shopLevelList.FirstOrDefault(data => data.shopLevel == shopLevel)?.Achievement ?? ""; -======= achievementText.text = shopLevelData?.Achievement ?? ""; ->>>>>>> 7b224dab5735239a8687b5f2086eeebdba0978cc + recipeNameText.text = productData?.Name ?? ""; GameDataManager.GameData.ViewedShopLevel = shopLevel; diff --git a/popcorn/Assets/MyGame/Scenes/recipe/Scripts/RecipeDetailView.cs b/popcorn/Assets/MyGame/Scenes/recipe/Scripts/RecipeDetailView.cs index 29a62096..70d3e54b 100644 --- a/popcorn/Assets/MyGame/Scenes/recipe/Scripts/RecipeDetailView.cs +++ b/popcorn/Assets/MyGame/Scenes/recipe/Scripts/RecipeDetailView.cs @@ -113,10 +113,10 @@ public class RecipeDetailView : MonoBehaviour }).AddTo(this); } -<<<<<<< HEAD + void onClichJump(ProductData productData) { - var checkResult = CheckAmount(productData); + var checkResult = CheckAmount(productData, GameDataManager.GameData.CurrentCityId); if (!checkResult.material1) { GetRewardDialog.ShowCollectCornDialog(() => @@ -213,8 +213,10 @@ public class RecipeDetailView : MonoBehaviour ShopItemPurchaseView.ShowDialog((shopData, Shopping.GetItemAmount(shopData)), (amount, amount1) => { + var globalGameData = GameDataManager.GameData; + // アイテムを増やす - Shopping.AddItem(shopData, amount); + Shopping.AddItem(shopData, amount, globalGameData.CurrentCityId); if (amount1 != -1) { @@ -238,10 +240,8 @@ public class RecipeDetailView : MonoBehaviour - public static void ConsumeMaterial(ProductData productData) -======= + public static void ConsumeMaterial(ProductData productData, int cityId) ->>>>>>> 7b224dab5735239a8687b5f2086eeebdba0978cc { var cityGameData = GameDataManager.GetCityGameData(cityId); cityGameData.CornSeed -= productData.MaterialList[0].amount; @@ -374,4 +374,8 @@ public class RecipeDetailView : MonoBehaviour LocalCacheManager.Save(CallbackTag, onClose); TransitionManager.Instance.LoadSceneAdditive(GameScenes.RecipeChoice); } + private void OnDestroy() + { + ShopItemPurchaseView.refashStart = null; + } } \ No newline at end of file diff --git a/popcorn/Assets/MyGame/Scenes/shopping/Scripts/ShopItemView.cs b/popcorn/Assets/MyGame/Scenes/shopping/Scripts/ShopItemView.cs index 2b0f383f..52e03ade 100644 --- a/popcorn/Assets/MyGame/Scenes/shopping/Scripts/ShopItemView.cs +++ b/popcorn/Assets/MyGame/Scenes/shopping/Scripts/ShopItemView.cs @@ -103,18 +103,11 @@ public class ShopItemView : MonoBehaviour var totalAdCount = GameDataManager.GameData.GetTotalAdCount(); purchaseObject.SetActive(shopData.Category != ItemCategory.Recipe); exchangeObject.SetActive(shopData.Category == ItemCategory.Recipe); -<<<<<<< HEAD - progressBar.value = Mathf.InverseLerp(0, shopData.price, GameDataManager.GameData.adCount); - progressText.text = string.Format(ProgressFormat, GameDataManager.GameData.adCount, shopData.price); - - - onObject.SetActive(shopData.price <= GameDataManager.GameData.adCount); -======= progressBar.value = Mathf.InverseLerp(0, shopData.price, totalAdCount); progressText.text = string.Format(ProgressFormat, totalAdCount, shopData.price); onObject.SetActive(shopData.price <= totalAdCount); ->>>>>>> 7b224dab5735239a8687b5f2086eeebdba0978cc + offObject.SetActive(!onObject.activeSelf); if ((shopData.id == 14|| shopData.id == 15) && GetItemAmount(shopData) > 0) { @@ -144,7 +137,15 @@ public class ShopItemView : MonoBehaviour offObject.SetActive(false); soldOutObject.SetActive(true); } - SetItemActive(shopData.price <= CoinManager.Instance.OwnCoin); + if (shopData.ConsumeType!= ShopItemType.NonConsumable) + { + SetItemActive(shopData.price <= CoinManager.Instance.OwnCoin); + } + else + { + SetStockCount(GetItemAmount(shopData)); + + } //var gameData = GameDataManager.GameData; //if (shopData.price <= gameData.Coin&& (TransitionManager.Instance.JumpId!=-1|| TransitionManager.Instance.JumpId2 != -1)) //{ diff --git a/popcorn/Assets/MyGame/Scenes/shopping/Scripts/Shopping.cs b/popcorn/Assets/MyGame/Scenes/shopping/Scripts/Shopping.cs index 5e358935..8cf39f3f 100644 --- a/popcorn/Assets/MyGame/Scenes/shopping/Scripts/Shopping.cs +++ b/popcorn/Assets/MyGame/Scenes/shopping/Scripts/Shopping.cs @@ -71,8 +71,9 @@ public class Shopping : MonoBehaviour } ShopItemPurchaseView.ShowDialog((shopData, GetItemAmount(shopData)), (amount,amount1) => { + var globalGameData = GameDataManager.GameData; // アイテムを増やす - AddItem(shopData, amount); + AddItem(shopData, amount, globalGameData.CurrentCityId); itemView.SetStockCount(GetItemAmount(shopData)); if (amount1 != -1) { @@ -84,9 +85,9 @@ public class Shopping : MonoBehaviour } - - gameData.Coin = CoinManager.Instance.OwnCoin; - changeCoinSubject.OnNext(gameData.Coin); + + cityGameData.Coin = CoinManager.Instance.OwnCoin; + changeCoinSubject.OnNext(cityGameData.Coin); GameDataManager.SaveGameData(); if (isTutorial) @@ -94,7 +95,7 @@ public class Shopping : MonoBehaviour TutorialManager.Instance.ShowTutorialConversation(8, () => { isTutorial = false; - gameData.FinishedFlags |= TutorialFlag.Shopping; + cityGameData.FinishedFlags |= TutorialFlag.Shopping; GameDataManager.SaveGameData(); }); } @@ -119,7 +120,7 @@ public class Shopping : MonoBehaviour // アイテムを増やす AddItem(shopData, amount, globalGameData.CurrentCityId); itemView.SetStockCount(GetItemAmount(shopData)); -<<<<<<< HEAD + if (amount1 != -1) { CoinManager.Instance.SubCoin(amount1 * amount); @@ -129,13 +130,9 @@ public class Shopping : MonoBehaviour CoinManager.Instance.SubCoin(shopData.price * amount); } - gameData.Coin = CoinManager.Instance.OwnCoin; - changeCoinSubject.OnNext(gameData.Coin); -======= - CoinManager.Instance.SubCoin(shopData.price * amount); cityGameData.Coin = CoinManager.Instance.OwnCoin; changeCoinSubject.OnNext(cityGameData.Coin); ->>>>>>> 7b224dab5735239a8687b5f2086eeebdba0978cc + GameDataManager.SaveGameData(); if (isTutorial) @@ -183,8 +180,9 @@ public class Shopping : MonoBehaviour ShopItemExchangeView.ShowDialog(shopData, () => { CryptoPrefs.SetInt("ShowButterDialog", 1); + var globalGameData = GameDataManager.GameData; // アイテムを増やす - AddItem(shopData, 1); + AddItem(shopData, 1,globalGameData.CurrentCityId); itemView.SetStockCount(GetItemAmount(shopData)); GameDataManager.SaveGameData(); recipeNotifyIcon.SetActive(CheckEarnedRecipe()); @@ -198,9 +196,10 @@ public class Shopping : MonoBehaviour { ShopItemExchangeView.ShowDialog(shopData, () => { + var globalGameData = GameDataManager.GameData; CryptoPrefs.SetInt("ShowStrawBerryDialog", 1); // アイテムを増やす - AddItem(shopData, 1); + AddItem(shopData, 1,globalGameData.CurrentCityId); itemView.SetStockCount(GetItemAmount(shopData)); GameDataManager.SaveGameData(); recipeNotifyIcon.SetActive(CheckEarnedRecipe());