You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
2.6 KiB
86 lines
2.6 KiB
using TMPro;
|
|
using UnityEngine;
|
|
using IVDataFormat;
|
|
using UnityEngine.UI;
|
|
|
|
|
|
public class EScrMail : EScrCell
|
|
{
|
|
private GoodsItem[] goodsItems;
|
|
private Image imgIcon;
|
|
private ButtonIV btnGet;
|
|
private TextMeshProUGUI txtHeader, txtTitle, txtLimit, txtRead;
|
|
|
|
|
|
public override void InitCell()
|
|
{
|
|
Transform trf = transform;
|
|
goodsItems = trf.Find("goods").GetComponentsInChildren<GoodsItem>(true);
|
|
imgIcon = trf.Find("icon").GetComponent<Image>();
|
|
txtHeader = trf.Find("txtHeader").GetComponent<TextMeshProUGUI>();
|
|
txtTitle = trf.Find("txtTitle").GetComponent<TextMeshProUGUI>();
|
|
txtLimit = trf.Find("txtLimit").GetComponent<TextMeshProUGUI>();
|
|
txtRead = trf.Find("txtRead").GetComponent<TextMeshProUGUI>();
|
|
btnGet = trf.Find("btnGet").GetComponent<ButtonIV>();
|
|
btnGet.transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_get");
|
|
}
|
|
|
|
public override void Localize()
|
|
{
|
|
btnGet.transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_get");
|
|
}
|
|
|
|
public override void SetData(int itemid)
|
|
{
|
|
itemID = itemid;
|
|
|
|
dMail data = DataHandler.GetMailByIndex(iType, itemid);
|
|
if (data == null)
|
|
return;
|
|
|
|
txtHeader.text = LocalizationText.GetText(data.header);
|
|
txtTitle.text = LocalizationText.GetText(data.title);
|
|
for (int i = 0; i < goodsItems.Length; i++)
|
|
{
|
|
if (i >= data.rewards.Length)
|
|
{
|
|
goodsItems[i].gameObject.SetActive(false);
|
|
continue;
|
|
}
|
|
goodsItems[i].gameObject.SetActive(true);
|
|
goodsItems[i].SetGoods(data.rewards[i].rewardType, data.rewards[i].rewardId, data.rewards[i].rewardCount);
|
|
}
|
|
|
|
// 읽지 않은 우편.
|
|
if (iType == 0)
|
|
{
|
|
imgIcon.sprite = MailMgr.SGetIconClose();
|
|
txtLimit.text = FormatString.TextLeftTimeDH(data.endAt);
|
|
txtLimit.enabled = true;
|
|
txtRead.enabled = false;
|
|
btnGet.gameObject.SetActive(true);
|
|
}
|
|
// 읽은 우편.
|
|
else
|
|
{
|
|
imgIcon.sprite = MailMgr.SGetIconOpen();
|
|
txtRead.text = FormatString.TextDateTimeUtc9Line2(data.readAt);
|
|
txtLimit.enabled = false;
|
|
txtRead.enabled = true;
|
|
btnGet.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
public override void RefreshCellView()
|
|
{
|
|
SetData(itemID);
|
|
}
|
|
|
|
public void BtnSelf()
|
|
{
|
|
SoundMgr.PlaySfx(SoundName.BtnPress);
|
|
|
|
MailMgr.SGetMailItem(itemID);
|
|
}
|
|
|
|
}
|