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


C# StreamHandler.UnalignedReadSmallInt方法代码示例

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


在下文中一共展示了StreamHandler.UnalignedReadSmallInt方法的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


//.........这里部分代码省略.........
                                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);
                            }
                        }
                    }
                }

                p_guid.Bytes[3] = Reader.UnalignedReadTinyInt(1);
                if (havePFlags)
                    this.Flags = (MovementFlags)Reader.UnalignedReadInt(30);
                this.HavePitch = !Reader.UnalignedReadBit();
                this.HaveFallData = Reader.UnalignedReadBit();

                if (havePFlags2)
                    this.Flags2 = (MovementFlags2)Reader.UnalignedReadSmallInt(12);

                p_guid.Bytes[0] = Reader.UnalignedReadTinyInt(1);
                haveOrientation = !Reader.UnalignedReadBit();

                if (this.HaveFallData)
                    this.HaveFallDirection = Reader.UnalignedReadBit();

                this.HaveSplineElevation = !Reader.UnalignedReadBit();
            }

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

            ushort field_1B2 = 0;
            ushort field_1AE = 0;
            ushort field_1B0 = 0;
            if (field_1AC)
            {
开发者ID:CarlosX,项目名称:Kamilla.Wow,代码行数:67,代码来源:MovementInfo.cs


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