diff --git a/src/Luban.Server/Templates/config/cpp_bin/bean.tpl b/src/Luban.Server/Templates/config/cpp_bin/bean.tpl index 51c4255..b207208 100644 --- a/src/Luban.Server/Templates/config/cpp_bin/bean.tpl +++ b/src/Luban.Server/Templates/config/cpp_bin/bean.tpl @@ -55,9 +55,9 @@ class {{name}} : public {{if parent_def_type}} {{parent_def_type.cpp_full_name}} {{~end~}} {{~if !x.is_abstract_type~}} - static constexpr int ID = {{x.id}}; + static constexpr int __ID__ = {{x.id}}; - int getTypeId() const { return ID; } + int getTypeId() const { return __ID__; } {{~end~}} virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); diff --git a/src/Luban.Server/Templates/config/cpp_bin/stub.tpl b/src/Luban.Server/Templates/config/cpp_bin/stub.tpl index 1b2e6fd..859140e 100644 --- a/src/Luban.Server/Templates/config/cpp_bin/stub.tpl +++ b/src/Luban.Server/Templates/config/cpp_bin/stub.tpl @@ -37,7 +37,7 @@ namespace {{x.top_module}} switch (id) { {{~for child in type.hierarchy_not_abstract_children~}} - case {{child.cpp_full_name}}::ID: { _out.reset(new {{child.cpp_full_name}}()); if (_out->deserialize(_buf)) { return true; } else { _out.reset(); return false;} } + case {{child.cpp_full_name}}::__ID__: { _out.reset(new {{child.cpp_full_name}}()); if (_out->deserialize(_buf)) { return true; } else { _out.reset(); return false;} } {{~end~}} default: { _out = nullptr; return false;} } diff --git a/src/Luban.Server/Templates/config/cs_bin/bean.tpl b/src/Luban.Server/Templates/config/cs_bin/bean.tpl index d7a08d8..4921342 100644 --- a/src/Luban.Server/Templates/config/cs_bin/bean.tpl +++ b/src/Luban.Server/Templates/config/cs_bin/bean.tpl @@ -37,7 +37,7 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren switch (_buf.ReadInt()) { {{~for child in x.hierarchy_not_abstract_children~}} - case {{child.full_name}}.ID: return new {{child.full_name}}(_buf); + case {{child.full_name}}.__ID__: return new {{child.full_name}}(_buf); {{~end~}} default: throw new SerializationException(); } @@ -65,8 +65,8 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren {{~end~}} {{~if !x.is_abstract_type~}} - public const int ID = {{x.id}}; - public override int GetTypeId() => ID; + public const int __ID__ = {{x.id}}; + public override int GetTypeId() => __ID__; {{~end~}} public {{x.cs_method_modifier}} void Resolve(Dictionary _tables) diff --git a/src/Luban.Server/Templates/config/cs_editor_json/bean.tpl b/src/Luban.Server/Templates/config/cs_editor_json/bean.tpl index 3b65283..23860a3 100644 --- a/src/Luban.Server/Templates/config/cs_editor_json/bean.tpl +++ b/src/Luban.Server/Templates/config/cs_editor_json/bean.tpl @@ -34,7 +34,7 @@ public {{cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{parent}} { case 0 : return null; {{~for child in hierarchy_not_abstract_children~}} - case {{child.full_name}}.ID: x = new {{child.full_name}}(false); break; + case {{child.full_name}}.__ID__: x = new {{child.full_name}}(false); break; {{~end~}} default: throw new SerializationException(); } @@ -50,10 +50,10 @@ public {{cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{parent}} public abstract int GetTypeId(); {{~end~}} {{~if parent_def_type && !is_abstract_type~}} - public const int ID = {{id}}; + public const int __ID__ = {{id}}; public override int GetTypeId() { - return ID; + return __ID__; } {{~end~}} diff --git a/src/Luban.Server/Templates/config/cs_editor_json/table.tpl b/src/Luban.Server/Templates/config/cs_editor_json/table.tpl index 852e9b1..4b2b006 100644 --- a/src/Luban.Server/Templates/config/cs_editor_json/table.tpl +++ b/src/Luban.Server/Templates/config/cs_editor_json/table.tpl @@ -19,11 +19,11 @@ public sealed class {{name}} : Bright.Net.Protocol {{~end~}} {{~end~}} } - public const int ID = {{id}}; + public const int __ID__ = {{id}}; public override int GetTypeId() { - return ID; + return __ID__; } public override void Serialize(ByteBuf _buf) diff --git a/src/Luban.Server/Templates/config/cs_editor_json/tables.tpl b/src/Luban.Server/Templates/config/cs_editor_json/tables.tpl index 1bde816..b9ff4c2 100644 --- a/src/Luban.Server/Templates/config/cs_editor_json/tables.tpl +++ b/src/Luban.Server/Templates/config/cs_editor_json/tables.tpl @@ -8,7 +8,7 @@ public static class {{name}} public static System.Collections.Generic.Dictionary Factories { get; } = new System.Collections.Generic.Dictionary { {{~for proto in protos ~}} - [{{proto.full_name}}.ID] = () => new {{proto.full_name}}(false), + [{{proto.full_name}}.__ID__] = () => new {{proto.full_name}}(false), {{~end~}} }; } diff --git a/src/Luban.Server/Templates/config/cs_json/bean.tpl b/src/Luban.Server/Templates/config/cs_json/bean.tpl index cea933f..3558186 100644 --- a/src/Luban.Server/Templates/config/cs_json/bean.tpl +++ b/src/Luban.Server/Templates/config/cs_json/bean.tpl @@ -74,8 +74,8 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{parent} {{~end~}} {{~if !x.is_abstract_type~}} - public const int ID = {{x.id}}; - public override int GetTypeId() => ID; + public const int __ID__ = {{x.id}}; + public override int GetTypeId() => __ID__; {{~end~}} public {{x.cs_method_modifier}} void Resolve(Dictionary _tables) diff --git a/src/Luban.Server/Templates/config/cs_unity_json/bean.tpl b/src/Luban.Server/Templates/config/cs_unity_json/bean.tpl index 7ef47ec..75cd5ab 100644 --- a/src/Luban.Server/Templates/config/cs_unity_json/bean.tpl +++ b/src/Luban.Server/Templates/config/cs_unity_json/bean.tpl @@ -75,8 +75,8 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{parent} {{~end~}} {{~if !x.is_abstract_type~}} - public const int ID = {{x.id}}; - public override int GetTypeId() => ID; + public const int __ID__ = {{x.id}}; + public override int GetTypeId() => __ID__; {{~end~}} public {{x.cs_method_modifier}} void Resolve(Dictionary _tables) diff --git a/src/Luban.Server/Templates/config/java_bin/bean.tpl b/src/Luban.Server/Templates/config/java_bin/bean.tpl index 9b8efe3..73a40a0 100644 --- a/src/Luban.Server/Templates/config/java_bin/bean.tpl +++ b/src/Luban.Server/Templates/config/java_bin/bean.tpl @@ -47,7 +47,7 @@ public {{x.java_class_modifier}} class {{name}}{{if parent_def_type}} extends {{ public static {{name}} deserialize{{name}}(ByteBuf _buf) { switch (_buf.readInt()) { {{~for child in x.hierarchy_not_abstract_children~}} - case {{child.full_name_with_top_module}}.ID: return new {{child.full_name_with_top_module}}(_buf); + case {{child.full_name_with_top_module}}.__ID__: return new {{child.full_name_with_top_module}}(_buf); {{~end~}} default: throw new SerializationException(); } @@ -70,10 +70,10 @@ public {{x.java_class_modifier}} class {{name}}{{if parent_def_type}} extends {{ {{~end~}} {{~if !x.is_abstract_type && x.parent_def_type~}} - public static final int ID = {{x.id}}; + public static final int __ID__ = {{x.id}}; @Override - public int getTypeId() { return ID; } + public int getTypeId() { return __ID__; } {{~else if x.is_abstract_type && !x.parent_def_type~}} public abstract int getTypeId(); {{~end~}} diff --git a/src/Luban.Server/Templates/config/java_json/bean.tpl b/src/Luban.Server/Templates/config/java_json/bean.tpl index bb8ad91..76d2e30 100644 --- a/src/Luban.Server/Templates/config/java_json/bean.tpl +++ b/src/Luban.Server/Templates/config/java_json/bean.tpl @@ -73,10 +73,10 @@ public {{x.java_class_modifier}} class {{name}}{{if parent_def_type}} extends {{ {{~end~}} {{~if !x.is_abstract_type && x.parent_def_type~}} - public static final int ID = {{x.id}}; + public static final int __ID__ = {{x.id}}; @Override - public int getTypeId() { return ID; } + public int getTypeId() { return __ID__; } {{~else if x.is_abstract_type && !x.parent_def_type~}} public abstract int getTypeId(); {{~end~}} diff --git a/src/Luban.Server/Templates/db/cs_async/bean.tpl b/src/Luban.Server/Templates/db/cs_async/bean.tpl index 6a9fee9..ff2dec7 100644 --- a/src/Luban.Server/Templates/db/cs_async/bean.tpl +++ b/src/Luban.Server/Templates/db/cs_async/bean.tpl @@ -144,7 +144,7 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren { case 0 : return null; {{~ for child in x.hierarchy_not_abstract_children~}} - case {{child.full_name}}.ID: x = new {{child.full_name}}(); break; + case {{child.full_name}}.__ID__: x = new {{child.full_name}}(); break; {{~end~}} default: throw new SerializationException(); } @@ -176,8 +176,8 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren } } - public const int ID = {{x.id}}; - public override int GetTypeId() => ID; + public const int __ID__ = {{x.id}}; + public override int GetTypeId() => __ID__; {{~end~}} protected override void InitChildrenRoot(BrightDB.Storage.TKey root) diff --git a/src/Luban.Server/Templates/db/cs_sync/bean.tpl b/src/Luban.Server/Templates/db/cs_sync/bean.tpl index ea95cd5..d0b4111 100644 --- a/src/Luban.Server/Templates/db/cs_sync/bean.tpl +++ b/src/Luban.Server/Templates/db/cs_sync/bean.tpl @@ -144,7 +144,7 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren { case 0 : return null; {{~ for child in x.hierarchy_not_abstract_children~}} - case {{child.full_name}}.ID: x = new {{child.full_name}}(); break; + case {{child.full_name}}.__ID__: x = new {{child.full_name}}(); break; {{~end~}} default: throw new SerializationException(); } @@ -176,8 +176,8 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren } } - public const int ID = {{x.id}}; - public override int GetTypeId() => ID; + public const int __ID__ = {{x.id}}; + public override int GetTypeId() => __ID__; {{~end~}} protected override void InitChildrenRoot(Bright.Storage.TKey root) diff --git a/src/Luban.Server/Templates/db/typescript/bean.tpl b/src/Luban.Server/Templates/db/typescript/bean.tpl index 25df1a1..9beccc4 100644 --- a/src/Luban.Server/Templates/db/typescript/bean.tpl +++ b/src/Luban.Server/Templates/db/typescript/bean.tpl @@ -105,7 +105,7 @@ export {{x.ts_class_modifier}} class {{name}} extends {{if parent_def_type}} {{x let x: {{name}} switch (_buf.ReadInt()) { {{~ for child in x.hierarchy_not_abstract_children~}} - case {{child.full_name}}.ID: x = new {{child.full_name}}(); break + case {{child.full_name}}.__ID__: x = new {{child.full_name}}(); break {{~end~}} default: throw new Error() } @@ -133,8 +133,8 @@ export {{x.ts_class_modifier}} class {{name}} extends {{if parent_def_type}} {{x } } - static readonly ID = {{x.id}} - getTypeId(): number { return {{name}}.ID } + static readonly __ID__ = {{x.id}} + getTypeId(): number { return {{name}}.__ID__ } {{~end~}} initChildrenRoot(root: TKey) { diff --git a/src/Luban.Server/Templates/proto/cs/bean.tpl b/src/Luban.Server/Templates/proto/cs/bean.tpl index aff9547..1e3006a 100644 --- a/src/Luban.Server/Templates/proto/cs/bean.tpl +++ b/src/Luban.Server/Templates/proto/cs/bean.tpl @@ -62,7 +62,7 @@ namespace {{x.namespace_with_top_module}} { case 0 : return null; {{~ for child in x.hierarchy_not_abstract_children~}} - case {{child.full_name}}.ID: x = new {{child.full_name}}(); break; + case {{child.full_name}}.__ID__: x = new {{child.full_name}}(); break; {{~end~}} default: throw new SerializationException(); } @@ -85,8 +85,8 @@ namespace {{x.namespace_with_top_module}} {{~end~}} {{~if !is_abstract_type~}} - public const int ID = {{x.id}}; - public override int GetTypeId() => ID; + public const int __ID__ = {{x.id}}; + public override int GetTypeId() => __ID__; public override void Serialize(ByteBuf _buf) { diff --git a/src/Luban.Server/Templates/proto/cs/proto.tpl b/src/Luban.Server/Templates/proto/cs/proto.tpl index 2b962ec..f62e7bf 100644 --- a/src/Luban.Server/Templates/proto/cs/proto.tpl +++ b/src/Luban.Server/Templates/proto/cs/proto.tpl @@ -37,11 +37,11 @@ namespace {{x.namespace_with_top_module}} {{~end~}} {{~end~}} } - public const int ID = {{x.id}}; + public const int __ID__ = {{x.id}}; public override int GetTypeId() { - return ID; + return __ID__; } public override void Serialize(ByteBuf _buf) diff --git a/src/Luban.Server/Templates/proto/cs/rpc.tpl b/src/Luban.Server/Templates/proto/cs/rpc.tpl index cad83e2..c34bf48 100644 --- a/src/Luban.Server/Templates/proto/cs/rpc.tpl +++ b/src/Luban.Server/Templates/proto/cs/rpc.tpl @@ -22,11 +22,11 @@ namespace {{x.namespace_with_top_module}} { } - public const int ID = {{x.id}}; + public const int __ID__ = {{x.id}}; public override int GetTypeId() { - return ID; + return __ID__; } public override void Reset() diff --git a/src/Luban.Server/Templates/proto/cs/stub.tpl b/src/Luban.Server/Templates/proto/cs/stub.tpl index 5ab3e0a..6e286d1 100644 --- a/src/Luban.Server/Templates/proto/cs/stub.tpl +++ b/src/Luban.Server/Templates/proto/cs/stub.tpl @@ -7,11 +7,11 @@ namespace {{namespace}} public static System.Collections.Generic.Dictionary Factories { get; } = new System.Collections.Generic.Dictionary { {{~ for proto in protos ~}} - [{{proto.full_name}}.ID] = () => new {{proto.full_name}}(), + [{{proto.full_name}}.__ID__] = () => new {{proto.full_name}}(), {{~end~}} {{~ for rpc in rpcs ~}} - [{{rpc.full_name}}.ID] = () => new {{rpc.full_name}}(), + [{{rpc.full_name}}.__ID__] = () => new {{rpc.full_name}}(), {{~end~}} }; } diff --git a/src/Luban.Server/Templates/proto/typescript/bean.tpl b/src/Luban.Server/Templates/proto/typescript/bean.tpl index 5e9da01..51a6802 100644 --- a/src/Luban.Server/Templates/proto/typescript/bean.tpl +++ b/src/Luban.Server/Templates/proto/typescript/bean.tpl @@ -36,8 +36,8 @@ export {{if x.is_abstract_type}} abstract {{end}} class {{name}} extends {{if pa return _bean_ } {{else}} - static readonly ID = {{x.id}} - getTypeId() { return {{name}}.ID } + static readonly __ID__ = {{x.id}} + getTypeId() { return {{name}}.__ID__ } {{~end~}} diff --git a/src/Luban.Server/Templates/proto/typescript/proto.tpl b/src/Luban.Server/Templates/proto/typescript/proto.tpl index 0734804..14b5953 100644 --- a/src/Luban.Server/Templates/proto/typescript/proto.tpl +++ b/src/Luban.Server/Templates/proto/typescript/proto.tpl @@ -12,8 +12,8 @@ */ {{~end~}} export class {{name}} extends Protocol { - static readonly ID = {{x.id}} - getTypeId() { return {{name}}.ID } + static readonly __ID__ = {{x.id}} + getTypeId() { return {{name}}.__ID__ } {{~ for field in fields ~}} diff --git a/src/Luban.Server/Templates/proto/typescript/stub.tpl b/src/Luban.Server/Templates/proto/typescript/stub.tpl index 506801a..81db636 100644 --- a/src/Luban.Server/Templates/proto/typescript/stub.tpl +++ b/src/Luban.Server/Templates/proto/typescript/stub.tpl @@ -5,11 +5,11 @@ static readonly Factories = new Map([ {{~ for proto in protos ~}} - [{{proto.full_name}}.ID, () => new {{proto.full_name}}()], + [{{proto.full_name}}.__ID__, () => new {{proto.full_name}}()], {{~end~}} {{~ for rpc in rpcs ~}} - // TODO RPC .. [{{rpc.full_name}}.ID] = () => new {{rpc.full_name}}(), + // TODO RPC .. [{{rpc.full_name}}.__ID__] = () => new {{rpc.full_name}}(), {{~end~}} ]) }