/// <summary> /// 读邮件 /// </summary> private void OnMailRead(PacketBase packet) { ss2c.MailRead msg = packet as ss2c.MailRead; MailContentForm form = new MailContentForm(msg.mail_info); form.ShowDialog(); }
/// <summary> /// 读邮件 /// </summary> public void HandleReadMail(long mail_idx) { Player player = UnitManager.Instance.GetUnitByIdx(m_char_idx) as Player; if (player == null) { return; } MailInfo mail_info; if (m_all_mails.TryGetValue(mail_idx, out mail_info)) { if (m_del_mails.Contains(mail_idx)) { return; } //是否全服邮件 if (mail_info.receiver_idx == 0) { if (!m_had_recv_mails.Contains(mail_idx)) {//同步到db,已经领取过全局邮件 m_had_recv_mails.Add(mail_idx); SQLMailHandle.UpdateCharRecvs(m_char_idx, m_had_recv_mails, player.db_id); } } else if (!Utils.HasFlag(mail_info.flags, (uint)eMailFlags.READED)) {//修改标记 mail_info.flags = Utils.InsertFlag(mail_info.flags, (uint)eMailFlags.READED); m_save_mails.Add(mail_idx); m_is_dirty = true; } //通知客户端 ss2c.MailRead msg_client = PacketPools.Get(ss2c.msg.MAIL_READ) as ss2c.MailRead; msg_client.mail_info.Copy(mail_info); ServerNetManager.Instance.SendProxy(player.client_uid, msg_client); } }