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


C# StreamHandler.WriteSingle方法代码示例

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


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

示例1: WriteElement

 protected override void WriteElement(StreamHandler writer, RegularMovementPacket.MovementStatusElements element, MovementStatus status, byte[] guid, byte[] tguid)
 {
     if (element == MovementStatusElements.GenericDword2)
     {
         writer.FlushUnalignedBits();
         writer.WriteSingle(this.NewValue);
     }
     else
         base.WriteElement(writer, element, status, guid, tguid);
 }
开发者ID:SkyFire,项目名称:Kamilla.Wow,代码行数:10,代码来源:ForceChangeAckPacket.cs

示例2: ElementWrite

 protected override void ElementWrite(StreamHandler writer, int index)
 {
     if (index == -2)
     {
         writer.FlushUnalignedBits();
         writer.WriteSingle(this.NewValue);
     }
     else
         base.ElementWrite(writer, index);
 }
开发者ID:SkyFire,项目名称:Kamilla.Wow,代码行数:10,代码来源:ForceChangePacket.cs

示例3: ElementWrite

 protected override void ElementWrite(StreamHandler writer, int index)
 {
     switch (index)
     {
         case -2:
             writer.WriteSingle(this.DirectionCos);
             break;
         case -3:
             writer.WriteSingle(this.DirectionSin);
             break;
         case -4:
             writer.WriteSingle(this.HorizontalSpeed);
             break;
         case -5:
             writer.WriteSingle(this.VerticalSpeed);
             break;
         default:
             base.ElementRead(writer, index);
             break;
     }
 }
开发者ID:CarlosX,项目名称:Kamilla.Wow,代码行数:21,代码来源:ForceKnockBack.cs

示例4: ElementWrite

 protected override void ElementWrite(StreamHandler writer, int index)
 {
     writer.WriteSingle(this.NewValue);
 }
开发者ID:CarlosX,项目名称:Kamilla.Wow,代码行数:4,代码来源:SplineSetPacket.cs

