本文整理汇总了C#中System.IO.BinaryWriter.WritePackedUInt64方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryWriter.WritePackedUInt64方法的具体用法?C# BinaryWriter.WritePackedUInt64怎么用?C# BinaryWriter.WritePackedUInt64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.BinaryWriter
的用法示例。
在下文中一共展示了BinaryWriter.WritePackedUInt64方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildCreatePacket
protected override byte[] BuildCreatePacket()
{
foreach (var creationUpdateFieldEntry in entity.Info.CreationUpdateFieldEntries)
{
UpdateQueue.Enqueue(creationUpdateFieldEntry);
}
SetInfoFields(entity.Info);
var writer = new BinaryWriter(new MemoryStream());
writer.Write((byte)ObjectUpdateType.UPDATETYPE_CREATE_OBJECT);
writer.WritePackedUInt64(this.entity.ObjectGUID.RawGUID);
writer.Write((byte)TypeID.TYPEID_GAMEOBJECT);
ObjectUpdateFlag updateFlags = ObjectUpdateFlag.UPDATEFLAG_TRANSPORT | ObjectUpdateFlag.UPDATEFLAG_ALL
| ObjectUpdateFlag.UPDATEFLAG_HAS_POSITION;
writer.Write((byte)updateFlags);
// Position
writer.Write(entity.Location.X);
writer.Write(entity.Location.Y);
writer.Write(entity.Location.Z);
writer.Write(entity.Location.Orientation); // R
writer.Write((uint)0x1); // Unkown... time?
writer.Write((uint)0); // Unkown... time?
WriteUpdateFields(writer);
return (writer.BaseStream as MemoryStream).ToArray();
}
示例2: BuildUpdatePacket
protected override byte[] BuildUpdatePacket()
{
this.SetInfoFields(entity.Info);
var writer = new BinaryWriter(new MemoryStream());
writer.Write((byte)ObjectUpdateType.UPDATETYPE_VALUES);
writer.WritePackedUInt64(entity.ObjectGUID.RawGUID);
this.WriteUpdateFields(writer);
return (writer.BaseStream as MemoryStream).ToArray();
}
示例3: BuildCreatePacket
protected override byte[] BuildCreatePacket()
{
//Add all info field entries to the queue
foreach (var creationUpdateFieldEntry in entity.Info.CreationUpdateFieldEntries)
{
UpdateQueue.Enqueue(creationUpdateFieldEntry);
}
SetInfoFields(entity.Info);
var writer = new BinaryWriter(new MemoryStream());
//TODO Work out why "adder" unit crashes client. Maybe a pet or dynamic object?
writer.Write((byte)ObjectUpdateType.UPDATETYPE_CREATE_OBJECT);
writer.WritePackedUInt64(entity.ObjectGUID.RawGUID);
writer.Write((byte)TypeID.TYPEID_UNIT);
ObjectUpdateFlag updateFlags = ObjectUpdateFlag.UPDATEFLAG_ALL | ObjectUpdateFlag.UPDATEFLAG_LIVING
| ObjectUpdateFlag.UPDATEFLAG_HAS_POSITION;
writer.Write((byte)updateFlags);
writer.Write((uint)MovementFlags.MOVEFLAG_NONE); // MovementFlags
writer.Write((uint)Environment.TickCount); // Time
// 3 bytes ahead?
// Position
writer.Write(entity.Location.X);
writer.Write(entity.Location.Y);
writer.Write(entity.Location.Z);
writer.Write(entity.Location.Orientation); // R
// Movement speeds
writer.Write((float)0); // ????
writer.Write(entity.Info.WalkSpeed); // MOVE_WALK
writer.Write((float)7); // MOVE_RUN
writer.Write(4.5f); // MOVE_RUN_BACK
writer.Write(4.72f); // MOVE_SWIM
writer.Write(2.5f); // MOVE_SWIM_BACK
writer.Write(3.14f); // MOVE_TURN_RATE
writer.Write(0x1); // Unkown...
// entity.GUID = 1141440694;
this.WriteUpdateFields(writer);
return (writer.BaseStream as MemoryStream).ToArray();
}
示例4: BuildOwnCharacterPacket
public PSUpdateObject BuildOwnCharacterPacket()
{
foreach (var creationUpdateFieldEntry in entity.Info.CreationUpdateFieldEntries)
{
UpdateQueue.Enqueue(creationUpdateFieldEntry);
}
SetInfoFields(entity.Info);
BinaryWriter writer = new BinaryWriter(new MemoryStream());
writer.Write((byte)ObjectUpdateType.UPDATETYPE_CREATE_OBJECT2);
writer.WritePackedUInt64(this.entity.ObjectGUID.RawGUID);
writer.Write((byte)TypeID.TYPEID_PLAYER);
ObjectUpdateFlag updateFlags = ObjectUpdateFlag.UPDATEFLAG_ALL |
ObjectUpdateFlag.UPDATEFLAG_SELF |
ObjectUpdateFlag.UPDATEFLAG_HAS_POSITION |
ObjectUpdateFlag.UPDATEFLAG_LIVING;
writer.Write((byte)updateFlags);
writer.Write((UInt32)MovementFlags.MOVEFLAG_NONE);
writer.Write((UInt32)Environment.TickCount); // Time?
// Position
writer.Write((float)entity.Location.X);
writer.Write((float)entity.Location.Y);
writer.Write((float)entity.Location.Z);
writer.Write((float)entity.Location.Orientation); // R
// Movement speeds
writer.Write((float)0); // ????
writer.Write((float)entity.Info.WalkSpeed); // MOVE_WALK
writer.Write((float)20f); // MOVE_RUN
writer.Write((float)4.5f); // MOVE_RUN_BACK
writer.Write((float)4.72f); // MOVE_SWIM
writer.Write((float)2.5f); // MOVE_SWIM_BACK
writer.Write((float)3.14f); // MOVE_TURN_RATE
writer.Write(0x1); // Unkown...
this.WriteUpdateFields(writer);
return new PSUpdateObject(new List<byte[]>() { (writer.BaseStream as MemoryStream).ToArray() });
}
示例5: RemoveEntitiesBlock
private byte[] RemoveEntitiesBlock()
{
var writer = new BinaryWriter(new MemoryStream());
writer.Write((byte)ObjectUpdateType.UPDATETYPE_OUT_OF_RANGE_OBJECTS);
writer.Write((uint)this.removeEntities.Count);
while(removeEntities.Count != 0)
{
var entity = removeEntities.Dequeue();
writer.WritePackedUInt64(entity.ObjectGUID.RawGUID);
}
return (writer.BaseStream as MemoryStream).ToArray();
}
示例6: BuildUpdatePacket
protected override byte[] BuildUpdatePacket()
{
foreach (var creationUpdateFieldEntry in entity.Info.CreationUpdateFieldEntries)
{
UpdateQueue.Enqueue(creationUpdateFieldEntry);
}
this.SetInfoFields(entity.Info);
var writer = new BinaryWriter(new MemoryStream());
writer.Write((byte)ObjectUpdateType.UPDATETYPE_VALUES);
writer.WritePackedUInt64(entity.ObjectGUID.RawGUID);
this.WriteUpdateFields(writer);
return (writer.BaseStream as MemoryStream).ToArray();
}