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


C# GenericReader.ReadCoords4方法代码示例

本文整理汇总了C#中GenericReader.ReadCoords4方法的典型用法代码示例。如果您正苦于以下问题:C# GenericReader.ReadCoords4方法的具体用法?C# GenericReader.ReadCoords4怎么用?C# GenericReader.ReadCoords4使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GenericReader的用法示例。


在下文中一共展示了GenericReader.ReadCoords4方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ParseMovementUpdateBlock

        private bool ParseMovementUpdateBlock(GenericReader gr, StringBuilder sb, StreamWriter swe, StreamWriter data, ObjectTypes objectTypeId)
        {
            Coords4 coords;
            // need figure out flags2, check flags, because we can't read packet without it...
            // flags2:

            // 0x1 - not affect data
            // 0x2 - need check
            // 0x4
            // 0x8
            // 0x10 - need check
            // 0x20 - not affect data
            // 0x100
            // 0x800
            // 0x2000 - need check
            // 0x4000
            // 0x200000
            // 0x8000000 ?
            // 0x10000000
            // 0x20000000

            sb.AppendLine("=== movement_update_block_start ===");
            uint flags2 = 0;

            UpdateFlags flags = (UpdateFlags)gr.ReadByte();
            sb.AppendLine("flags " + flags.ToString("X"));

            if ((UpdateFlags.UPDATEFLAG_LIVING & flags) != 0) // 0x20
            {
                flags2 = gr.ReadUInt32();
                sb.AppendLine("flags2 " + flags2.ToString("X8"));

                uint time = gr.ReadUInt32();
                sb.AppendLine("time " + time);
            }

            if ((UpdateFlags.UPDATEFLAG_HASPOSITION & flags) != 0) // 0x40
            {
                if ((UpdateFlags.UPDATEFLAG_TRANSPORT & flags) != 0) // 0x02
                {
                    coords = gr.ReadCoords4();
                    sb.AppendLine("coords " + coords.GetCoordsAsString());
                }
                else // strange, we read the same data :)
                {
                    coords = gr.ReadCoords4();
                    sb.AppendLine("coords " + coords.GetCoordsAsString());
                }

                if (objectTypeId == ObjectTypes.TYPEID_UNIT || objectTypeId == ObjectTypes.TYPEID_GAMEOBJECT)
                {
                    data.WriteLine();
                    data.WriteLine(objectTypeId + ": " + coords.GetCoordsAsString());
                }

                if ((flags2 & 0x0200) != 0) // transport
                {
                    ulong t_guid = gr.ReadUInt64();
                    sb.Append("t_guid " + t_guid.ToString("X2") + ", ");

                    Coords4 transport = gr.ReadCoords4();
                    sb.AppendLine("t_coords " + transport.GetCoordsAsString());

                    uint unk1 = gr.ReadUInt32(); // unk, 2.0.6 == 0x11 or random
                    sb.AppendLine("unk1 " + unk1);
                }
            }

            if ((UpdateFlags.UPDATEFLAG_LIVING & flags) != 0) // 0x20
            {
                uint unk1 = gr.ReadUInt32();
                sb.AppendLine("unk1 " + unk1);

                if ((flags2 & 0x2000) != 0) // <---
                {
                    // looks like orientation/coords/speed
                    float unk2 = gr.ReadSingle();
                    sb.AppendLine("unk2 " + unk2);
                    float unk3 = gr.ReadSingle();
                    sb.AppendLine("unk3 " + unk3);
                    float unk4 = gr.ReadSingle();
                    sb.AppendLine("unk4 " + unk4);
                    float unk5 = gr.ReadSingle();
                    sb.AppendLine("unk5 " + unk5);
                }

                float ws = gr.ReadSingle();
                sb.AppendLine("Walk speed " + ws);
                float rs = gr.ReadSingle();
                sb.AppendLine("Run speed " + rs);
                float sbs = gr.ReadSingle();
                sb.AppendLine("Swimback speed " + sbs);
                float ss = gr.ReadSingle();
                sb.AppendLine("Swim speed " + ss);
                float wbs = gr.ReadSingle();
                sb.AppendLine("Walkback speed " + wbs);
                float fs = gr.ReadSingle();
                sb.AppendLine("Fly speed " + fs);
                float fbs = gr.ReadSingle();
                sb.AppendLine("Flyback speed " + fbs);
//.........这里部分代码省略.........
开发者ID:arkanoid1,项目名称:mywowtools,代码行数:101,代码来源:a9_parser.cs


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