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); }
/// <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); }
/// <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(); }
/// <summary> /// 回收一个写留包 /// </summary> /// <param name="packat"></param> public static void ReleaseContent(PacketWriter packat) { packat.Release(); s_pool.ReleaseContent(packat); }
/// <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; } }
/// <summary> /// /// </summary> public static void Write(TradeAge.Client.Entity.Common.Vector2 obj, PacketWriter pw) { pw.Write(obj.X); pw.Write(obj.Y); }
/// <summary> /// 根据输出流来写数据 /// </summary> /// <param name="writer"></param> public void Send(PacketWriter writer) { if (Running == false) return; // 防止发送的顺序出错 m_Socket.SendPackage(writer.GetBuffer()); //PacketWriter.ReleaseContent(writer); }
/// <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); }