2024-12-15 01:39:39 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
2025-04-14 01:50:36 +00:00
|
|
|
public class MailUI : uScrollViewMgr
|
2024-12-15 01:39:39 +00:00
|
|
|
{
|
|
|
|
|
public GameObject[] gos; // 0 우편없음
|
|
|
|
|
|
|
|
|
|
SC_Mail MailData;
|
|
|
|
|
|
|
|
|
|
public void Set(bool _first)
|
|
|
|
|
{
|
|
|
|
|
ServerInfo.Ins.Get_MailList(!_first, mails => { MailData = mails; Set_UI(MailData); });
|
|
|
|
|
if (!_first)
|
|
|
|
|
{
|
|
|
|
|
base.Set();
|
|
|
|
|
CardBase_AllOff();
|
|
|
|
|
gos[0].SetActive(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Set_UI(SC_Mail mail)
|
|
|
|
|
{
|
|
|
|
|
if (mail == null || mail.Mail == null || mail.Mail.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
CardBase_AllOff();
|
|
|
|
|
gos[0].SetActive(true);
|
|
|
|
|
GameUI.Ins.LobbyUI.Set_MailNoti(false);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
gos[0].SetActive(false);
|
|
|
|
|
GameUI.Ins.LobbyUI.Set_MailNoti(true);
|
2025-04-14 01:50:36 +00:00
|
|
|
Set_ScrollView(mail.Mail);
|
2024-12-15 01:39:39 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Del_Mail(ServerMailData _smd)
|
|
|
|
|
{
|
|
|
|
|
if (MailData != null) MailData.Mail.Remove(_smd);
|
|
|
|
|
Set_UI(MailData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Get_AllMail()
|
|
|
|
|
{
|
|
|
|
|
if (MailData == null || MailData.Mail == null || MailData.Mail.Count <= 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
ServerInfo.Ins.Get_AllMail(mail =>
|
|
|
|
|
{
|
|
|
|
|
var obtainlist = new List<ItemData>();
|
|
|
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
|
|
|
for (int i = 0; i < mail.Mail.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
var temp = MailData.Mail.Find(f => DateTime.Compare(f.RemnantTime, mail.Mail[i].RemnantTime) == 0);
|
|
|
|
|
if (temp != null)
|
|
|
|
|
{
|
|
|
|
|
obtainlist.AddRange(sdata.Add_Item(new ItemData(temp.Item, temp.ID, temp.RewardAmount, "Mail", eUICardType.GetItem)));
|
|
|
|
|
if (temp.IsShopItem > 0)
|
|
|
|
|
{
|
|
|
|
|
var shopdata = table_shop.Ins.Get_Data(temp.Item, temp.ID);
|
|
|
|
|
if (shopdata != null)
|
|
|
|
|
obtainlist.AddRange(sdata.Add_Item(new ItemData(eItem.mClover, 0, shopdata.Mileage, DSUtil.Format("shop {0} {1}", temp.Item, temp.ID), eUICardType.GetItem)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obtainlist.Count > 0) GetItemUI.Ins.Set(obtainlist);
|
|
|
|
|
ServerInfo.Ins.Write(() =>
|
|
|
|
|
{
|
|
|
|
|
if (obtainlist.Count > 0) GetItemUI.Ins.Show_Items();
|
|
|
|
|
MailData = null;
|
|
|
|
|
Set_UI(MailData);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnClick_Back()
|
|
|
|
|
{
|
|
|
|
|
base.OnClick_Back();
|
|
|
|
|
GameUI.Ins.LobbyUI.Set_Noti();
|
|
|
|
|
}
|
|
|
|
|
}
|