本文整理匯總了C#中Server.Network.PacketWriter.Write方法的典型用法代碼示例。如果您正苦於以下問題:C# PacketWriter.Write方法的具體用法?C# PacketWriter.Write怎麽用?C# PacketWriter.Write使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Server.Network.PacketWriter
的用法示例。
在下文中一共展示了PacketWriter.Write方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Packet
public Packet( int packetID, int length )
{
m_PacketID = packetID;
m_Length = length;
m_Stream = PacketWriter.CreateInstance( length );// new PacketWriter( length );
m_Stream.Write( (byte) packetID );
PacketProfile prof = PacketProfile.GetOutgoingProfile( (byte)packetID );
if ( prof != null )
prof.RegConstruct();
}
示例2: EnsureCapacity
public void EnsureCapacity( int length )
{
m_Stream = PacketWriter.CreateInstance( length );// new PacketWriter( length );
m_Stream.Write( (byte) m_PacketID );
m_Stream.Write( (short) 0 );
}
示例3: Packet
protected Packet( int packetID, int length )
{
m_PacketID = packetID;
m_Length = length;
m_Stream = PacketWriter.CreateInstance( length );// new PacketWriter( length );
m_Stream.Write( ( byte ) packetID );
PacketSendProfile prof = PacketSendProfile.Acquire( GetType() );
if ( prof != null ) {
prof.Created++;
}
}
示例4: WriteReverse
public static void WriteReverse( PacketWriter stream, int cur, int max )
{
if ( m_Enabled && max != 0 )
{
stream.Write( (short) ((cur * m_Maximum) / max) );
stream.Write( (short) m_Maximum );
}
else
{
stream.Write( (short) cur );
stream.Write( (short) max );
}
}
示例5: Packet
protected Packet(int packetID, int length, PacketWriter stream)
{
m_PacketID = packetID;
m_Length = length;
m_Stream = stream;
m_Stream.Write((byte)packetID);
if (Core.Profiling)
{
PacketSendProfile prof = PacketSendProfile.Acquire(GetType());
prof.Increment();
}
}
示例6: Initialize
protected void Initialize( int packetID, int length )
{
m_PacketID = packetID;
m_Length = length;
m_State = State.Inactive;
if ( m_Length > 0 )
{
m_Stream = PacketWriter.CreateInstance( length );
m_Stream.Write( (byte) packetID );
}
// TODO: raise an event OnInitialize, in order to do profiling stuff.
}
示例7: WorldItemHS
public WorldItemHS(Item item, PacketWriter stream)
: base(0xF3, 26, stream)
{
stream.Write((short)0x1);
int itemID = item.ItemID;
if (item is BaseMulti)
m_Stream.Write((byte)0x02);
else if (item is IDamageable)
m_Stream.Write((byte)0x03);
else
m_Stream.Write((byte)0x00);
if (item is BaseMulti)
{
stream.Write((int)item.Serial);
itemID &= 0x3FFF;
stream.Write((ushort)itemID);
stream.Write((byte)0);
}
else
{
stream.Write((int)item.Serial);
itemID &= 0xFFFF;
stream.Write((ushort)itemID);
stream.Write((byte)0);
}
int amount = item.Amount;
stream.Write((short)amount);
stream.Write((short)amount);
Point3D loc = item.Location;
int x = loc.m_X & 0x7FFF;
int y = loc.m_Y & 0x3FFF;
stream.Write((short)x);
stream.Write((short)y);
stream.Write((sbyte)loc.m_Z);
stream.Write((byte)item.Light);
stream.Write((short)item.Hue);
stream.Write((byte)item.GetPacketFlags());
stream.Write((short)0x00); // ??
}
示例8: Initialize
protected void Initialize(int packetID, int length)
{
m_PacketID = packetID;
m_Length = length;
if (m_Length > 0) {
m_Stream = PacketWriter.CreateInstance(length);
m_Stream.Write((byte)packetID);
}
PacketProfile prof = PacketProfile.GetOutgoingProfile( (byte)packetID );
if ( prof != null )
prof.RegConstruct();
}
示例9: Packet
protected Packet(int packetID, int length)
{
m_PacketID = packetID;
m_Length = length;
m_Stream = PacketWriter.CreateInstance(length); // new PacketWriter( length );
m_Stream.Write((byte)packetID);
if (Core.Profiling)
{
PacketSendProfile prof = PacketSendProfile.Acquire(GetType());
prof.Increment();
}
}
示例10: Write
private static void Write(PacketWriter m_Stream, Mobile m, int noto) {
Point3D loc = m.Location;
int hue = m.Hue;
if ( m.SolidHueOverride >= 0 )
hue = m.SolidHueOverride;
m_Stream.Write( (int) m.Serial );
m_Stream.Write( (short) m.Body );
m_Stream.Write( (short) loc.m_X );
m_Stream.Write( (short) loc.m_Y );
m_Stream.Write( (sbyte) loc.m_Z );
m_Stream.Write( (byte) m.Direction );
m_Stream.Write( (short) hue );
m_Stream.Write( (byte) m.GetPacketFlags() );
m_Stream.Write( (byte) noto );//Notoriety.Compute( beholder, beheld ) );
}
示例11: Packet
//Smooth Multi START
protected Packet(int packetID, int length, PacketWriter stream)
{
m_PacketID = packetID;
m_Length = length;
m_Stream = stream;
m_Stream.Write((byte)packetID);
PacketSendProfile prof = PacketSendProfile.Acquire(GetType());
if (prof != null)
{
prof.Created++;
}
}
示例12: SmoothMove
public SmoothMove(BaseGalleon galleon, object[] objectsonboard)
: base(0xF6)
{
short packetlen = 1 + 17;
packetlen += (short)(objectsonboard.Length * 10);
packetlen = (short)(((packetlen & 0xff) << 8) | ((packetlen >> 8) & 0xff));
//to little endian
m_Stream = new PacketWriter( packetlen );
m_Stream.Write((byte)PacketID);
m_Stream.Write((short)packetlen);
m_Stream.Write((int)galleon.Serial);
m_Stream.Write((byte)galleon.Speed);
m_Stream.Write((byte)galleon.Moving);
m_Stream.Write((byte)galleon.Direction);
m_Stream.Write((short)galleon.X);
m_Stream.Write((short)galleon.Y);
m_Stream.Write((byte)0xFF);
m_Stream.Write((sbyte)galleon.Z);
m_Stream.Write((byte)0x0);
m_Stream.Write((byte)objectsonboard.Length);
#region items
foreach (object o in objectsonboard)
{
if (o is Mobile)
{
m_Stream.Write((int)((Mobile)o).Serial);
m_Stream.Write((short)((Mobile)o).X);
m_Stream.Write((short)((Mobile)o).Y);
m_Stream.Write((byte)0xFF);
m_Stream.Write((sbyte)((Mobile)o).Z);
}
if (o is Item)
{
m_Stream.Write((int)((Item)o).Serial);
m_Stream.Write((short)((Item)o).X);
m_Stream.Write((short)((Item)o).Y);
m_Stream.Write((byte)0xFF);
m_Stream.Write((sbyte)((Item)o).Z);
}
}
#endregion
// * BYTE[1] 0xF6
// * BYTE[2] Packet Length ( little endian format )
// * BYTE[4] Serial Multi
// * BYTE[1] Movement Speed
// * BYTE[1] Movement Direction
// * BYTE[1] Multi Direction
// * BYTE[2] X
// * BYTE[2] Y
// * BYTE[1] Fixed 0xFF
// * SBYTE[1] Z
// * BYTE[1] Fixed 0x0
// * BYTE[1] List Length
// * BYTE[List Length * 10] List
//Each List Entry is Composed by:
// * BYTE[4] Item Serial
// * BYTE[2] X
// * BYTE[2] Y
// * BYTE[1] Fixed 0xFF
// * SBYTE[1] Z
}