GodotTicTacToe/scripts/net/packethandling/Serializable.cs
2017-11-25 12:29:48 +02:00

25 lines
675 B
C#

namespace Network.PacketHandling {
public abstract class Serializable {
public bool Reliable;
public int ID;
public void Serialize(PacketBuffer packetBuffer) {
packetBuffer.Write(Reliable);
packetBuffer.Write(ID);
WriteContents(packetBuffer);
}
public void Deserialize(PacketBuffer packetBuffer) {
Reliable = packetBuffer.ReadBool();
ID = packetBuffer.ReadInt();
ReadContents(packetBuffer);
}
public abstract void WriteContents(PacketBuffer packetBuffer);
public abstract void ReadContents(PacketBuffer packetBuffer);
}
}