41 lines
958 B
C#
41 lines
958 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 Packet ShallowCopy() {
|
|
return (Packet)this.MemberwiseClone();
|
|
}
|
|
}
|
|
|
|
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,
|
|
}
|
|
|
|
} |