mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-10-12 10:14:30 +00:00
16 lines
435 B
GDScript
16 lines
435 B
GDScript
static var protocols: Dictionary[int, Object] = {
|
|
${protocol_manager_registrations}
|
|
}
|
|
|
|
static func write(buffer: ByteBuffer, packet: Object) -> void:
|
|
var protocolId: int = packet.protocolId()
|
|
buffer.writeShort(protocolId)
|
|
packet.write(buffer, packet)
|
|
pass
|
|
|
|
static func read(buffer: ByteBuffer) -> Object:
|
|
var protocolId = buffer.readShort()
|
|
var protocol = protocols[protocolId]
|
|
var packet = protocol.read(buffer)
|
|
return packet
|