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


C# PacketReader.ReadShort方法代码示例

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


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

示例1: OnCreativeInventoryAction

 public void OnCreativeInventoryAction(ref PacketReader _pReader, PacketType pt, ref ClientManager _client)
 {
     short slot = _pReader.ReadShort();
     short item_id = _pReader.ReadShort();
     short Quanity = _pReader.ReadShort();
     short Damage = _pReader.ReadShort();
 }
开发者ID:ultimakaz,项目名称:lib-open-craft,代码行数:7,代码来源:CreativeInventoryAction.cs

示例2: Read

        public override void Read(PacketReader stream)
        {
            int posX = stream.ReadInt();
            short posY = stream.ReadShort();
            int posZ = stream.ReadInt();
            byte sizeX = (byte)(stream.ReadByte() + 1);
            byte sizeY = (byte)(stream.ReadByte() + 1);
            byte sizeZ = (byte)(stream.ReadByte() + 1);

            int o = sizeX * sizeY * sizeZ;
            Chunk = new Chunk(null, UniversalCoords.FromWorld(posX, posY, posZ));

            int len = stream.ReadInt();
            stream.ReadBytes(len);
        }
开发者ID:TheaP,项目名称:c-raft,代码行数:15,代码来源:MapChunkPacket.cs

示例3: Read

        public override void Read(PacketReader stream)
        {
            int posX = stream.ReadInt();
            short posY = stream.ReadShort();
            int posZ = stream.ReadInt();
            byte sizeX = (byte)(stream.ReadByte() + 1);
            byte sizeY = (byte)(stream.ReadByte() + 1);
            byte sizeZ = (byte)(stream.ReadByte() + 1);

            int o = sizeX * sizeY * sizeZ;
            Chunk = new Chunk(null, posX << 4, posZ << 4);

            int len = stream.ReadInt();
            byte[] data = new byte[o * 5 / 2];
            byte[] comp = stream.ReadBytes(len);
        }
开发者ID:AVATAR-Phoenix,项目名称:c-raft,代码行数:16,代码来源:MapChunkPacket.cs

示例4: Parse

        public IEnumerable<RuleInfo> Parse(byte[] data)
        {
            var rules = new List<RuleInfo>();
            var reader = new PacketReader(data);

            var header = reader.ReadByte();
            var numberOfRules = reader.ReadShort();

            for (short i = 1; i <= numberOfRules; i++)
            {
                if (!reader.IsEnd)
                {
                    var rule = new RuleInfo();
                    rule.Index = i;
                    rule.Name = reader.ReadUTFString();
                    rule.Value = reader.ReadUTFString();
                    rules.Add(rule);
                }
            }

            return rules;
        }
开发者ID:AlexSbyshko,项目名称:Barsik,代码行数:22,代码来源:RulesParser.cs

示例5: OnPlayerBlockPlacement

        public void OnPlayerBlockPlacement(ref PacketReader _pReader, PacketType pt, ref ClientManager _client)
        {
            PlayerBlockPlacementPacket p = new PlayerBlockPlacementPacket(PacketType.PlayerBlockPlacement);
            p.X = _pReader.ReadInt();
            p.Y = _pReader.ReadByte();
            p.Z = _pReader.ReadInt();
            p.Direction = _pReader.ReadByte();
            p.BlockID = _pReader.ReadSlot();
            //if (p.BlockID.s_short <= -1)
            //{
                p.Amount = _pReader.ReadByte();
                p.Damage = _pReader.ReadShort();
            //}
            GridServer.player_list[_client.id].WaitToRead = false;
            p.BuildPacket();

            PacketReader pr = new PacketReader(new System.IO.MemoryStream(p.GetBytes()));
            int i = 0;
            for (; i < base.ModuleAddons.Count; i++)
            {
                base.ModuleAddons.ElementAt(i).Value(pt, ModuleAddons.ElementAt(i).Key, ref pr, (PacketHandler)p, ref _client);
            }
        }
开发者ID:ultimakaz,项目名称:lib-open-craft,代码行数:23,代码来源:PlayerBlockPlacement.cs

示例6: Read

 public override void Read(PacketReader stream)
 {
     World = stream.ReadInt();
     Difficulty = stream.ReadSByte();
     GameMode = stream.ReadSByte();
     WorldHeight = stream.ReadShort();
     LevelType = stream.ReadString16(9);
 }
开发者ID:TheaP,项目名称:c-raft,代码行数:8,代码来源:Packet.cs

示例7: OnPacket

        public void OnPacket(byte[] packet)
        {
            PacketReader reader = new PacketReader(packet);

            var opcode = (RecvOps)reader.ReadShort();

            IPacketHandler handler = PacketHandler.Get(opcode);

            if (handler != null)
                handler.Handle(reader);
        }
开发者ID:remy22,项目名称:MapleGame,代码行数:11,代码来源:MainGame.cs

示例8: OnHoldingChanged

 public void OnHoldingChanged(ref PacketReader _pReader, PacketType pt, ref ClientManager _client)
 {
     _client._player.Current_Slot = _pReader.ReadShort();
 }
开发者ID:ultimakaz,项目名称:lib-open-craft,代码行数:4,代码来源:HoldingChanged.cs


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