mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
Start TEngine3.0
Start TEngine3.0
This commit is contained in:
25
Luban/Luban.ClientServer/Templates/common/cpp/enum.tpl
Normal file
25
Luban/Luban.ClientServer/Templates/common/cpp/enum.tpl
Normal file
@@ -0,0 +1,25 @@
|
||||
{{~
|
||||
name = x.name
|
||||
namespace_with_top_module = x.namespace_with_top_module
|
||||
comment = x.comment
|
||||
items = x.items
|
||||
~}}
|
||||
|
||||
{{x.cpp_namespace_begin}}
|
||||
{{~if comment != '' ~}}
|
||||
/**
|
||||
* {{comment | html.escape}}
|
||||
*/
|
||||
{{~end~}}
|
||||
enum class {{name}}
|
||||
{
|
||||
{{~ for item in items ~}}
|
||||
{{~if item.comment != '' ~}}
|
||||
/**
|
||||
* {{item.escape_comment}}
|
||||
*/
|
||||
{{~end~}}
|
||||
{{item.name}} = {{item.value}},
|
||||
{{~end~}}
|
||||
};
|
||||
{{x.cpp_namespace_end}}
|
30
Luban/Luban.ClientServer/Templates/common/cs/enum.tpl
Normal file
30
Luban/Luban.ClientServer/Templates/common/cs/enum.tpl
Normal file
@@ -0,0 +1,30 @@
|
||||
{{~
|
||||
name = x.name
|
||||
namespace_with_top_module = x.namespace_with_top_module
|
||||
comment = x.comment
|
||||
items = x.items
|
||||
~}}
|
||||
|
||||
|
||||
{{cs_start_name_space_grace x.namespace_with_top_module}}
|
||||
{{~if comment != '' ~}}
|
||||
/// <summary>
|
||||
/// {{comment | html.escape}}
|
||||
/// </summary>
|
||||
{{~end~}}
|
||||
{{~if x.is_flags~}}
|
||||
[System.Flags]
|
||||
{{~end~}}
|
||||
public enum {{name}}
|
||||
{
|
||||
{{~ for item in items ~}}
|
||||
{{~if item.comment != '' ~}}
|
||||
/// <summary>
|
||||
/// {{item.escape_comment}}
|
||||
/// </summary>
|
||||
{{~end~}}
|
||||
{{item.name}} = {{item.value}},
|
||||
{{~end~}}
|
||||
}
|
||||
|
||||
{{cs_end_name_space_grace x.namespace_with_top_module}}
|
@@ -0,0 +1,15 @@
|
||||
{{~
|
||||
name = x.name
|
||||
namespace_with_top_module = x.namespace_with_top_module
|
||||
comment = x.comment
|
||||
items = x.items
|
||||
~}}
|
||||
|
||||
enum {{x.flat_buffers_full_name}}:int {
|
||||
{{~if !x.has_zero_value_item~}}
|
||||
__GENERATE_DEFAULT_VALUE = 0,
|
||||
{{~end~}}
|
||||
{{~for item in items ~}}
|
||||
{{x.pb_full_name}}_{{item.name}} = {{item.int_value}},
|
||||
{{~end~}}
|
||||
}
|
20
Luban/Luban.ClientServer/Templates/common/gdscript/enum.tpl
Normal file
20
Luban/Luban.ClientServer/Templates/common/gdscript/enum.tpl
Normal file
@@ -0,0 +1,20 @@
|
||||
{{~
|
||||
name = x.name
|
||||
namespace_with_top_module = x.namespace_with_top_module
|
||||
comment = x.comment
|
||||
items = x.items
|
||||
~}}
|
||||
|
||||
{{~if comment != '' ~}}
|
||||
|
||||
# {{comment | html.escape}}
|
||||
{{~end~}}
|
||||
enum {{x.gdscript_full_name}}{
|
||||
{{~ for item in items ~}}
|
||||
{{~if item.comment != '' ~}}
|
||||
{{item.name}} = {{item.int_value}}, # {{item.escape_comment}}
|
||||
{{~else~}}
|
||||
{{item.name}} = {{item.int_value}},
|
||||
{{~end~}}
|
||||
{{~end~}}
|
||||
}
|
14
Luban/Luban.ClientServer/Templates/common/go/enum.tpl
Normal file
14
Luban/Luban.ClientServer/Templates/common/go/enum.tpl
Normal file
@@ -0,0 +1,14 @@
|
||||
{{~
|
||||
name = x.name
|
||||
namespace_with_top_module = x.namespace_with_top_module
|
||||
comment = x.comment
|
||||
items = x.items
|
||||
~}}
|
||||
|
||||
package {{x.top_module}}
|
||||
|
||||
const (
|
||||
{{~for item in items ~}}
|
||||
{{x.go_full_name}}_{{item.name}} = {{item.int_value}}
|
||||
{{~end~}}
|
||||
)
|
23
Luban/Luban.ClientServer/Templates/common/java/enum.tpl
Normal file
23
Luban/Luban.ClientServer/Templates/common/java/enum.tpl
Normal file
@@ -0,0 +1,23 @@
|
||||
{{~
|
||||
name = x.name
|
||||
namespace_with_top_module = x.namespace_with_top_module
|
||||
comment = x.comment
|
||||
items = x.items
|
||||
~}}
|
||||
|
||||
package {{namespace_with_top_module}};
|
||||
{{~if comment != '' ~}}
|
||||
/**
|
||||
* {{comment | html.escape}}
|
||||
*/
|
||||
{{~end~}}
|
||||
public final class {{name}} {
|
||||
{{~ for item in items ~}}
|
||||
{{~if item.comment != '' ~}}
|
||||
/**
|
||||
* {{item.escape_comment}}
|
||||
*/
|
||||
{{~end~}}
|
||||
public static final int {{item.name}} = {{item.int_value}};
|
||||
{{~end~}}
|
||||
}
|
30
Luban/Luban.ClientServer/Templates/common/lua/base.tpl
Normal file
30
Luban/Luban.ClientServer/Templates/common/lua/base.tpl
Normal file
@@ -0,0 +1,30 @@
|
||||
{{
|
||||
enums = x.enums
|
||||
beans = x.beans
|
||||
tables = x.tables
|
||||
}}
|
||||
local setmetatable = setmetatable
|
||||
local pairs = pairs
|
||||
local ipairs = ipairs
|
||||
local tinsert = table.insert
|
||||
|
||||
local function SimpleClass()
|
||||
local class = {}
|
||||
class.__index = class
|
||||
class.New = function(...)
|
||||
local ctor = class.ctor
|
||||
local o = ctor and ctor(...) or {}
|
||||
setmetatable(o, class)
|
||||
return o
|
||||
end
|
||||
return class
|
||||
end
|
||||
|
||||
|
||||
local function get_map_size(m)
|
||||
local n = 0
|
||||
for _ in pairs(m) do
|
||||
n = n + 1
|
||||
end
|
||||
return n
|
||||
end
|
15
Luban/Luban.ClientServer/Templates/common/protobuf2/enum.tpl
Normal file
15
Luban/Luban.ClientServer/Templates/common/protobuf2/enum.tpl
Normal file
@@ -0,0 +1,15 @@
|
||||
{{~
|
||||
name = x.name
|
||||
namespace_with_top_module = x.namespace_with_top_module
|
||||
comment = x.comment
|
||||
items = x.items
|
||||
~}}
|
||||
|
||||
enum {{x.pb_full_name}} {
|
||||
{{~for item in items ~}}
|
||||
{{x.pb_full_name}}_{{item.name}} = {{item.int_value}};
|
||||
{{~end~}}
|
||||
{{~if items.empty?}}
|
||||
{{x.pb_full_name}}_EMPTY_PLACEHOLDER = 0;
|
||||
{{~end~}}
|
||||
}
|
15
Luban/Luban.ClientServer/Templates/common/protobuf3/enum.tpl
Normal file
15
Luban/Luban.ClientServer/Templates/common/protobuf3/enum.tpl
Normal file
@@ -0,0 +1,15 @@
|
||||
{{~
|
||||
name = x.name
|
||||
namespace_with_top_module = x.namespace_with_top_module
|
||||
comment = x.comment
|
||||
items = x.items
|
||||
~}}
|
||||
|
||||
enum {{x.pb_full_name}} {
|
||||
{{~if items.empty? || items[0].int_value != 0~}}
|
||||
{{x.pb_full_name}}_EMPTY_PLACEHOLDER = 0;
|
||||
{{~end~}}
|
||||
{{~for item in items ~}}
|
||||
{{x.pb_full_name}}_{{item.name}} = {{item.int_value}};
|
||||
{{~end~}}
|
||||
}
|
24
Luban/Luban.ClientServer/Templates/common/python/enum.tpl
Normal file
24
Luban/Luban.ClientServer/Templates/common/python/enum.tpl
Normal file
@@ -0,0 +1,24 @@
|
||||
{{~
|
||||
name = x.name
|
||||
namespace_with_top_module = x.namespace_with_top_module
|
||||
comment = x.comment
|
||||
items = x.items
|
||||
~}}
|
||||
|
||||
{{~if comment != '' ~}}
|
||||
'''
|
||||
{{comment | html.escape}}
|
||||
'''
|
||||
{{~end~}}
|
||||
class {{x.py_full_name}}(Enum):
|
||||
{{~ for item in items ~}}
|
||||
{{~if item.comment != '' ~}}
|
||||
'''
|
||||
{{item.escape_comment}}
|
||||
'''
|
||||
{{~end~}}
|
||||
{{item.name}} = {{item.value}}
|
||||
{{~end~}}
|
||||
{{~if (items == empty)~}}
|
||||
pass
|
||||
{{~end~}}
|
25
Luban/Luban.ClientServer/Templates/common/rust/enum.tpl
Normal file
25
Luban/Luban.ClientServer/Templates/common/rust/enum.tpl
Normal file
@@ -0,0 +1,25 @@
|
||||
{{~
|
||||
name = x.name
|
||||
namespace_with_top_module = x.namespace_with_top_module
|
||||
comment = x.comment
|
||||
items = x.items
|
||||
~}}
|
||||
|
||||
{{~if comment != '' ~}}
|
||||
/**
|
||||
* {{comment | html.escape}}
|
||||
*/
|
||||
{{~end~}}
|
||||
#[allow(dead_code)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum {{x.rust_full_name}} {
|
||||
{{~for item in items ~}}
|
||||
{{~if item.comment != '' ~}}
|
||||
/**
|
||||
* {{item.escape_comment}}
|
||||
*/
|
||||
{{~end~}}
|
||||
{{item.name}} = {{item.int_value}},
|
||||
{{~end~}}
|
||||
}
|
||||
|
@@ -0,0 +1,24 @@
|
||||
{{~
|
||||
name = x.name
|
||||
namespace_with_top_module = x.namespace_with_top_module
|
||||
comment = x.comment
|
||||
items = x.items
|
||||
~}}
|
||||
|
||||
{{x.typescript_namespace_begin}}
|
||||
{{~if comment != '' ~}}
|
||||
/**
|
||||
* {{comment | html.escape}}
|
||||
*/
|
||||
{{~end~}}
|
||||
export enum {{name}} {
|
||||
{{~for item in items ~}}
|
||||
{{~if item.comment != '' ~}}
|
||||
/**
|
||||
* {{item.escape_comment}}
|
||||
*/
|
||||
{{~end~}}
|
||||
{{item.name}} = {{item.value}},
|
||||
{{~end~}}
|
||||
}
|
||||
{{x.typescript_namespace_end}}
|
Reference in New Issue
Block a user