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


C# PacketReader.ReadBool方法代码示例

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


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

示例1: OnPlayerAbilities

        public void OnPlayerAbilities(ref PacketReader _pReader, PacketType pt, ref ClientManager _client)
        {
            _client._player.Invulnerable = _pReader.ReadBool();
            _client._player.onGround = !_pReader.ReadBool();
            _client._player.CanFly = _pReader.ReadBool();
            _client._player.BlockInstantDestroy = _pReader.ReadBool();

            GridServer.player_list[_client.id].WaitToRead = false;
            int i = 0;
            for (; i < base.ModuleAddons.Count; i++)
            {
                base.ModuleAddons.ElementAt(i).Value(pt, ModuleAddons.ElementAt(i).Key, ref _pReader, new PacketHandler(), ref _client);
            }
        }
开发者ID:ultimakaz,项目名称:lib-open-craft,代码行数:14,代码来源:PlayerAbilities.cs

示例2: OnPlayer

 public void OnPlayer(ref PacketReader _pReader, PacketType pt, ref ClientManager _client)
 {
     _client._player.onGround = _pReader.ReadBool();// On Ground
     GridServer.player_list[_client.id].WaitToRead = false;
     int i = 0;
     for (; i < base.ModuleAddons.Count; i++)
     {
         base.ModuleAddons.ElementAt(i).Value(pt, ModuleAddons.ElementAt(i).Key, ref _pReader, new PacketHandler(), ref _client);
     }
 }
开发者ID:ultimakaz,项目名称:lib-open-craft,代码行数:10,代码来源:PlayerProtocol.cs

示例3: OnPlayerPosition

        public void OnPlayerPosition(ref PacketReader _pReader, PacketType pt, ref ClientManager _client)
        {
            #region Old Position Calculations
            Vector3D old_pos = _client._player.position;
            //old_pos /= 32;
            //old_pos = old_pos.Abs(old_pos);
            //old_pos = old_pos.Round(old_pos);

            #endregion
            #region Recieve packets
            _client._player.position.X = _pReader.ReadDouble();
            _client._player.position.Y = _pReader.ReadDouble();
            _client._player.stance = _pReader.ReadDouble();
            _client._player.position.Z = _pReader.ReadDouble();
            _client._player.onGround = _pReader.ReadBool();
            GridServer.player_list[_client.id].WaitToRead = false;
            #endregion
            #region New Position Calculations
            if (_client._player.position.Round(_client._player.position) == old_pos.Round(old_pos))
            {
                return;
            }
            Vector3D new_pos = _client._player.position;
            //new_pos /= 32;
            //
            #endregion
            #region Deal with addons

            for (int i = 0; i < base.ModuleAddons.Count; i++)
            {
                base.ModuleAddons.ElementAt(i).Value(pt, ModuleAddons.ElementAt(i).Key, ref _pReader, new PacketHandler(), ref _client);
            }
            #endregion
            #region deal with entity relative move
            //ClientManager[] player = GridServer.player_list;
            if (_client._player.EntityUpdateCount < (int)Config.Configuration["EntityUpdate"])
            {

            }
            else
                _client._player.EntityUpdateCount = 0;
            ClientManager[] player = GridServer.player_list;
            for (int i = 0; i < player.Length; i++)
            {
                if (player[i] == null)
                {

                }
                else
                {
                    if (player[i]._client == null || player[i]._client.Connected == false && player[i].PreChunkRan != 1 || player[i].id == _client.id)
                    {

                    }
                    else if (new_pos.Abs(new_pos - old_pos) <= 4)
                    {
                        if (_client._player.fullPositionUpdateCounter >= (int)Config.Configuration["PlayerUpdateInterval"])
                        {
                            EntityTeleportPacket teleport = new EntityTeleportPacket(PacketType.EntityTeleport);
                            _client._player.position *= 32;
                            teleport.X = (int)(_client._player.position.X);
                            teleport.Y = (int)(_client._player.position.Y);
                            teleport.Z = (int)(_client._player.position.Z);
                            teleport.EntityID = _client.id;
                            teleport.Yaw = (byte)_client._player.Yaw;
                            teleport.Pitch = (byte)_client._player.Pitch;
                            teleport.BuildPacket();
                            _client._player.position /= 32;
                            GridServer.player_list[player[i].id].SendPacket(teleport, player[i].id, ref player[i], false, false);
                            _client._player.fullPositionUpdateCounter = 0;
                        }
                        else
                        {
                            EntityRelativeMovePacket move = new EntityRelativeMovePacket(PacketType.EntityRelativeMove);
                            Vector3D t = new_pos * 32;
                            //new_pos = new_pos.Round(new_pos);
                            move.X = (byte)t.Abs(t).X;
                            move.Y = (byte)t.Abs(t).Y;
                            move.Z = (byte)t.Abs(t).Z;
                            move.EntityID = _client.id;
                            move.BuildPacket();
                            GridServer.player_list[player[i].id].SendPacket(move, player[i].id, ref player[i], false, false);
                            _client._player.fullPositionUpdateCounter++;
                        }
                    }
                    else
                    {
                        EntityTeleportPacket teleport = new EntityTeleportPacket(PacketType.EntityTeleport);
                        Vector3D t = new_pos * 32;
                        teleport.X = (int)t.Abs(t).X;
                        teleport.Y = (int)t.Abs(t).Y;
                        teleport.Z = (int)t.Abs(t).Z;
                        teleport.EntityID = _client.id;
                        teleport.Yaw = (byte)_client._player.Yaw;
                        teleport.Pitch = (byte)_client._player.Pitch;
                        teleport.BuildPacket();
                        GridServer.player_list[player[i].id].SendPacket(teleport, player[i].id, ref player[i], false, false);
                        _client._player.fullPositionUpdateCounter = 0;
                    }
                }
//.........这里部分代码省略.........
开发者ID:ultimakaz,项目名称:lib-open-craft,代码行数:101,代码来源:PlayerProtocol.cs

示例4: Read

        public override void Read(PacketReader stream)
        {
            //X,Y,Stance are in different order for Client->Server vs. Server->Client
            if (Packet.Role == StreamRole.Server)
            {
                X = stream.ReadDouble();
                Stance = stream.ReadDouble();
                Y = stream.ReadDouble();

            }
            else
            {
                X = stream.ReadDouble();
                Y = stream.ReadDouble();
                Stance = stream.ReadDouble();
            }
            Z = stream.ReadDouble();
            Yaw = stream.ReadFloat();
            Pitch = stream.ReadFloat();
            OnGround = stream.ReadBool();
        }
开发者ID:TheaP,项目名称:c-raft,代码行数:21,代码来源:Packet.cs


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