Inheritance: global::ProtoBuf.IExtensible
Exemplo n.º 1
0
 private void HandleMailList(NodeMessage lobbyMsg)
 {
     GameFrameworkMessage.Msg_LC_SyncMailList protoMsg = lobbyMsg.m_ProtoData as GameFrameworkMessage.Msg_LC_SyncMailList;
     if (null != protoMsg)
     {
         ClientInfo.Instance.Mails = protoMsg.m_Mails;
     }
 }
Exemplo n.º 2
0
 internal void GetMailList(ulong userGuid)
 {
     UserProcessScheduler dataProcess = UserServer.Instance.UserProcessScheduler;
     UserInfo user = dataProcess.GetUserInfo(userGuid);
     if (null != user) {
         List<MailInfoForMessage> mailList = new List<MailInfoForMessage>();
         List<MailInfo> mails;
         if (m_UserMails.TryGetValue(userGuid, out mails)) {
             int ct = mails.Count;
             for (int ix = 0; ix < ct; ++ix) {
                 MailInfo mailInfo = mails[ix];
                 if (mailInfo.m_ExpiryDate >= DateTime.Now) {
                     MailInfoForMessage mailInfoForMsg = new MailInfoForMessage();
                     mailInfoForMsg.m_AlreadyRead = mailInfo.m_AlreadyRead;
                     mailInfoForMsg.m_MailGuid = mailInfo.m_MailGuid;
                     mailInfoForMsg.m_Title = mailInfo.m_Title;
                     mailInfoForMsg.m_Sender = mailInfo.m_Sender;
                     mailInfoForMsg.m_SendTime = mailInfo.m_SendTime.ToString("yyyyMMddHHmmss");
                     mailInfoForMsg.m_Text = mailInfo.m_Text;
                     mailInfoForMsg.m_Money = mailInfo.m_Money;
                     mailInfoForMsg.m_Gold = mailInfo.m_Gold;
                     int itemCt = mailInfo.m_Items.Count;
                     if (itemCt > 0) {
                         for (int index = 0; index < itemCt; ++index) {
                             MailItemForMessage mailItem = new MailItemForMessage();
                             mailItem.m_ItemId = mailInfo.m_Items[index].m_ItemId;
                             mailItem.m_ItemNum = mailInfo.m_Items[index].m_ItemNum;
                             mailInfoForMsg.m_Items.Add(mailItem);
                         }
                     }
                     mailList.Add(mailInfoForMsg);
                 }
             }
         }
         MailStateInfo mailStateInfo = user.MailStateInfo;
         //这里不对用户数据加锁,因为用户的邮件状态的改变都在这个线程完成(除上线时的数据加载)
         int wholeMailCt = m_WholeMails.Count;
         for (int ix = 0; ix < wholeMailCt; ++ix) {
             MailInfo mailInfo = m_WholeMails[ix];
             if (mailInfo.m_LevelDemand <= user.Level
               && mailInfo.m_SendTime >= user.CreateTime
               && mailInfo.m_ExpiryDate >= DateTime.Now
               && !mailStateInfo.IsAlreadyReceived(mailInfo.m_MailGuid)) {
                 if (!mailStateInfo.HaveMail(mailInfo.m_MailGuid)) {
                     mailStateInfo.AddMail(mailInfo.m_MailGuid, mailInfo.m_ExpiryDate);
                 }
                 MailInfoForMessage mailInfoForMsg = new MailInfoForMessage();
                 mailInfoForMsg.m_AlreadyRead = mailStateInfo.IsAlreadyRead(mailInfo.m_MailGuid);
                 mailInfoForMsg.m_MailGuid = mailInfo.m_MailGuid;
                 mailInfoForMsg.m_Title = mailInfo.m_Title;
                 mailInfoForMsg.m_Sender = mailInfo.m_Sender;
                 mailInfoForMsg.m_SendTime = mailInfo.m_SendTime.ToString("yyyyMMddHHmmss");
                 mailInfoForMsg.m_Text = mailInfo.m_Text;
                 mailInfoForMsg.m_Money = mailInfo.m_Money;
                 mailInfoForMsg.m_Gold = mailInfo.m_Gold;
                 int itemCt = mailInfo.m_Items.Count;
                 if (itemCt > 0) {
                     for (int index = 0; index < itemCt; ++index) {
                         MailItemForMessage mailItem = new MailItemForMessage();
                         mailItem.m_ItemId = mailInfo.m_Items[index].m_ItemId;
                         mailItem.m_ItemNum = mailInfo.m_Items[index].m_ItemNum;
                         mailInfoForMsg.m_Items.Add(mailItem);
                     }
                 }
                 mailList.Add(mailInfoForMsg);
             }
         }
         NodeMessage syncMailListMsg = new NodeMessage(LobbyMessageDefine.Msg_LC_SyncMailList, userGuid);
         GameFrameworkMessage.Msg_LC_SyncMailList protoMsg = new Msg_LC_SyncMailList();
         protoMsg.m_Mails.AddRange(mailList);
         syncMailListMsg.m_ProtoData = protoMsg;
         NodeMessageDispatcher.SendNodeMessage(user.NodeName, syncMailListMsg);
     }
 }