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.Warning("错误的收件人id:" + info.receiver.char_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.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);
        }
Beispiel #2
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);
        }
        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);
        }