2025-04-22 07:30:24 +00:00
|
|
|
using TMPro;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
2025-04-22 06:18:49 +00:00
|
|
|
public class ShopCard : CardBase
|
|
|
|
|
{
|
2025-04-22 20:17:12 +00:00
|
|
|
public TextMeshProUGUI[] texts; // 0 상품 이름, 1 제한횟수, 2 가격, 3 최초구매
|
|
|
|
|
public Image[] images; // 0 상품, 1 가격
|
|
|
|
|
public GameObject[] gos; // 0 최초 구매, 1 품절
|
2025-04-22 07:30:24 +00:00
|
|
|
|
|
|
|
|
ShopItemListTableData m_Data;
|
|
|
|
|
|
2025-04-22 06:18:49 +00:00
|
|
|
public override void Set<T>(T _base)
|
|
|
|
|
{
|
|
|
|
|
base.Set(_base);
|
2025-04-22 07:30:24 +00:00
|
|
|
m_Data = _base as ShopItemListTableData;
|
2025-04-22 23:42:08 +00:00
|
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
2025-04-22 07:30:24 +00:00
|
|
|
|
|
|
|
|
texts[0].text = m_Data.Get_Name();
|
2025-04-22 23:42:08 +00:00
|
|
|
texts[1].text = sdata.Get_ShopLimitText(m_Data);
|
|
|
|
|
texts[2].text = sdata.Get_ShopPriceText(m_Data);
|
2025-04-22 20:17:12 +00:00
|
|
|
|
|
|
|
|
texts[3].text = DSUtil.Format(390, m_Data.n_FirstBonus);
|
|
|
|
|
|
|
|
|
|
images[0].sprite = m_Data.Get_Icon();
|
2025-04-22 20:47:25 +00:00
|
|
|
images[1].enabled = m_Data.n_PriceItemID > 0;
|
2025-04-22 20:17:12 +00:00
|
|
|
if (images[1].enabled) images[1].sprite = UIAtlasMgr.Ins.Get_Sprite(m_Data.n_PriceItemID);
|
|
|
|
|
|
|
|
|
|
gos[0].SetActive(m_Data.n_FirstBonus > 0);
|
|
|
|
|
gos[1].SetActive(isSoldOut()); // 품절 여부
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isSoldOut()
|
2025-04-22 20:47:25 +00:00
|
|
|
{
|
|
|
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
|
|
|
var buycount = sdata.Get_ShopBuyCount(m_Data.n_ShopItemID);
|
|
|
|
|
if (m_Data.BuyLimit > 0) return buycount >= m_Data.BuyLimit;
|
|
|
|
|
if (m_Data.BuyLimit_Day > 0) return buycount >= m_Data.BuyLimit_Day;
|
|
|
|
|
if (m_Data.BuyLimit_Week > 0) return buycount >= m_Data.BuyLimit_Week;
|
|
|
|
|
if (m_Data.BuyLimit_Month > 0) return buycount >= m_Data.BuyLimit_Month;
|
2025-04-22 20:17:12 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnClick_Buy()
|
|
|
|
|
{
|
2025-04-22 20:47:25 +00:00
|
|
|
if (!isSoldOut())
|
|
|
|
|
{
|
2025-04-22 23:42:08 +00:00
|
|
|
if (m_Data.b_Package)
|
|
|
|
|
NewGameUI.Ins.m_ShopUI.m_ShopPackagePopup.Set(m_Data);
|
2025-04-22 20:47:25 +00:00
|
|
|
}
|
2025-04-22 06:18:49 +00:00
|
|
|
}
|
|
|
|
|
}
|