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


C# StreamHandler.ReadSingle方法代码示例

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


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

示例1: ElementRead

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

示例2: ReadElement

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

示例3: ElementRead

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

示例4: ElementRead

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

示例5: 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

示例6: Read

        public override void Read(StreamHandler Reader)
        {
            Caster = Reader.ReadPackedGuid();
            CastInvoker = Reader.ReadPackedGuid();
            CastId = Reader.ReadByte();
            SpellId = Reader.ReadUInt32();
            Flags = (CastFlags)Reader.ReadUInt32();
            Unk43 = Reader.ReadUInt32();
            CastTime = Reader.ReadUInt32();

            byte hits = Reader.ReadByte();
            Hits.Capacity = hits;
            for (byte i = 0; i < hits; ++i)
                Hits.Add(Reader.ReadGuid());

            byte misses = Reader.ReadByte();
            Misses.Capacity = misses;
            for (byte i = 0; i < misses; ++i)
            {
                var miss = new MissData();
                miss.Read(Reader);
                Misses.Add(miss);
            }

            TargetData.Read(Reader);

            if ((Flags & CastFlags.PredictedPower) != 0)
                PredictedPower = Reader.ReadUInt32();

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

            if ((Flags & CastFlags.Unk0x00020000) != 0)
            {
                Unk0x20000_Float = Reader.ReadSingle();
                Unk0x20000_UInt32 = Reader.ReadUInt32();
            }

            if ((Flags & CastFlags.Ammo) != 0)
            {
                ProjectileDisplayId = Reader.ReadUInt32();
                ProjectileInventoryType = (InventorySlotType)Reader.ReadUInt32();
            }

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

            if ((TargetData.Flags & SpellCastTargetFlags.DestLocation) != 0)
                DestLocationCounter = Reader.ReadByte();

            if ((TargetData.Flags & SpellCastTargetFlags.Unk4) != 0)
            {
                uint count = Reader.ReadUInt32();
                Unk4_Count = count;
                Unk4_List.Capacity = (int)count;

                for (uint i = 0; i < count; ++i)
                {
                    Vector3 v3 = Reader.ReadVector3();
                    WowGuid guid = Reader.ReadGuid();
                    Unk4_List.Add(new KeyValuePair<WowGuid, Vector3>(guid, v3));
                    if (guid.IsEmpty)
                        break;
                }
            }
        }
开发者ID:SkyFire,项目名称:Kamilla.Wow,代码行数:74,代码来源:SpellCasting.cs

