feat[go]: 支持golang协议生成的xsd配置

This commit is contained in:
godotg committed 2022-09-15 17:35:37 +08:00
1 parent 400066262f
commit bf41b85d7b
4 files changed
+14

No files matched your search

@@ -42,6 +42,7 @@ public class NetConfig {
private boolean luaProtocol; private boolean luaProtocol;
private boolean gdscriptProtocol; private boolean gdscriptProtocol;
private boolean cppProtocol; private boolean cppProtocol;
private boolean goProtocol;
private boolean protobufProtocol; private boolean protobufProtocol;
/** /**
@@ -197,6 +198,14 @@ public class NetConfig {
this.typescriptProtocol = typescriptProtocol; this.typescriptProtocol = typescriptProtocol;
} }
public boolean isGoProtocol() {
return goProtocol;
}
public void setGoProtocol(boolean goProtocol) {
this.goProtocol = goProtocol;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) { if (this == o) {
@@ -105,6 +105,9 @@ public class PacketService implements IPacketService {
if (netConfig.isCppProtocol()) { if (netConfig.isCppProtocol()) {
generateOperation.getGenerateLanguages().add(CodeLanguage.Cpp); generateOperation.getGenerateLanguages().add(CodeLanguage.Cpp);
} }
if (netConfig.isGoProtocol()) {
generateOperation.getGenerateLanguages().add(CodeLanguage.Go);
}
if (netConfig.isProtobufProtocol()) { if (netConfig.isProtobufProtocol()) {
generateOperation.getGenerateLanguages().add(CodeLanguage.Protobuf); generateOperation.getGenerateLanguages().add(CodeLanguage.Protobuf);
} }
@@ -109,6 +109,7 @@ public class NetDefinitionParser implements BeanDefinitionParser {
resolvePlaceholder("lua-protocol", "luaProtocol", builder, element, parserContext); resolvePlaceholder("lua-protocol", "luaProtocol", builder, element, parserContext);
resolvePlaceholder("gdscript-protocol", "gdscriptProtocol", builder, element, parserContext); resolvePlaceholder("gdscript-protocol", "gdscriptProtocol", builder, element, parserContext);
resolvePlaceholder("cpp-protocol", "cppProtocol", builder, element, parserContext); resolvePlaceholder("cpp-protocol", "cppProtocol", builder, element, parserContext);
resolvePlaceholder("go-protocol", "goProtocol", builder, element, parserContext);
resolvePlaceholder("protobuf-protocol", "protobufProtocol", builder, element, parserContext); resolvePlaceholder("protobuf-protocol", "protobufProtocol", builder, element, parserContext);
// 文件是否折叠 // 文件是否折叠
+1
View File
@@ -72,6 +72,7 @@
<xsd:attribute name="lua-protocol" type="xsd:string" default="false"/> <xsd:attribute name="lua-protocol" type="xsd:string" default="false"/>
<xsd:attribute name="gdscript-protocol" type="xsd:string" default="false"/> <xsd:attribute name="gdscript-protocol" type="xsd:string" default="false"/>
<xsd:attribute name="cpp-protocol" type="xsd:string" default="false"/> <xsd:attribute name="cpp-protocol" type="xsd:string" default="false"/>
<xsd:attribute name="go-protocol" type="xsd:string" default="false"/>
<xsd:attribute name="protobuf-protocol" type="xsd:string" default="false"/> <xsd:attribute name="protobuf-protocol" type="xsd:string" default="false"/>
<xsd:attribute name="fold-protocol" type="xsd:string" default="false"/> <xsd:attribute name="fold-protocol" type="xsd:string" default="false"/>
<xsd:attribute name="protocol-path" type="xsd:string"/> <xsd:attribute name="protocol-path" type="xsd:string"/>