상점 처리 수정
This commit is contained in:
parent
b712901c67
commit
d5f71abd2e
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class Statics
|
|||
|
||||
public static Dictionary<string, Sprite> stringIcons = new Dictionary<string, Sprite>();
|
||||
|
||||
public static Dictionary<long, ShopItemData> shopItems;
|
||||
public static Dictionary<long, ShopItemData> shopItems = new Dictionary<long, ShopItemData>();
|
||||
|
||||
//서버에서 내려주는 데이터들
|
||||
public static string uuid;
|
||||
|
|
|
|||
Loading…
Reference in New Issue