示例5: WriteElement

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

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

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

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

            switch (element)
            {
                case MovementStatusElements.Flags:
                    writer.UnalignedWriteBit(status.Flags == 0);
                    break;
                case MovementStatusElements.Flags_2:
                    if (status.Flags != 0)
                        writer.UnalignedWriteInt((uint)status.Flags, 30);
                    break;
                case MovementStatusElements.Flags2:
                    writer.UnalignedWriteBit(status.Flags2 == 0);
                    break;
                case MovementStatusElements.Flags2_2:
                    if (status.Flags2 != 0)
                        writer.UnalignedWriteInt((ushort)status.Flags2, 12);
                    break;
                case MovementStatusElements.Timestamp:
                    writer.UnalignedWriteBit(status.TimeStamp == 0);
                    break;
                case MovementStatusElements.Timestamp_2:
                    if (status.TimeStamp != 0)
                        writer.WriteUInt32(status.TimeStamp);
                    break;
                case MovementStatusElements.Pitch:
                    writer.UnalignedWriteBit(!status.HavePitch);
                    break;
                case MovementStatusElements.Pitch_2:
                    if (status.HavePitch)
                        writer.WriteSingle(status.Pitch);
                    break;
                case MovementStatusElements.HaveFallData:
                    writer.UnalignedWriteBit(status.HaveFallData);
                    break;
                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;
//.........这里部分代码省略.........
开发者ID:SkyFire,项目名称:Kamilla.Wow,代码行数:101,代码来源:RegularMovementPacket.cs

示例6: Save

        /// <summary>
        /// Saves the current instance of SpellGo class to a StreamHandler.
        /// </summary>
        /// <param name="Writer">The StreamHandler to use.</param>
        public override void Save(StreamHandler Writer)
        {
            Writer.WritePackedGuid(Caster);
            Writer.WritePackedGuid(CastInvoker);
            Writer.WriteByte(CastId);
            Writer.WriteUInt32(SpellId);
            Writer.WriteUInt32((uint)Flags);
            Writer.WriteUInt32(Unk43);
            Writer.WriteUInt32(CastTime);

            Writer.WriteByte((byte)Hits.Count);
            foreach (WowGuid guid in Hits)
                Writer.WriteGuid(guid);

            Writer.WriteByte((byte)Misses.Count);
            foreach (MissData miss in Misses)
                miss.Write(Writer);

            TargetData.Write(Writer);

            if ((Flags & CastFlags.PredictedPower) != 0)
                Writer.WriteUInt32(PredictedPower);

            if ((Flags & CastFlags.RuneStates) != 0)
            {
                Writer.WriteByte((byte)RunesBefore);
                Writer.WriteByte((byte)RunesAfter);
                for (int i = 0; i < RuneCooldowns.Length; ++i)
                    Writer.WriteByte((byte)RuneCooldowns[i]);
            }

            if ((Flags & CastFlags.Unk0x00020000) != 0)
            {
                Writer.WriteSingle(Unk0x20000_Float);
                Writer.WriteUInt32(Unk0x20000_UInt32);
            }

            if ((Flags & CastFlags.Ammo) != 0)
            {
                Writer.WriteUInt32(ProjectileDisplayId);
                Writer.WriteUInt32((uint)ProjectileInventoryType);
            }

            if ((Flags & CastFlags.Unk0x00080000) != 0)
            {
                Writer.WriteUInt32(Unk0x80000_UInt32_1);
                Writer.WriteUInt32(Unk0x80000_UInt32_2);
            }

            if ((TargetData.Flags & SpellCastTargetFlags.DestLocation) != 0)
            {
                Writer.WriteByte(DestLocationCounter);
            }

            if ((TargetData.Flags & SpellCastTargetFlags.Unk4) != 0)
            {
                Writer.WriteUInt32(Unk4_Count);
                foreach (var pair in Unk4_List)
                {
                    Writer.WriteStruct(pair.Value);
                    Writer.WriteGuid(pair.Key);
                    if (pair.Key.IsEmpty)
                        break;
                }
            }
        }
开发者ID:SkyFire,项目名称:Kamilla.Wow,代码行数:70,代码来源:SpellCasting.cs

示例7: Save

        /// <summary>
        /// Saves the current ChatMessage to a stream using a StreamHandler.
        /// </summary>
        /// <param name="Writer">
        /// Instance of StreamHandler used to save the current ChatMessage to a stream.
        /// </param>
        public override void Save(StreamHandler Writer)
        {
            Writer.WriteByte((byte)m_type);
            Writer.WriteUInt32((uint)m_language);
            Writer.WriteGuid(m_senderGUID);
            Writer.WriteUInt32(m_unknownUInt32);

            switch (m_type)
            {
                case ChatMessageType.MonsterSay:
                case ChatMessageType.MonsterParty:
                case ChatMessageType.MonsterYell:
                case ChatMessageType.MonsterWhisper:
                case ChatMessageType.MonsterEmote:
                case ChatMessageType.RaidBossEmote:
                case ChatMessageType.RaidBossWhisper:
                case ChatMessageType.BattleNet:
                    Writer.WriteChatString(m_senderName ?? "<sender>");
                    Writer.WriteGuid(m_targetGUID);
                    if (!m_targetGUID.IsEmpty
                        && !m_targetGUID.IsPlayer
                        && !m_targetGUID.IsPet)
                    {
                        Writer.WriteChatString(m_targetName ?? "<target>");
                    }
                    if (m_language == Language.Addon)
                        Writer.WriteCString(m_addonPrefix ?? "<prefix>");
                    Writer.WriteChatString(m_text ?? "<text>");
                    Writer.WriteByte((byte)m_flags);
                    if (m_type == ChatMessageType.RaidBossEmote || m_type == ChatMessageType.RaidBossWhisper)
                    {
                        Writer.WriteSingle(m_displayTime);
                        Writer.WriteBoolean(m_suspendEvent);
                    }
                    break;
                case ChatMessageType.BGSystemNeutral:
                case ChatMessageType.BGSystemAlliance:
                case ChatMessageType.BGSystemHorde:
                    Writer.WriteGuid(m_targetGUID);
                    if (!m_targetGUID.IsEmpty
                        && !m_targetGUID.IsPlayer)
                    {
                        Writer.WriteChatString(m_targetName);
                    }
                    if (m_language == Language.Addon)
                        Writer.WriteCString(m_addonPrefix ?? "<prefix>");
                    Writer.WriteChatString(m_text ?? "<text>");
                    Writer.WriteByte((byte)m_flags);
                    break;
                case ChatMessageType.Achievement:
                case ChatMessageType.GuildAchievement:
                    Writer.WriteGuid(m_targetGUID);
                    if (m_language == Language.Addon)
                        Writer.WriteCString(m_addonPrefix ?? "<prefix>");
                    Writer.WriteChatString(m_text ?? "<text>");
                    Writer.WriteByte((byte)m_flags);
                    Writer.WriteUInt32(m_achievementId);
                    break;
                case ChatMessageType.WhisperForeign:
                    Writer.WriteChatString(m_senderName ?? "<sender>");
                    Writer.WriteGuid(m_targetGUID);
                    if (m_language == Language.Addon)
                        Writer.WriteCString(m_addonPrefix ?? "<prefix>");
                    Writer.WriteChatString(m_text ?? "<text>");
                    Writer.WriteByte((byte)m_flags);
                    break;
                default:
                    if (GameMasterMessage)
                        Writer.WriteChatString(m_senderName ?? "<sender>");
                    if (m_type == ChatMessageType.Channel)
                        Writer.WriteCString(m_channel ?? "<channel>");
                    Writer.WriteGuid(m_targetGUID);
                    if (m_language == Language.Addon)
                        Writer.WriteCString(m_addonPrefix ?? "<prefix>");
                    Writer.WriteChatString(m_text ?? "<text>");
                    Writer.WriteByte((byte)m_flags);
                    break;
            }
        }
开发者ID:CarlosX,项目名称:Kamilla.Wow,代码行数:85,代码来源:ServerChatMessage.cs

示例8: Save


//.........这里部分代码省略.........
                        .UnalignedWriteBit(bytes[0] != 0)
                        .UnalignedWriteBit(bytes[4] != 0)
                        .UnalignedWriteBit(this.HaveTransportTime2)
                        .UnalignedWriteBit(bytes[7] != 0);
                }
            }

            // TODO: shorts here

            if (this.HaveAttackingTarget)
            {
                fixed (byte* bytes = this.AttackingTarget.Bytes)
                {
                    Writer
                        .UnalignedWriteBit(bytes[3] != 0)
                        .UnalignedWriteBit(bytes[4] != 0)
                        .UnalignedWriteBit(bytes[6] != 0)
                        .UnalignedWriteBit(bytes[0] != 0)
                        .UnalignedWriteBit(bytes[1] != 0)
                        .UnalignedWriteBit(bytes[7] != 0)
                        .UnalignedWriteBit(bytes[5] != 0)
                        .UnalignedWriteBit(bytes[2] != 0);
                }
            }

            Writer.FlushUnalignedBits();

            foreach (var val in this.UnkUInt32)
                Writer.WriteUInt32(val);

            if (this.HavePosition)
            {
                Writer
                    .WriteSingle(this.Position.Z)
                    .WriteSingle(this.Orientation)
                    .WriteSingle(this.Position.X)
                    .WriteSingle(this.Position.Y);
            }

            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]);
开发者ID:CarlosX,项目名称:Kamilla.Wow,代码行数:66,代码来源:MovementInfo.cs


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