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


C# PacketWriter.WriteInt16方法代码示例

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


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

示例1: HandleUpdateTalentData

        public static void HandleUpdateTalentData(ref WorldClass session)
        {
            var pChar = session.Character;

            const byte glyphCount = 6;

            PacketWriter updateTalentData = new PacketWriter(ServerMessage.UpdateTalentData);
            BitPack BitPack = new BitPack(updateTalentData);

            BitPack.Write(pChar.SpecGroupCount, 19);

            for (int i = 0; i < pChar.SpecGroupCount; i++)
            {
                var talents = SpecializationMgr.GetTalentsBySpecGroup(pChar, (byte)i);

                BitPack.Write(talents.Count, 23);
            }

            BitPack.Flush();

            for (int i = 0; i < pChar.SpecGroupCount; i++)
            {
                var talents = SpecializationMgr.GetTalentsBySpecGroup(pChar, (byte)i);
                var specId = (i == 0) ? pChar.PrimarySpec : pChar.SecondarySpec;

                for (int j = 0; j < glyphCount; j++)
                    updateTalentData.WriteInt16(0);                 // Glyph Id

                for (int j = 0; j < talents.Count; j++)
                    updateTalentData.WriteUInt16(talents[j].Id);    // Talent Id

                updateTalentData.WriteUInt32(specId);               // Spec Id
            }

            updateTalentData.WriteUInt8(pChar.ActiveSpecGroup);     // Active Spec (0 or 1)

            session.Send(ref updateTalentData);
        }
开发者ID:australopitheque,项目名称:Arctium,代码行数:38,代码来源:SpecializationHandler.cs

示例2: HandleTalentUpdate

        public static void HandleTalentUpdate(ref WorldClass session)
        {
            var pChar = session.Character;

            const byte glyphCount = 6;

            PacketWriter writer = new PacketWriter();

            writer.WriteUInt8((byte)pChar.SpecGroupCount);      // Spec Count (Default 1)
            writer.WriteUInt8((byte)pChar.ActiveSpecGroup);     // Active Spec (0 or 1)

            for (int i = 0; i < pChar.SpecGroupCount; i++)
            {
                var specId = (i == 0) ? pChar.PrimarySpec : pChar.SecondarySpec;
                writer.WriteUInt32(specId);                     // Spec Id

                var talents = SpecializationMgr.GetTalentsBySpecGroup(pChar, (byte)i);

                writer.WriteUInt8((byte)talents.Count);         // Spent Talent Row Count
                for (int j = 0; j < talents.Count; j++)
                    writer.WriteUInt16(talents[j].Id);          // Talent Id

                writer.WriteUInt8(glyphCount);                  // Glyph Count - NYI
                for (int j = 0; j < glyphCount; j++)
                    writer.WriteInt16(0);                       // Glyph Id - NYI
            }

            session.Send(ref writer);
        }
开发者ID:Krogonos,项目名称:Arctium,代码行数:29,代码来源:SpecializationHandler.cs


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