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


C# StreamHandler.UnalignedReadInt方法代码示例

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


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

示例1: ReadElement

        protected virtual void ReadElement(StreamHandler reader, MovementStatusElements element, MovementStatus status, byte[] guid, byte[] tguid)
        {
            if (element >= MovementStatusElements.GuidByte0 && element <= MovementStatusElements.GuidByte7)
            {
                ReadByteMask(reader, ref guid[element - MovementStatusElements.GuidByte0]);
                return;
            }

            if (element >= MovementStatusElements.TransportGuidByte0 &&
                element <= MovementStatusElements.TransportGuidByte7)
            {
                if (status.HaveTransportData)
                    ReadByteMask(reader, ref tguid[element - MovementStatusElements.TransportGuidByte0]);
                return;
            }

            if (element >= MovementStatusElements.GuidByte0_2 && element <= MovementStatusElements.GuidByte7_2)
            {
                ReadByteSeq(reader, ref guid[element - MovementStatusElements.GuidByte0_2]);
                return;
            }

            if (element >= MovementStatusElements.TransportGuidByte0_2 &&
                element <= MovementStatusElements.TransportGuidByte7_2)
            {
                if (status.HaveTransportData)
                    ReadByteSeq(reader, ref tguid[element - MovementStatusElements.TransportGuidByte0_2]);
                return;
            }

            switch (element)
            {
                case MovementStatusElements.Flags:
                    status.Flags = (MovementFlags)(!reader.UnalignedReadBit() ? 1 : 0);
                    break;
                case MovementStatusElements.Flags_2:
                    if (status.Flags != 0)
                        status.Flags = (MovementFlags)reader.UnalignedReadInt(30);
                    break;
                case MovementStatusElements.Flags2:
                    status.Flags2 = (MovementFlags2)(!reader.UnalignedReadBit() ? 1 : 0);
                    break;
                case MovementStatusElements.Flags2_2:
                    if (status.Flags2 != 0)
                        status.Flags2 = (MovementFlags2)reader.UnalignedReadSmallInt(12);
                    break;
                case MovementStatusElements.Timestamp:
                    status.TimeStamp = !reader.UnalignedReadBit() ? 1U : 0U;
                    break;
                case MovementStatusElements.Timestamp_2:
                    if (status.TimeStamp != 0)
                        status.TimeStamp = reader.ReadUInt32();
                    break;
                case MovementStatusElements.HaveFallData:
                    status.HaveFallData = reader.UnalignedReadBit();
                    break;
                case MovementStatusElements.HaveFallDirection:
                    if (status.HaveFallData)
                        status.HaveFallDirection = reader.UnalignedReadBit();
                    break;
                case MovementStatusElements.HaveTransportData:
                    status.HaveTransportData = reader.UnalignedReadBit();
                    break;
                case MovementStatusElements.TransportHaveTime2:
                    if (status.HaveTransportData)
                        status.HaveTransportTime2 = reader.UnalignedReadBit();
                    break;
                case MovementStatusElements.TransportHaveTime3:
                    if (status.HaveTransportData)
                        status.HaveTransportTime3 = reader.UnalignedReadBit();
                    break;
                case MovementStatusElements.HaveSpline:
                    status.HaveSpline = reader.UnalignedReadBit();
                    break;
                case MovementStatusElements.HaveSpline2:
                    status.HaveSpline2 = reader.UnalignedReadBit();
                    break;
                case MovementStatusElements.PositionX:
                    status.Position.X = reader.ReadSingle();
                    break;
                case MovementStatusElements.PositionY:
                    status.Position.Y = reader.ReadSingle();
                    break;
                case MovementStatusElements.PositionZ:
                    status.Position.Z = reader.ReadSingle();
                    break;
                case MovementStatusElements.PositionO:
                    status.Orientation = !reader.UnalignedReadBit() ? 1.0f : 0.0f;
                    break;
                case MovementStatusElements.PositionO_2:
                    if (status.Orientation != 0.0f)
                        status.Orientation = reader.ReadSingle();
                    break;
                case MovementStatusElements.Pitch:
                    status.HavePitch = !reader.UnalignedReadBit();
                    break;
                case MovementStatusElements.Pitch_2:
                    if (status.HavePitch)
                        status.Pitch = reader.ReadSingle();
                    break;
//.........这里部分代码省略.........
开发者ID:SkyFire,项目名称:Kamilla.Wow,代码行数:101,代码来源:RegularMovementPacket.cs

示例2: MovementInfo

        public unsafe MovementInfo(StreamHandler Reader)
        {
            var guid = new WowGuid();
            this.HaveAttackingTarget = Reader.UnalignedReadBit();
            guid.Bytes[2] = Reader.UnalignedReadTinyInt(1);
            this.HaveVehicleData = Reader.UnalignedReadBit();
            guid.Bytes[1] = Reader.UnalignedReadTinyInt(1);
            guid.Bytes[4] = Reader.UnalignedReadTinyInt(1);
            guid.Bytes[3] = Reader.UnalignedReadTinyInt(1);
            this.HaveTransportTime = Reader.UnalignedReadBit();
            this.HaveGameObjectPosition = Reader.UnalignedReadBit();
            bool field_1C8 = Reader.UnalignedReadBit();
            bool field_1AC = Reader.UnalignedReadBit();
            this.HaveGameObjectRotation = Reader.UnalignedReadBit();
            this.Living = Reader.UnalignedReadBit();
            this.HavePosition = Reader.UnalignedReadBit();
            var arrCounter = Reader.UnalignedReadInt(24);
            guid.Bytes[0] = Reader.UnalignedReadTinyInt(1);

            bool havePFlags = false;
            WowGuid p_guid;
            uint splinePoints = 0;
            bool havePFlags2 = false;
            bool haveOrientation = false;

            if (this.Living)
            {
                this.HaveTransportData = Reader.UnalignedReadBit();
                if (this.HaveTransportData)
                {
                    fixed (byte* bytes = this.TransportGuid.Bytes)
                    {
                        bytes[2] = Reader.UnalignedReadTinyInt(1);
                        bytes[7] = Reader.UnalignedReadTinyInt(1);
                        bytes[5] = Reader.UnalignedReadTinyInt(1);
                        this.HaveTransportTime3 = Reader.UnalignedReadBit();
                        bytes[3] = Reader.UnalignedReadTinyInt(1);
                        bytes[0] = Reader.UnalignedReadTinyInt(1);
                        bytes[4] = Reader.UnalignedReadTinyInt(1);
                        bytes[1] = Reader.UnalignedReadTinyInt(1);
                        this.HaveTransportTime2 = Reader.UnalignedReadBit();
                        bytes[6] = Reader.UnalignedReadTinyInt(1);
                    }
                }

                this.HaveSpline2 = Reader.UnalignedReadBit();
                p_guid.Bytes[7] = Reader.UnalignedReadTinyInt(1);
                p_guid.Bytes[6] = Reader.UnalignedReadTinyInt(1);
                p_guid.Bytes[5] = Reader.UnalignedReadTinyInt(1);
                p_guid.Bytes[2] = Reader.UnalignedReadTinyInt(1);
                p_guid.Bytes[4] = Reader.UnalignedReadTinyInt(1);
                havePFlags = !Reader.UnalignedReadBit();
                p_guid.Bytes[1] = Reader.UnalignedReadTinyInt(1);
                this.SelfTarget = Reader.UnalignedReadBit();
                this.TimeStamp = !Reader.UnalignedReadBit() ? 1U : 0U;
                havePFlags2 = !Reader.UnalignedReadBit();

                if (this.HaveSpline2)
                {
                    this.HaveSpline = Reader.UnalignedReadBit();
                    if (this.HaveSpline)
                    {
                        this.Spline.HaveDurationMultiplier = Reader.UnalignedReadBit();
                        this.Spline.Flags = (SplineFlags)Reader.UnalignedReadInt(25);
                        this.Spline.SplineMode = (SplineMode)Reader.UnalignedReadTinyInt(2);
                        this.Spline.HaveUnknown1 = Reader.UnalignedReadBit();
                        splinePoints = Reader.UnalignedReadInt(22);
                        var type = Reader.UnalignedReadTinyInt(2);
                        switch (type)
                        {
                            case 0:
                                this.Spline.SplineType = SplineType.FacingSpot;
                                break;
                            case 1:
                                this.Spline.SplineType = SplineType.Normal;
                                break;
                            case 2:
                                this.Spline.SplineType = SplineType.FacingTarget;
                                break;
                            case 3:
                                this.Spline.SplineType = SplineType.FacingAngle;
                                break;
                        }
                        if (this.Spline.SplineType == SplineType.FacingTarget)
                        {
                            fixed (byte* bytes = this.Spline.FacingTarget.Bytes)
                            {
                                bytes[7] = Reader.UnalignedReadTinyInt(1);
                                bytes[3] = Reader.UnalignedReadTinyInt(1);
                                bytes[4] = Reader.UnalignedReadTinyInt(1);
                                bytes[2] = Reader.UnalignedReadTinyInt(1);
                                bytes[1] = Reader.UnalignedReadTinyInt(1);
                                bytes[6] = Reader.UnalignedReadTinyInt(1);
                                bytes[0] = Reader.UnalignedReadTinyInt(1);
                                bytes[5] = Reader.UnalignedReadTinyInt(1);
                            }
                        }
                    }
                }

//.........这里部分代码省略.........
开发者ID:CarlosX,项目名称:Kamilla.Wow,代码行数:101,代码来源:MovementInfo.cs


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