This commit is contained in:
parent
9d9ffa3309
commit
30f17e4beb
|
|
@ -21,6 +21,7 @@ public class ServerInfo : MyCoroutine
|
|||
|
||||
public LoginResult m_LoginInfo;
|
||||
public ServerData m_ServerData;
|
||||
public SC_Mail m_Mail = new SC_Mail();
|
||||
public string UserName, UserID;
|
||||
public int VersionCode;
|
||||
|
||||
|
|
@ -321,6 +322,7 @@ public class ServerInfo : MyCoroutine
|
|||
var error = MyErrorCheck(str_result);
|
||||
var json = JsonConvert.DeserializeObject<SC_GetUserInfoResult>(str_result);
|
||||
OffLineReward.m_Sec = json.ReconnectSec;
|
||||
Get_MailList(json.Mail, null);
|
||||
|
||||
if (!json.isNewUser)
|
||||
{ // 기존 유저
|
||||
|
|
@ -2561,7 +2563,20 @@ public class ServerInfo : MyCoroutine
|
|||
#endregion
|
||||
|
||||
#region 우편
|
||||
public void Get_MailList(Action<SC_Mail> _act)
|
||||
void Get_MailList(List<ServerMailData> maildata, Action _act)
|
||||
{
|
||||
if (maildata != null)
|
||||
{
|
||||
for (int i = 0; i < maildata.Count; i++)
|
||||
DateTime.TryParse(maildata[i].RemainTime, out maildata[i].RemnantTime);
|
||||
maildata.RemoveAll(f => (f.RemnantTime - ServerTime).TotalSeconds < 0); // 시간 지난 우편 정리
|
||||
m_Mail.Mail = maildata;
|
||||
|
||||
if (NewGameUI.isIns) NewGameUI.Ins.gos_noti[0].SetActive(maildata.Count > 0);
|
||||
}
|
||||
_act?.Invoke();
|
||||
}
|
||||
public void Get_MailList(Action _act)
|
||||
{
|
||||
if (NewGameUI.isIns) NewGameUI.Ins.gos_noti[0].SetActive(false);
|
||||
NetWait.Ins.Set(true);
|
||||
|
|
@ -2581,30 +2596,15 @@ public class ServerInfo : MyCoroutine
|
|||
{
|
||||
var str_result = result.FunctionResult.ToString();
|
||||
if (MyErrorCheck(str_result) > -1)
|
||||
{
|
||||
var maildata = JsonUtility.FromJson<SC_Mail>(str_result);
|
||||
if (maildata != null)
|
||||
{
|
||||
for (int i = 0; i < maildata.Mail.Count; i++)
|
||||
{
|
||||
DateTime.TryParse(maildata.Mail[i].RemainTime, out maildata.Mail[i].RemnantTime);
|
||||
}
|
||||
maildata.Mail.RemoveAll(f => (f.RemnantTime - ServerTime).TotalSeconds < 0); // 시간 지난 우편 정리
|
||||
|
||||
_act?.Invoke(maildata);
|
||||
if (NewGameUI.isIns) NewGameUI.Ins.gos_noti[0].SetActive(maildata.Mail.Count > 0);
|
||||
}
|
||||
else
|
||||
_act?.Invoke(null);
|
||||
}
|
||||
Get_MailList(JsonUtility.FromJson<SC_Mail>(str_result).Mail, _act);
|
||||
}
|
||||
else
|
||||
_act?.Invoke(null);
|
||||
_act?.Invoke();
|
||||
},
|
||||
fail =>
|
||||
{
|
||||
NetWait.Ins.Set(false);
|
||||
_act?.Invoke(null);
|
||||
_act?.Invoke();
|
||||
});
|
||||
}
|
||||
public void Get_MailReward(string _remaintime, Action<int> _act)
|
||||
|
|
|
|||
|
|
@ -6,11 +6,9 @@ public class MailUI : MonoBehaviourSingletonuScrollViewMgr<MailUI>
|
|||
{
|
||||
public GameObject[] gos; // 0 child, 1 우편없음
|
||||
|
||||
SC_Mail MailData;
|
||||
|
||||
public override void Set()
|
||||
{
|
||||
ServerInfo.Ins.Get_MailList(mails => { MailData = mails; Set_UI(MailData); });
|
||||
ServerInfo.Ins.Get_MailList(() => { Set_UI(ServerInfo.Ins.m_Mail); });
|
||||
base.Set();
|
||||
CardBase_AllOff();
|
||||
DSUtil.ActivateGameObjects(gos);
|
||||
|
|
@ -34,12 +32,14 @@ public class MailUI : MonoBehaviourSingletonuScrollViewMgr<MailUI>
|
|||
|
||||
public void Del_Mail(ServerMailData _smd)
|
||||
{
|
||||
var MailData = ServerInfo.Ins.m_Mail;
|
||||
if (MailData != null) MailData.Mail.Remove(_smd);
|
||||
Set_UI(MailData);
|
||||
}
|
||||
|
||||
public void Get_AllMail()
|
||||
{
|
||||
var MailData = ServerInfo.Ins.m_Mail;
|
||||
if (MailData == null || MailData.Mail == null || MailData.Mail.Count <= 0)
|
||||
return;
|
||||
|
||||
|
|
@ -91,6 +91,7 @@ public class MailUI : MonoBehaviourSingletonuScrollViewMgr<MailUI>
|
|||
|
||||
public override void OnClick_Back()
|
||||
{
|
||||
var MailData = ServerInfo.Ins.m_Mail;
|
||||
Del_BackKey();
|
||||
DSUtil.InActivateGameObjects(gos);
|
||||
NewGameUI.Ins.gos_noti[0].SetActive(MailData != null && MailData.Mail.Count > 0);
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ public class NewGameUI : MonoBehaviourSingletonTemplate<NewGameUI>
|
|||
public void Set_Noti()
|
||||
{
|
||||
var sdata = ServerInfo.Ins.m_ServerData;
|
||||
gos_noti[0].SetActive(ServerInfo.Ins.m_Mail.Mail.Count > 0);
|
||||
gos_noti[1].SetActive(sdata.Noti_Gacha());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue