mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-08-06 16:25:28 +00:00
fix[protocol]: avoid the constant has the same name as a global class defined in gdscript
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
class ${protocol_name}Registration:
|
||||
func write(buffer: ByteBuffer, packet: ${protocol_name}):
|
||||
func write(buffer: ByteBuffer, packet: _${protocol_name}):
|
||||
if (packet == null):
|
||||
buffer.writeInt(0)
|
||||
return
|
||||
${protocol_write_serialization}
|
||||
pass
|
||||
|
||||
func read(buffer: ByteBuffer) -> ${protocol_name}:
|
||||
func read(buffer: ByteBuffer) -> _${protocol_name}:
|
||||
var length = buffer.readInt()
|
||||
if (length == 0):
|
||||
return null
|
||||
var beforeReadIndex = buffer.getReadOffset()
|
||||
var packet: ${protocol_name} = buffer.newInstance(${protocol_id})
|
||||
var packet: _${protocol_name} = buffer.newInstance(${protocol_id})
|
||||
${protocol_read_deserialization}
|
||||
if (length > 0):
|
||||
buffer.setReadOffset(beforeReadIndex + length)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class_name ${protocol_name}
|
||||
class_name _${protocol_name}
|
||||
|
||||
${protocol_imports}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user