2025-04-14 02:10:38 +00:00
|
|
|
using TMPro;
|
|
|
|
|
using UnityEngine.UI;
|
2024-12-15 01:39:39 +00:00
|
|
|
|
|
|
|
|
public class MailCard : CardBase
|
|
|
|
|
{
|
2025-04-14 02:10:38 +00:00
|
|
|
public Image[] images; // 0 보상 아이콘
|
|
|
|
|
public TextMeshProUGUI[] texts; // 0 보상, 1 메시지, 2 남은 시간
|
2024-12-15 01:39:39 +00:00
|
|
|
|
|
|
|
|
ServerMailData m_ServerMailData;
|
|
|
|
|
|
|
|
|
|
public override void Set<T>(T _base)
|
|
|
|
|
{
|
|
|
|
|
base.Set(_base);
|
|
|
|
|
m_ServerMailData = _base as ServerMailData;
|
|
|
|
|
|
2025-04-14 02:10:38 +00:00
|
|
|
images[0].sprite = UIAtlasMgr.Ins.Get_Sprite(m_ServerMailData.ID);
|
2024-12-15 01:39:39 +00:00
|
|
|
var ts = m_ServerMailData.RemnantTime - ServerInfo.ServerTime;
|
2025-04-14 02:10:38 +00:00
|
|
|
if (ts.TotalDays < 1) texts[0].text = DSUtil.Format(145, ts.Hours, ts.Minutes);
|
|
|
|
|
else texts[0].text = DSUtil.Format(146, (int)ts.TotalDays);
|
|
|
|
|
texts[1].text = m_ServerMailData.Msg;
|
2024-12-15 01:39:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnClick_GetReward()
|
|
|
|
|
{
|
|
|
|
|
var id = m_ServerMailData.ID;
|
|
|
|
|
var amount = m_ServerMailData.RewardAmount;
|
|
|
|
|
var isShopItem = m_ServerMailData.IsShopItem > 0;
|
|
|
|
|
|
|
|
|
|
var sinfo = ServerInfo.Ins;
|
|
|
|
|
|
|
|
|
|
sinfo.Get_MailReward(m_ServerMailData.RemainTime,
|
|
|
|
|
error =>
|
|
|
|
|
{
|
|
|
|
|
switch (error)
|
|
|
|
|
{
|
|
|
|
|
case 3:
|
|
|
|
|
ToastUI.Ins.Set(144);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2025-04-14 02:34:12 +00:00
|
|
|
sinfo.m_ServerData.Add_Item(id, amount);
|
2024-12-15 01:39:39 +00:00
|
|
|
sinfo.Write(() =>
|
|
|
|
|
{
|
|
|
|
|
});
|
|
|
|
|
break;
|
|
|
|
|
}
|
2025-04-14 02:34:12 +00:00
|
|
|
MailUI.Ins.Del_Mail(m_ServerMailData);
|
2024-12-15 01:39:39 +00:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|