Exemplo n.º 1
0
 public void CopyFromInfo(MailInfo mail_info)
 {
     mail_idx    = mail_info.mail_idx;
     mail_type   = mail_info.mail_type;
     sender_idx  = mail_info.sender_idx;
     sender_name = mail_info.sender_name;
     send_time   = mail_info.send_time;
     expire_time = mail_info.expire_time;
     flags       = mail_info.flags;
     subject     = mail_info.subject;
 }
Exemplo n.º 2
0
 private void Init(MailInfo mail_info)
 {
     this.m_txt_subject.Text = mail_info.subject.ToString();
     this.m_txt_send.Text    = mail_info.sender_idx.ToString();
     switch (mail_info.bin_mail_content.content_type)
     {
     case eMailContentType.NORMAL:
         this.m_txt_content.Text = mail_info.bin_mail_content.bin_normal_content.content.ToString();
         break;
     }
 }
Exemplo n.º 3
0
 public void Copy(MailInfo mail_info)
 {
     mail_idx         = mail_info.mail_idx;
     mail_type        = mail_info.mail_type;
     spid             = mail_info.spid;
     receiver_idx     = mail_info.receiver_idx;
     sender_idx       = mail_info.sender_idx;
     sender_name      = mail_info.sender_name;
     send_time        = mail_info.send_time;
     expire_time      = mail_info.expire_time;
     delivery_time    = mail_info.delivery_time;
     flags            = mail_info.flags;
     subject          = mail_info.subject;
     bin_mail_content = mail_info.bin_mail_content;
 }
Exemplo n.º 4
0
        /// <summary>
        /// 读取列表完成
        /// </summary>
        private void OnLoadMailEnd(List <MailInfo> list)
        {
            //可能读取db时,玩家下线了
            if (m_char_idx == 0)
            {
                list.ForEach(info => CommonObjectPools.Despawn(info));
                return;
            }

            //过滤掉已经领取过附件的全局邮件
            for (int i = list.Count - 1; i >= 0; --i)
            {
                MailInfo mail_info = list[i];
                if (mail_info.receiver_idx == 0 && m_had_recv_mails.Contains(mail_info.mail_idx))
                {
                    list.RemoveAt(i);
                }
            }

            //保存到集合
            list.ForEach(info => m_all_mails.Add(info.mail_idx, info));

            PlayerCache player = PlayerCacheManager.Instance.GetMember(m_char_idx);

            if (player == null)
            {//可能读取db时,玩家下线了
                MailCacheManager.Instance.HanldeLogoutClient(m_char_idx);
                return;
            }

            //转发给ss,每次发10封
            while (list.Count > 0)
            {
                db2ss.MailList msg = PacketPools.Get(db2ss.msg.MAIL_LIST) as db2ss.MailList;
                msg.char_idx = m_char_idx;
                for (int i = list.Count - 1, j = 0; i >= 0 && j < 10; --i, ++j)
                {
                    msg.mail_list.Add(list[i]);
                    list.RemoveAt(i);
                }
                ForServerNetManager.Instance.Send(player.ss_uid, msg);
            }
        }
Exemplo n.º 5
0
        private void ProcessWrite(MailWriteInfo info)
        {
            Player player = UnitManager.Instance.GetUnitByIdx(m_char_idx) as Player;

            if (player == null)
            {
                return;
            }

            if (info.receiver.char_idx == 0)
            {
                Log.Debug("错误的收件人id:" + info.receiver.char_idx);
                return;
            }

            //存db
            MailInfo mail_info = CommonObjectPools.Spawn <MailInfo>();

            mail_info.mail_idx      = IdSharedManager.Instance.GetNextMailIdx();
            mail_info.mail_type     = eMailType.NORMAL;
            mail_info.spid          = 0;//普通邮件,不区分渠道id
            mail_info.receiver_idx  = info.receiver.char_idx;
            mail_info.sender_idx    = m_char_idx;
            mail_info.sender_name   = player.char_name;
            mail_info.send_time     = Time.second_time;
            mail_info.expire_time   = 0;
            mail_info.delivery_time = 0;
            mail_info.flags         = (uint)eMailFlags.NONE;
            mail_info.subject       = info.subject;
            mail_info.bin_mail_content.content_type = eMailContentType.NORMAL;
            mail_info.bin_mail_content.bin_normal_content.content = info.content;
            SQLMailHandle.CreateMail(mail_info, player.db_id);
            CommonObjectPools.Despawn(mail_info);

            //告诉客户端发送成功
            ss2c.MailCommand msg_client = PacketPools.Get(ss2c.msg.MAIL_COMMAND) as ss2c.MailCommand;
            msg_client.mail_idx     = 0;
            msg_client.command_type = eMailCommandType.WRITE_MAIL;
            msg_client.error_type   = eMailCommandError.NONE;
            ServerNetManager.Instance.SendProxy(player.client_uid, msg_client);
        }
