Exemplo n.º 1
0
 public void Move(DogSE.Common.Vector3 postion,DogSE.Common.Vector3 direction)
 {
     var pw = new PacketWriter(1100);
     pw.WriteStruct(postion);
     pw.WriteStruct(direction);
     NetState.Send(pw);
 }
Exemplo n.º 2
0
 /// <summary>
 /// 
 /// </summary>
 public static void Write(DogSE.Library.Maths.Quaternion obj, PacketWriter pw)
 {
     pw.Write(obj.X);
     pw.Write(obj.Y);
     pw.Write(obj.Z);
     pw.Write(obj.W);
 }
Exemplo n.º 3
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 = new PacketWriter(iPacketID);

            PacketProfile packetProfile = PacketProfile.GetOutgoingProfile(iPacketID);
            if (packetProfile != null)
                packetProfile.RegConstruct();
        }
Exemplo n.º 4
0
 /// <summary>
 /// 回收一个写留包
 /// </summary>
 /// <param name="packat"></param>
 public static void ReleaseContent(PacketWriter packat)
 {
     packat.Release();
     s_pool.ReleaseContent(packat);
 }
Exemplo n.º 5
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.Dispose();
                m_Stream = null;
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// 
 /// </summary>
 public static void Write(TradeAge.Client.Entity.Common.Vector2 obj, PacketWriter pw)
 {
     pw.Write(obj.X);
     pw.Write(obj.Y);
 }
Exemplo n.º 7
0
        /// <summary>
        /// 根据输出流来写数据
        /// </summary>
        /// <param name="writer"></param>
        public void Send(PacketWriter writer)
        {
            if (Running == false)
                return;

            // 防止发送的顺序出错
            m_Socket.SendPackage(writer.GetBuffer());
            //PacketWriter.ReleaseContent(writer);
        }
Exemplo n.º 8
0
 /// <summary>
 /// 
 /// </summary>
 public static void Write(DogSE.Library.Maths.Vector3 obj, PacketWriter pw)
 {
     pw.Write(obj.X);
     pw.Write(obj.Y);
     pw.Write(obj.Z);
 }