Beispiel #1
0
        /// <summary>
        /// 通过调用EnsureCapacity(...)来产生m_Stream
        /// </summary>
        /// <param name="iPacketID"></param>
        /// <param name="len"></param>
        public Packet(ushort iPacketID, int len = 0)
        {
            m_PacketID = iPacketID;
            m_Stream = PacketWriter.AcquireContent(iPacketID);

            PacketProfile packetProfile = PacketProfile.GetOutgoingProfile(iPacketID);
            if (packetProfile != null)
                packetProfile.RegConstruct();
        }
Beispiel #2
0
        /// <summary>
        /// 通过调用EnsureCapacity(...)来产生m_Stream
        /// </summary>
        /// <param name="iPacketID"></param>
        public Packet( ushort iPacketID )
        {
            m_PacketID  = iPacketID;
            m_Stream = new PacketWriter(iPacketID);

            PacketProfile packetProfile = PacketProfile.GetOutgoingProfile( iPacketID );
            if ( packetProfile != null )
                packetProfile.RegConstruct();
        }
Beispiel #3
0
 public void LoginServerResult(NetState netstate, TradeAge.Server.Entity.Login.LoginServerResult result)
 {
     var pw = new PacketWriter(1001);
     PacketProfile packetProfile = PacketProfile.GetOutgoingProfile(1001);
     if (packetProfile != null)
         packetProfile.RegConstruct();
     pw.Write((byte)result);
     netstate.Send(pw); pw.Dispose();
 }
Beispiel #4
0
 public static void Write(TradeAge.Server.Entity.Common.Vector2 obj, PacketWriter pw)
 {
     pw.Write(obj.X);
     pw.Write(obj.Y);
 }
Beispiel #5
0
 public static void Write(TradeAge.Server.Entity.Character.SimplePlayer obj, PacketWriter pw)
 {
     pw.WriteUTF8Null(obj.Name);
     Vector2WriteProxy.Write(obj.Postion, pw);
     Vector2WriteProxy.Write(obj.Direction, pw);
     pw.Write(obj.Id);
     pw.Write(obj.AccountId);
     pw.Write((byte)obj.Sex);
 }
Beispiel #6
0
 public static void Write(TradeAge.Server.Entity.Character.SceneSprite obj, PacketWriter pw)
 {
     pw.Write(obj.Id);
     pw.Write((byte)obj.SpriteType);
     pw.WriteUTF8Null(obj.Name);
     Vector2WriteProxy.Write(obj.Postion, pw);
     Vector2WriteProxy.Write(obj.Direction, pw);
 }
Beispiel #7
0
        /// <summary>
        /// 表示数据已发送完成,释放请求过的加解压缩的内存
        /// </summary>
        public void Release()
        {
            // 检测有没有调用过Release(...)函数
            if ( Interlocked.Exchange( ref m_bIsRelease, 1 ) == 1 )
                return;

            if ( m_Stream != null )
            {
                PacketWriter.ReleaseContent(m_Stream);
                //m_Stream.Release();
                m_Stream = null;
            }
        }
Beispiel #8
0
        /// <summary>
        /// 表示数据已发送完成,释放请求过的加解压缩的内存
        /// </summary>
        public void Release()
        {
            // 检测有没有调用过Release(...)函数
            if ( Interlocked.Exchange( ref m_bIsRelease, 1 ) == 1 )
                return;

            if ( m_Stream != null )
            {
                m_Stream.Dispose();
                m_Stream = null;
            }
        }