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


C# StreamHandler.WriteSByte方法代码示例

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


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

示例1: WriteElement


//.........这里部分代码省略.........
                case MovementStatusElements.HaveFallDirection:
                    if (status.HaveFallData)
                        writer.UnalignedWriteBit(status.HaveFallDirection);
                    break;
                case MovementStatusElements.HaveTransportData:
                    writer.UnalignedWriteBit(status.HaveTransportData);
                    break;
                case MovementStatusElements.TransportHaveTime2:
                    if (status.HaveTransportData)
                        writer.UnalignedWriteBit(status.HaveTransportTime2);
                    break;
                case MovementStatusElements.TransportHaveTime3:
                    if (status.HaveTransportData)
                        writer.UnalignedWriteBit(status.HaveTransportTime3);
                    break;
                case MovementStatusElements.HaveSpline:
                    writer.UnalignedWriteBit(status.HaveSpline);
                    break;
                case MovementStatusElements.HaveSpline2:
                    writer.UnalignedWriteBit(status.HaveSpline2);
                    break;
                case MovementStatusElements.SplineElev:
                    writer.UnalignedWriteBit(!status.HaveSplineElevation);
                    break;
                case MovementStatusElements.SplineElev_2:
                    if (status.HaveSplineElevation)
                        writer.WriteSingle(status.SplineElevation);
                    break;
                case MovementStatusElements.PositionX:
                    writer.WriteSingle(status.Position.X);
                    break;
                case MovementStatusElements.PositionY:
                    writer.WriteSingle(status.Position.Y);
                    break;
                case MovementStatusElements.PositionZ:
                    writer.WriteSingle(status.Position.Z);
                    break;
                case MovementStatusElements.PositionO:
                    writer.UnalignedWriteBit(status.Orientation == 0.0f);
                    break;
                case MovementStatusElements.PositionO_2:
                    if (status.Orientation != 0.0f)
                        writer.WriteSingle(status.Orientation);
                    break;
                case MovementStatusElements.FallTime:
                    if (status.HaveFallData)
                        writer.WriteUInt32(status.FallTime);
                    break;
                case MovementStatusElements.FallHorizontalSpeed:
                    if (status.HaveFallDirection)
                        writer.WriteSingle(status.FallHorizontalSpeed);
                    break;
                case MovementStatusElements.FallVerticalSpeed:
                    if (status.HaveFallData)
                        writer.WriteSingle(status.FallVerticalSpeed);
                    break;
                case MovementStatusElements.FallCosAngle:
                    if (status.HaveFallDirection)
                        writer.WriteSingle(status.FallCosAngle);
                    break;
                case MovementStatusElements.FallSinAngle:
                    if (status.HaveFallDirection)
                        writer.WriteSingle(status.FallSinAngle);
                    break;
                case MovementStatusElements.TransportSeat:
                    if (status.HaveTransportData)
                        writer.WriteSByte(status.TransportSeat);
                    break;
                case MovementStatusElements.TransportPositionO:
                    if (status.HaveTransportData)
                        writer.WriteSingle(status.TransportFacing);
                    break;
                case MovementStatusElements.TransportPositionX:
                    if (status.HaveTransportData)
                        writer.WriteSingle(status.TransportPosition.X);
                    break;
                case MovementStatusElements.TransportPositionY:
                    if (status.HaveTransportData)
                        writer.WriteSingle(status.TransportPosition.Y);
                    break;
                case MovementStatusElements.TransportPositionZ:
                    if (status.HaveTransportData)
                        writer.WriteSingle(status.TransportPosition.Z);
                    break;
                case MovementStatusElements.TransportTime:
                    if (status.HaveTransportData)
                        writer.WriteUInt32(status.TransportTime);
                    break;
                case MovementStatusElements.TransportTime2:
                    if (status.HaveTransportTime2)
                        writer.WriteUInt32(status.TransportTime2);
                    break;
                case MovementStatusElements.TransportTime3:
                    if (status.HaveTransportTime3)
                        writer.WriteUInt32(status.TransportTime3);
                    break;
                default:
                    throw new InvalidOperationException("Unknown element: " + element);
            }
        }
开发者ID:SkyFire,项目名称:Kamilla.Wow,代码行数:101,代码来源:RegularMovementPacket.cs

示例2: Save


//.........这里部分代码省略.........
            }

            if (this.HaveVehicleData)
            {
                Writer
                    .WriteUInt32(this.VehicleId)
                    .WriteSingle(this.VehicleAimAdjustement);
            }

            if (this.HaveGameObjectPosition)
            {
                fixed (byte* bytes = this.TransportGuid.Bytes)
                {
                    Writer
                        .WriteXorByte(bytes[1])
                        .WriteXorByte(bytes[4])
                        .WriteSingle(this.TransportPosition.Z);

                    if (this.HaveTransportTime3)
                        Writer.WriteUInt32(this.TransportTime3);

                    Writer.WriteUInt32(this.TransportTime);

                    Writer
                        .WriteXorByte(bytes[5])
                        .WriteXorByte(bytes[6])
                        .WriteSingle(this.TransportPosition.X)
                        .WriteXorByte(bytes[2]);

                    if (this.HaveTransportTime2)
                        Writer.WriteUInt32(this.TransportTime2);

                    Writer
                        .WriteSByte(this.TransportSeat)
                        .WriteXorByte(bytes[3])
                        .WriteSingle(this.TransportPosition.Y)
                        .WriteSingle(this.TransportFacing)
                        .WriteXorByte(bytes[7])
                        .WriteXorByte(bytes[0]);
                }
            }

            if (this.Living)
            {
                if (this.HaveSpline2)
                {
                    if (this.HaveSpline)
                    {
                        foreach (var point in this.Spline.Points)
                            Writer.WriteSingle(point.Y).WriteSingle(point.X).WriteSingle(point.Z);

                        if (this.Spline.HaveDurationMultiplier)
                        {
                            Writer.WriteSingle(this.Spline.DurationMultiplier);
                        }

                        Writer.WriteSingle(this.Spline.UnknownFloat2);

                        if (this.Spline.SplineType == SplineType.FacingTarget)
                        {
                            fixed (byte* bytes = this.Spline.FacingTarget.Bytes)
                            {
                                Writer
                                    .WriteXorByte(bytes[3])
                                    .WriteXorByte(bytes[4])
                                    .WriteXorByte(bytes[5])
开发者ID:CarlosX,项目名称:Kamilla.Wow,代码行数:67,代码来源:MovementInfo.cs


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