示例#1
0
        /// <summary>
        /// 前端请求邮件列表
        /// </summary>
        public void HandleReqList()
        {
            Player player = UnitManager.Instance.GetUnitByIdx(m_char_idx) as Player;

            if (player == null)
            {
                return;
            }
            while (m_new_mails.Count > 0)
            {//数量太多,分次数发送
                ss2c.MailList msg   = PacketPools.Get(ss2c.msg.MAIL_LIST) as ss2c.MailList;
                int           count = 0;
                for (int i = m_new_mails.Count - 1; i >= 0 && count++ < 10; --i)
                {
                    long     mail_idx = m_new_mails[i];
                    MailInfo mail_info;
                    if (m_all_mails.TryGetValue(mail_idx, out mail_info))
                    {
                        MailTitleInfo info = new MailTitleInfo();
                        info.CopyFromInfo(mail_info);
                        msg.mail_list.Add(info);
                    }
                    m_new_mails.RemoveAt(i);
                }
                ServerNetManager.Instance.SendProxy(player.client_uid, msg);
            }
            m_new_mails.Clear();
        }
示例#2
0
        /// <summary>
        /// 前端请求邮件列表
        /// </summary>
        public void HandleReqList()
        {
            Player player = UnitManager.Instance.GetUnitByIdx(m_char_idx) as Player;

            if (player == null)
            {
                return;
            }
            if (m_new_mails.Count > 0)
            {
                ss2c.MailList msg = PacketPools.Get(ss2c.msg.MAIL_LIST) as ss2c.MailList;
                foreach (var mail_idx in m_new_mails)
                {
                    MailInfo mail_info;
                    if (m_all_mails.TryGetValue(mail_idx, out mail_info))
                    {
                        MailTitleInfo info = new MailTitleInfo();
                        info.CopyFromInfo(mail_info);
                        msg.mail_list.Add(info);
                    }
                }
                ServerNetManager.Instance.SendProxy(player.client_uid, msg);
                m_new_mails.Clear();
            }
        }
 /// <summary>
 /// 邮件列表
 /// </summary>
 private void OnMailList(PacketBase packet)
 {
     ss2c.MailList msg = packet as ss2c.MailList;
     MailDataManager.Instance.AddNewMails(msg.mail_list);
 }