From d5f71abd2eb523d3a0497b7a810e6f90208fd9cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=8C=90=EB=8F=8C?= Date: Sat, 23 Mar 2024 18:18:46 +0900 Subject: [PATCH] =?UTF-8?q?=EC=83=81=EC=A0=90=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Client/Assets/1_Script/MainCtrl.cs | 10 +++++----- Client/Assets/1_Script/Prefab/ShopTypeitemPrefab.cs | 11 +++++++---- Client/Assets/1_Script/System/Statics.cs | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Client/Assets/1_Script/MainCtrl.cs b/Client/Assets/1_Script/MainCtrl.cs index de9ef2ca..3bceea17 100644 --- a/Client/Assets/1_Script/MainCtrl.cs +++ b/Client/Assets/1_Script/MainCtrl.cs @@ -138,24 +138,24 @@ public class MainCtrl : MonoBehaviour else GameManager.Instance.NextScene(GameManager.eScene.Game); - //data.shop_item - // Statics.excelDatas.shopItems + //»óÁ¡ µ¥ÀÌÅÍ foreach(var item in Statics.excelDatas.shopItemData) { item.Value.id = -1; Statics.shopItems.Add(item.Key, item.Value); } - for (int n = 0; n < data.shop_item.Count; n++) { + if (Statics.shopItems[data.shop_item[n].shop_item_data_id].buy_count == -1) + continue; Statics.shopItems[data.shop_item[n].shop_item_data_id].buy_count--; - if(Statics.shopItems[data.shop_item[n].shop_item_data_id].buy_count == 0) { Statics.shopItems.Remove(data.shop_item[n].shop_item_data_id); } } + //¸®¼Â¾ÆÀÌÅÛ µ¥ÀÌÅÍ foreach (var item in data.reset_shop_item) { ShopItemData itemData = new ShopItemData(); @@ -166,7 +166,7 @@ public class MainCtrl : MonoBehaviour itemData.buy_type = item.buy_type; itemData.buy = item.buy; itemData.reward = item.reward; - itemData.buy_count = item.buy_count; + itemData.buy_count = item.count; Statics.shopItems.Add(itemData.index, itemData); } diff --git a/Client/Assets/1_Script/Prefab/ShopTypeitemPrefab.cs b/Client/Assets/1_Script/Prefab/ShopTypeitemPrefab.cs index e6585da7..b5837e08 100644 --- a/Client/Assets/1_Script/Prefab/ShopTypeitemPrefab.cs +++ b/Client/Assets/1_Script/Prefab/ShopTypeitemPrefab.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using TMPro; @@ -16,12 +17,11 @@ public class ShopTypeitemPrefab : MonoBehaviour this.shopItemData = shopItemData; pay.text = "£Ü" + shopItemData.buy.ToString(); OnSet(shopItemData); + Debug.Log($"{shopItemData.name} : {shopItemData.buy_count} : {shopItemData.buy_count != 0}"); + gameObject.SetActive(shopItemData.buy_count != 0); } - virtual protected void OnSet(ShopItemData shopItemData) - { - - } + virtual protected void OnSet(ShopItemData shopItemData) {} public void BuyItemButton() { @@ -40,6 +40,9 @@ public class ShopTypeitemPrefab : MonoBehaviour Statics.itemManager.box.add(data.consumableItem); Statics.itemManager.box.add(data.etcItem); GetItemWindows.Instance.SetUI(addGold, addCash, data.deck_unit, data.equipment, data.consumableItem, data.etcItem); + + shopItemData.buy_count--; + gameObject.SetActive(shopItemData.buy_count != 0); }, shopItemData.index, shopItemData.id); } } diff --git a/Client/Assets/1_Script/System/Statics.cs b/Client/Assets/1_Script/System/Statics.cs index 306564e2..4cdc54bd 100644 --- a/Client/Assets/1_Script/System/Statics.cs +++ b/Client/Assets/1_Script/System/Statics.cs @@ -20,7 +20,7 @@ public class Statics public static Dictionary stringIcons = new Dictionary(); - public static Dictionary shopItems; + public static Dictionary shopItems = new Dictionary(); //¼­¹ö¿¡¼­ ³»·ÁÁÖ´Â µ¥ÀÌÅ͵é public static string uuid;