2017-11-25 11:26:55 +01:00
|
|
|
|
|
2017-11-25 11:29:48 +01:00
|
|
|
|
namespace Network.PacketHandling {
|
2017-11-25 11:26:55 +01:00
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|