quakeball/Assets/Scripts/Networking/Packets/PlayerInitPckt.cs

43 lines
1.2 KiB
C#
Raw Permalink Normal View History

using NeonTea.Quakeball.Game;
using NeonTea.Quakeball.TeaNet.Packets;
namespace NeonTea.Quakeball.Networking.Packets {
public class PlayerInitPckt : Packet {
public ulong PlayerId;
public Team Team;
public SpawnPckt SpawnPckt;
public NicknamePckt NicknamePckt;
public PlayerInitPckt() { }
public PlayerInitPckt(ulong id, Team team, NicknamePckt nickname, SpawnPckt spawn) {
PlayerId = id;
Team = team;
NicknamePckt = nickname;
SpawnPckt = spawn;
}
public override void Read(ByteBuffer buffer) {
PlayerId = buffer.ReadULong();
Team = (Team)buffer.Read();
SpawnPckt = new SpawnPckt();
SpawnPckt.Read(buffer);
NicknamePckt = new NicknamePckt();
NicknamePckt.Read(buffer);
}
public override void Write(ByteBuffer buffer) {
buffer.Write(PlayerId);
buffer.Write((byte)Team);
SpawnPckt.Write(buffer);
NicknamePckt.Write(buffer);
}
}
public class ReadyPckt : Packet {
public override void Read(ByteBuffer buffer) { }
public override void Write(ByteBuffer buffer) { }
}
}