示例#1
0
    public MailItemInfo(PlayerMailItem pmi)
    {
        ID   = pmi.m_id;
        Name = pmi.m_header;

        DateTime battleEndTime = MyTools.getTime((int)pmi.m_time);

        Time    = (uint)(DateTime.Now.DayOfYear - battleEndTime.DayOfYear);
        Residue = (uint)(Mathf.Max(battleEndTime.DayOfYear + 30 - DateTime.Now.DayOfYear, 0));
        TimeDes = battleEndTime.ToString("yyyy-MM-dd HH:mm");

        IsReadAndGet = (pmi.m_state > 0);
        Details      = pmi.m_content;
        for (int j = 0; j < pmi.m_appendix.Count; j++)
        {
            int key   = (int)pmi.m_appendix[j].m_id;
            int value = (int)pmi.m_appendix[j].m_count;
            if (ItemLst.ContainsKey(key))
            {
                ItemLst[key] += value;
            }
            else
            {
                ItemLst.Add(key, value);
            }
        }
    }
示例#2
0
 static public void AddMail(PlayerMailItem pmi)
 {
     if (!GameApp.Instance.MailItemsDic.ContainsKey(pmi.m_id))
     {
         GameApp.Instance.MailItemsDic.Add(pmi.m_id, new MailItemInfo(pmi));
     }
     else
     {
         Debug.Log("重复的邮件:" + pmi.m_id + " " + pmi.m_header);
     }
 }