37 lines
858 B
C#
37 lines
858 B
C#
namespace NeonTea.Quakeball.TeaNet.Packets {
|
|
public abstract class Packet {
|
|
public bool Reliable = true;
|
|
public int Id;
|
|
|
|
public abstract void Write(ByteBuffer buffer);
|
|
public abstract void Read(ByteBuffer buffer);
|
|
|
|
public void ReadMeta(ByteBuffer buffer) {
|
|
Id = buffer.ReadInt();
|
|
Reliable = buffer.ReadBool();
|
|
}
|
|
|
|
public void WriteMeta(ByteBuffer buffer) {
|
|
buffer.Write(Id);
|
|
buffer.Write(Reliable);
|
|
}
|
|
}
|
|
|
|
public interface Serializable {
|
|
void Write(ByteBuffer buffer);
|
|
void Read(ByteBuffer buffer);
|
|
}
|
|
|
|
public enum PacketStage {
|
|
Establishing = 0,
|
|
Rejected = 1,
|
|
Closed = 2,
|
|
Ready = 3,
|
|
}
|
|
|
|
public enum ClosingReason {
|
|
Unknown = 0,
|
|
IncorrectVersion = 1,
|
|
}
|
|
|
|
} |