Exemplo n.º 6
0
        private void ProcessWrite(MailWriteInfo info)
        {
            PlayerCache player = PlayerCacheManager.Instance.GetMember(m_char_idx);

            if (player == null)
            {
                return;
            }

            if (info.receiver_idx <= 0)
            {
                Log.Warning("错误的收件人id:" + info.receiver_idx);
                return;
            }
            //存db
            MailInfo mail_info = CommonObjectPools.Spawn <MailInfo>();

            mail_info.mail_type     = eMailType.NORMAL;
            mail_info.spid          = 0;//普通邮件,不区分渠道id
            mail_info.receiver_idx  = info.receiver_idx;
            mail_info.sender_idx    = m_char_idx;
            mail_info.sender_name   = player.ss_data.char_name;
            mail_info.send_time     = Time.second_time;
            mail_info.expire_time   = 0;
            mail_info.delivery_time = 0;
            mail_info.flags         = (uint)eMailFlags.NONE;
            mail_info.subject       = info.subject;
            mail_info.bin_mail_content.content_type = eMailContentType.NORMAL;
            mail_info.bin_mail_content.bin_normal_content.content = info.content;
            SQLMailHandle.CreateMail(mail_info);
            CommonObjectPools.Despawn(mail_info);

            //返回结果给ss
            db2ss.MailCommand rep_msg = PacketPools.Get(db2ss.msg.MAIL_COMMAND) as db2ss.MailCommand;
            rep_msg.mail_idx     = 0;
            rep_msg.command_type = eMailCommandType.WRITE_MAIL;
            rep_msg.error_type   = eMailCommandError.NONE;
            ForServerNetManager.Instance.Send(player.ss_uid, rep_msg);
        }
Exemplo n.º 7
0
 public MailContentForm(MailInfo mail_info)
 {
     InitializeComponent();
     Init(mail_info);
 }
Exemplo n.º 8
0
        /// <summary>
        /// 投递邮件到信箱
        /// </summary>
        private void OnLoadMailEnd(List <MailInfo> list)
        {
            if (list.Count == 0)
            {
                return;
            }

            //可能读取db时,玩家下线了
            Player player = UnitManager.Instance.GetUnitByIdx(m_char_idx) as Player;

            if (player == null)
            {
                list.ForEach(info => CommonObjectPools.Despawn(info));
                return;
            }

            //过滤掉已经领取过附件的全局邮件
            for (int i = list.Count - 1; i >= 0; --i)
            {
                MailInfo mail_info = list[i];
                if (mail_info.receiver_idx == 0 && m_had_recv_mails.Contains(mail_info.mail_idx))
                {
                    CommonObjectPools.Despawn(mail_info);
                    list.RemoveAt(i);
                }
            }

            //添加到邮件集合
            list.ForEach(info => { if (!m_all_mails.ContainsKey(info.mail_idx))
                                   {
                                       m_all_mails.Add(info.mail_idx, info);
                                   }
                         });

            //加入到新邮件列表
            list.ForEach(info => m_new_mails.Add(info.mail_idx));

            //过滤掉系统内部邮件
            List <long> del_list = new List <long>();

            for (int i = list.Count - 1; i >= 0; i--)
            {
                MailInfo mail_info = list[i];
                if (mail_info.mail_type == eMailType.SYSTEM_INTERNAL)
                {
                    if (mail_info.bin_mail_content.content_type == eMailContentType.MOD)
                    {//修改玩家属性
                        MailModContent content = mail_info.bin_mail_content.bin_mod_content;
                        foreach (var obj in content.mods)
                        {
                            player.player_attr.SetAttrib(obj.type, obj.value_i, obj.value_str);
                        }
                        list.RemoveAt(i);
                        del_list.Add(mail_info.mail_idx);
                    }
                }
            }
            if (del_list.Count > 0)
            {
                this.HandleDeleteMail(del_list);
            }

            //通知客户端有新邮件到达
            if (list.Count > 0)
            {
                //获取未读邮件数量
                int unread_count = 0;
                list.ForEach(info => { if (!Utils.HasFlag(info.flags, (uint)eMailFlags.READED))
                                       {
                                           unread_count++;
                                       }
                             });

                ss2c.MailCount msg = PacketPools.Get(ss2c.msg.MAIL_COUNT) as ss2c.MailCount;
                msg.total_mail_count  = (ushort)list.Count;
                msg.unread_mail_count = (ushort)unread_count;
                ServerNetManager.Instance.SendProxy(player.client_uid, msg);
            }
        }