-
Notifications
You must be signed in to change notification settings - Fork 410
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main'
- Loading branch information
Showing
50 changed files
with
11,584 additions
and
11,408 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 69 additions & 37 deletions
106
protocol/src/main/java/com/zfoo/protocol/serializer/gdscript/CodeGenerateGdScript.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
protocol/src/main/resources/gdscript/ProtocolClassDefaultTemplate.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
${protocol_note} | ||
${protocol_field_definition} | ||
|
||
func protocolId() -> int: | ||
return ${protocol_id} | ||
|
||
func get_class_name() -> String: | ||
return "${protocol_name}" | ||
|
||
func _to_string() -> String: | ||
const jsonTemplate = "${protocol_json}" | ||
var params = [${protocol_to_string}] | ||
return jsonTemplate.format(params, "{}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 10 additions & 4 deletions
14
protocol/src/main/resources/gdscript/ProtocolManagerTemplate.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
protocol/src/main/resources/gdscript/ProtocolRegistrationTemplate.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class ${protocol_name}Registration: | ||
func write(buffer: ByteBuffer, packet: Object): | ||
if (packet == null): | ||
buffer.writeInt(0) | ||
return | ||
${protocol_write_serialization} | ||
pass | ||
|
||
func read(buffer: ByteBuffer): | ||
var length = buffer.readInt() | ||
if (length == 0): | ||
return null | ||
var beforeReadIndex = buffer.getReadOffset() | ||
var packet = buffer.newInstance(${protocol_id}) | ||
${protocol_read_deserialization} | ||
if (length > 0): | ||
buffer.setReadOffset(beforeReadIndex + length) | ||
return packet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,5 @@ | ||
const PROTOCOL_ID = ${protocol_id} | ||
const PROTOCOL_CLASS_NAME = "${protocol_name}" | ||
${protocol_imports} | ||
${protocol_note} | ||
${protocol_field_definition} | ||
|
||
func _to_string() -> String: | ||
const jsonTemplate = "${protocol_json}" | ||
var params = [${protocol_to_string}] | ||
return jsonTemplate.format(params, "{}") | ||
${protocol_class} | ||
|
||
static func write(buffer, packet): | ||
if (packet == null): | ||
buffer.writeInt(0) | ||
return | ||
${protocol_write_serialization} | ||
pass | ||
|
||
static func read(buffer): | ||
var length = buffer.readInt() | ||
if (length == 0): | ||
return null | ||
var beforeReadIndex = buffer.getReadOffset() | ||
var packet = buffer.newInstance(PROTOCOL_ID) | ||
${protocol_read_deserialization} | ||
if (length > 0): | ||
buffer.setReadOffset(beforeReadIndex + length) | ||
return packet | ||
${protocol_registration} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
${protocol_class} | ||
${protocol_imports} | ||
|
||
${protocol_class} | ||
|
||
${protocol_registration} |
Oops, something went wrong.