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


C# GenericReader.ReadCoords3方法代码示例

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


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

示例1: ParseMovementUpdateBlock


//.........这里部分代码省略.........
            }
/*
            // still used, but can't figure out when...
            if ((flags2 & 0x8000000) == 0 && objectTypeId == ObjectTypes.TYPEID_UNIT)
            {
                if ((flags3 & 0x40000) != 0)
                {
                    uint f3_3 = br.ReadUInt32();
                    sb.AppendLine("flags3_unk_value3 " + f3_3);
                }

                if ((flags3 & 0x20000) != 0)
                {
                    ulong g3 = br.ReadUInt64();
                    sb.AppendLine("flags3_guid " + g3); // ????
                }
            }
*/
            if ((UpdateFlags.UPDATEFLAG_HIGHGUID & flags) != 0) // 0x08
            {
                uint guid_high = gr.ReadUInt32(); // 2.0.10 - it's not high guid anymore
                sb.AppendLine("guid_high " + guid_high);
            }

            if ((UpdateFlags.UPDATEFLAG_FULLGUID & flags) != 0) // 0x04
            //if ((UpdateFlags.UPDATEFLAG_FULLGUID & flags) != 0 && (flags3 & 0x20000) == 0) // 0x04
            //if ((UpdateFlags.UPDATEFLAG_FULLGUID & flags) != 0 && (flags3 & 0x40000) == 0) // 0x04
            {
                //long pos = br.BaseStream.Position;
                //swe.WriteLine("flags & 0x4 at position " + pos.ToString("X2"));

                ulong guid2 = gr.ReadPackedGuid(); // looks like guid, but what guid?
                sb.AppendLine("unk guid " + guid2);
            }

            if ((UpdateFlags.UPDATEFLAG_TRANSPORT & flags) != 0) // 0x02
            {
                uint time = gr.ReadUInt32();
                sb.AppendLine("t_time " + time);
            }

            if ((flags2 & 0x8000000) != 0) // splines
            {
                uint t1 = gr.ReadUInt32();
                sb.AppendLine("t1 " + t1);

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

                //outdated 2.0.10
                //uint t3 = br.ReadUInt32();
                //sb.AppendLine("t3 " + t3);

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

                //if (coords_count > 1000)
                //{
                //    coords_count = br.ReadUInt32();
                //    sb.AppendLine("second attempt to get correct coords count, now " + coords_count);
                //}

                //if (coords_count > 1000)
                //{
                //    coords_count = br.ReadUInt32();
                //    sb.AppendLine("third attempt to get correct coords count, now " + coords_count);
                //}

                if (coords_count > 1000) // prevent overflow in case wrong packet parsing :)
                {
                    long pos = gr.BaseStream.Position;
                    swe.WriteLine("error position " + pos.ToString("X2"));

                    swe.WriteLine("error while parsing movement update block, flags: " + flags.ToString("X") + ", flags2: " + flags2.ToString("X") + ", flags3: " + flags3.ToString("X") + ", objecttype " + objectTypeId);
                    return false;
                }

                if (coords_count > 0)
                {
                    for (uint i = 0; i < coords_count; i++)
                    {
                        Coords3 v = gr.ReadCoords3();
                        sb.AppendLine("coord" + i + ": " + v.GetCoords());
                    }
                }

                Coords3 end = gr.ReadCoords3();
                sb.AppendLine("end: " + end.GetCoords());

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

                // added in 2.0.10 (really?)
                uint t9 = gr.ReadUInt32();
                sb.AppendLine("t9 " + t9);
            }

            sb.AppendLine("=== movement_update_block_end ===");
            return true;
        }
开发者ID:arkanoid1,项目名称:mywowtools,代码行数:101,代码来源:a9_parser.cs


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