50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class ShopCard : CardBase
|
|
{
|
|
public TextMeshProUGUI[] texts; // 0 상품 이름, 1 제한횟수, 2 가격, 3 최초구매
|
|
public Image[] images; // 0 상품, 1 가격
|
|
public GameObject[] gos; // 0 최초 구매, 1 품절
|
|
|
|
ShopItemListTableData m_Data;
|
|
|
|
public override void Set<T>(T _base)
|
|
{
|
|
base.Set(_base);
|
|
m_Data = _base as ShopItemListTableData;
|
|
|
|
texts[0].text = m_Data.Get_Name();
|
|
texts[1].text = Get_LimitText();
|
|
texts[2].text = m_Data.n_PriceItemID == -1 ? $"₩{m_Data.n_Price:N0}" : m_Data.n_Price.ToString();
|
|
|
|
texts[3].text = DSUtil.Format(390, m_Data.n_FirstBonus);
|
|
|
|
images[0].sprite = m_Data.Get_Icon();
|
|
images[1].enabled = m_Data.n_PriceItemID != -1;
|
|
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()); // 품절 여부
|
|
}
|
|
|
|
string Get_LimitText()
|
|
{ // TODO 정인호 : 현재 구매 횟수 필요
|
|
if (m_Data.BuyLimit > 0) return DSUtil.Format(391, 0, m_Data.BuyLimit);
|
|
if (m_Data.BuyLimit_Day > 0) return DSUtil.Format(392, 0, m_Data.BuyLimit_Day);
|
|
if (m_Data.BuyLimit_Week > 0) return DSUtil.Format(393, 0, m_Data.BuyLimit_Week);
|
|
if (m_Data.BuyLimit_Month > 0) return DSUtil.Format(394, 0, m_Data.BuyLimit_Month);
|
|
return "";
|
|
}
|
|
|
|
bool isSoldOut()
|
|
{ // TODO 정인호 : 상품 품절 여부
|
|
return false;
|
|
}
|
|
|
|
public void OnClick_Buy()
|
|
{
|
|
|
|
}
|
|
} |