本文整理汇总了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);
}
}
示例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);
}
}
示例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;
}
}
//.........这里部分代码省略.........
示例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();
}