当前位置: 首页>>代码示例>>C#>>正文


C# BinaryWriter.WritePackedUInt64方法代码示例

本文整理汇总了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();
        }
开发者ID:Refuge89,项目名称:Vanilla,代码行数:34,代码来源:GameObjectPacketBuilder.cs

示例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();
 }
开发者ID:Refuge89,项目名称:Vanilla,代码行数:9,代码来源:GameObjectPacketBuilder.cs

示例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();
        }
开发者ID:Refuge89,项目名称:Vanilla,代码行数:52,代码来源:CreaturePacketBuilder.cs

示例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() });
        }
开发者ID:Refuge89,项目名称:Vanilla,代码行数:47,代码来源:PlayerPacketBuilder.cs

示例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();
        }
开发者ID:Refuge89,项目名称:Vanilla,代码行数:14,代码来源:UpdatePacketBuilder.cs

示例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();
        }
开发者ID:Refuge89,项目名称:Vanilla,代码行数:14,代码来源:PlayerPacketBuilder.cs


注:本文中的System.IO.BinaryWriter.WritePackedUInt64方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。