示例7: InternalParse

        protected override void InternalParse()
        {
            int row;
            int size;
            DB2Ids type;

            Output.AppendLine("Data Size: " + (size = Reader.ReadInt32()));
            byte[] data = Reader.ReadBytes(size);

            Output.AppendLine("Type: " + (type = (DB2Ids)Reader.ReadUInt32()));
            Output.AppendLine("Row: " + (row = Reader.ReadInt32()));
            Output.AppendLine("Time(?): " + Reader.ReadUInt32().AsUnixTime());
            Output.AppendLine();

            if (row < 0)
                return;

            using (var dataReader = new StreamHandler(data))
            {
                if (type == DB2Ids.Item)
                {
                    Output.AppendLine("Item Id: " + dataReader.ReadUInt32());
                    Output.AppendLine("Class: " + (ItemClass)dataReader.ReadUInt32());
                    Output.AppendLine("SubClass: " + (ItemSubClass)dataReader.ReadUInt32());
                    Output.AppendLine("Unk -1: " + dataReader.ReadInt32());
                    Output.AppendLine("Material: " + (Material)dataReader.ReadUInt32());
                    Output.AppendLine("Display Id: " + dataReader.ReadUInt32());
                    Output.AppendLine("Inventory Type: " + (InventorySlot)dataReader.ReadUInt32());
                    Output.AppendLine("Sheath: " + dataReader.ReadUInt32());
                }
                else if (type == DB2Ids.ItemSparse)
                {
                    Output.AppendLine("id: " + dataReader.ReadInt32());
                    Output.AppendLine("quality: " + (ItemQuality)dataReader.ReadInt32());
                    Output.AppendLine("flags: " + dataReader.ReadUInt32());
                    Output.AppendLine("flags2: " + dataReader.ReadUInt32());
                    Output.AppendLine("4.3.2 float1: " + dataReader.ReadSingle()); // 0.95-1.05
                    Output.AppendLine("4.3.2 float2: " + dataReader.ReadSingle()); // 0, 1, 4, huge
                    Output.AppendLine("4.3.2 int: " + dataReader.ReadUInt32()); // stack count
                    Output.AppendLine("buyprice: " + dataReader.ReadInt32());
                    Output.AppendLine("sellprice: " + dataReader.ReadInt32());
                    Output.AppendLine("inventorytype: " + dataReader.ReadInt32());
                    Output.AppendLine("allowableclass: " + dataReader.ReadInt32());
                    Output.AppendLine("allowablerace: " + dataReader.ReadInt32());
                    Output.AppendLine("itemlevel: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredlevel: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredskill: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredskillrank: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredspell: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredhonorrank: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredcityrank: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredreputationfaction: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredreputationrank: " + dataReader.ReadInt32());
                    Output.AppendLine("maxcount: " + dataReader.ReadInt32());
                    Output.AppendLine("stackable: " + dataReader.ReadInt32());
                    Output.AppendLine("containerslots: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type1: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type2: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type3: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type4: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type5: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type6: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type7: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type8: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type9: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type10: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value1: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value2: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value3: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value4: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value5: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value6: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value7: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value8: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value9: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value10: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_1: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_2: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_3: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_4: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_5: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_6: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_7: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_8: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_9: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_10: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_1: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_2: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_3: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_4: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_5: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_6: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_7: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_8: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_9: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_10: " + dataReader.ReadInt32());
                    Output.AppendLine("scalingstatdistribution: " + dataReader.ReadInt32());
                    Output.AppendLine("damagetype: " + dataReader.ReadInt32());
                    Output.AppendLine("delay: " + dataReader.ReadInt32());
                    Output.AppendLine("rangedmodrange: " + dataReader.ReadSingle());
//.........这里部分代码省略.........
开发者ID:CarlosX,项目名称:Kamilla.Wow,代码行数:101,代码来源:ItemQuerySingleResponseParser.cs

示例8: ReadFromStreamHandler

        private void ReadFromStreamHandler(StreamHandler Reader, WowOpcodes opcode)
        {
            GameMasterMessage = (opcode == WowOpcodes.SMSG_GM_MESSAGECHAT);

            m_type = (ChatMessageType)Reader.ReadByte();
            if (m_type == ChatMessageType.Addon2)
                m_type = ChatMessageType.Addon;

            m_language = (Language)Reader.ReadUInt32();
            m_senderGUID = Reader.ReadGuid();
            m_unknownUInt32 = Reader.ReadUInt32();

            switch (m_type)
            {
                case ChatMessageType.MonsterSay:
                case ChatMessageType.MonsterParty:
                case ChatMessageType.MonsterYell:
                case ChatMessageType.MonsterWhisper:
                case ChatMessageType.MonsterEmote:
                case ChatMessageType.BattleNet:
                case ChatMessageType.RaidBossEmote:
                case ChatMessageType.RaidBossWhisper:
                    Reader.Skip(4);
                    m_senderName = Reader.ReadCString();
                    m_targetGUID = Reader.ReadGuid();
                    if (!m_targetGUID.IsEmpty
                        && !m_targetGUID.IsPlayer
                        && !m_targetGUID.IsPet)
                    {
                        Reader.Skip(4);
                        m_targetName = Reader.ReadCString();
                    }
                    if (m_language == Language.Addon)
                        m_addonPrefix = Reader.ReadCString();
                    Reader.Skip(4);
                    m_text = Reader.ReadCString();
                    m_flags = (ChatMessageFlags)Reader.ReadByte();
                    if (m_type == ChatMessageType.RaidBossEmote || m_type == ChatMessageType.RaidBossWhisper)
                    {
                        m_displayTime = Reader.ReadSingle();
                        m_suspendEvent = Reader.ReadBoolean();
                    }
                    break;
                case ChatMessageType.BGSystemNeutral:
                case ChatMessageType.BGSystemAlliance:
                case ChatMessageType.BGSystemHorde:
                    m_targetGUID = Reader.ReadGuid();
                    if (!m_targetGUID.IsEmpty
                        && !m_targetGUID.IsPlayer)
                    {
                        Reader.Skip(4);
                        m_targetName = Reader.ReadCString();
                    }
                    if (m_language == Language.Addon)
                        m_addonPrefix = Reader.ReadCString();
                    Reader.Skip(4);
                    m_text = Reader.ReadCString();
                    m_flags = (ChatMessageFlags)Reader.ReadByte();
                    break;
                case ChatMessageType.Achievement:
                case ChatMessageType.GuildAchievement:
                    m_targetGUID = Reader.ReadGuid();
                    if (m_language == Language.Addon)
                        m_addonPrefix = Reader.ReadCString();
                    Reader.Skip(4);
                    m_text = Reader.ReadCString();
                    m_flags = (ChatMessageFlags)Reader.ReadByte();
                    m_achievementId = Reader.ReadUInt32();
                    break;
                case ChatMessageType.WhisperForeign:
                    Reader.Skip(4);
                    m_senderName = Reader.ReadCString();
                    m_targetGUID = Reader.ReadGuid();
                    if (m_language == Language.Addon)
                        m_addonPrefix = Reader.ReadCString();
                    Reader.Skip(4);
                    m_text = Reader.ReadCString();
                    m_flags = (ChatMessageFlags)Reader.ReadByte();
                    break;
                default:
                    if (GameMasterMessage)
                    {
                        Reader.Skip(4);
                        m_senderName = Reader.ReadCString();
                    }
                    if (m_type == ChatMessageType.Channel)
                        m_channel = Reader.ReadCString();
                    m_targetGUID = Reader.ReadGuid();
                    if (m_language == Language.Addon)
                        m_addonPrefix = Reader.ReadCString();
                    Reader.Skip(4);
                    m_text = Reader.ReadCString();
                    m_flags = (ChatMessageFlags)Reader.ReadByte();
                    break;
            }
        }
开发者ID:CarlosX,项目名称:Kamilla.Wow,代码行数:96,代码来源:ServerChatMessage.cs

示例9: MovementInfo


//.........这里部分代码省略.........
            ushort field_1AE = 0;
            ushort field_1B0 = 0;
            if (field_1AC)
            {
                field_1B2 = (ushort)(!Reader.UnalignedReadBit() ? 1 : 0);
                field_1AE = (ushort)(!Reader.UnalignedReadBit() ? 1 : 0);
                field_1B0 = (ushort)(!Reader.UnalignedReadBit() ? 1 : 0);
            }

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

            this.UnkUInt32 = new uint[arrCounter];
            for (uint i = 0; i < arrCounter; ++i)
            {
                this.UnkUInt32[i] = Reader.ReadUInt32();
            }

            if (this.HavePosition)
            {
                Reader
                    .ReadSingle(out this.Position.Z)
                    .ReadSingle(out this.Orientation)
                    .ReadSingle(out this.Position.X)
                    .ReadSingle(out this.Position.Y);
            }

            if (this.HaveVehicleData)
            {
                Reader
                    .ReadUInt32(out this.VehicleId)
                    .ReadSingle(out this.VehicleAimAdjustement);
            }

            if (this.HaveGameObjectPosition)
            {
                fixed (byte* bytes = this.TransportGuid.Bytes)
                {
                    Reader
                        .ReadXorByte(ref bytes[1])
                        .ReadXorByte(ref bytes[4])
                        .ReadSingle(out this.TransportPosition.Z);

                    if (this.HaveTransportTime3)
                        this.TransportTime3 = Reader.ReadUInt32();

                    this.TransportTime = Reader.ReadUInt32();

                    Reader
                        .ReadXorByte(ref bytes[5])
                        .ReadXorByte(ref bytes[6])
                        .ReadSingle(out this.TransportPosition.X)
                        .ReadXorByte(ref bytes[2]);
开发者ID:CarlosX,项目名称:Kamilla.Wow,代码行数:66,代码来源:MovementInfo.cs


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