IndieGame/config/Table/Tools/Luban/Templates/lua-lua/schema.sbn
DOBEST\zhaoyingjie f242607587 初始化工程
2024-10-11 10:12:15 +08:00

43 lines
1.7 KiB
Plaintext

local enums =
{
{{~ for c in __enums ~}}
---@class {{c.full_name}} {{-if c.comment != ''}} @{{escape_comment c.comment}}{{end}}
{{~ for item in c.items ~}}
---@field public {{item.name}} integer {{-if item.comment != ''}} @{{escape_comment item.comment}}{{end}}
{{~end~}}
['{{c.full_name}}'] = { {{ for item in c.items }} {{item.name}}={{item.int_value}}, {{end}} };
{{~end~}}
}
local beans = {}
{{~ for bean in __beans ~}}
do
---@class {{bean.full_name}} {{if bean.parent_def_type}}:{{bean.parent}} {{end}} {{-if bean.comment != ''}} @{{escape_comment bean.comment}}{{end}}
{{~ for field in bean.export_fields~}}
---@field public {{field.name}} {{comment_type field.ctype}} {{-if field.comment != ''}} @{{escape_comment field.comment}}{{end}}
{{~end~}}
local class = {
{{~ for field in bean.export_fields~}}
{ name='{{field.name}}', type='{{comment_type field.ctype}}'},
{{~end~}}
}
beans['{{bean.full_name}}'] = class
end
{{~end~}}
local tables =
{
{{~for table in __tables ~}}
{{~if table.is_map_table ~}}
{ name='{{table.name}}', file='{{table.output_data_file}}', mode='map', index='{{table.index}}', value_type='{{table.value_ttype.def_bean.full_name}}' },
{{~else if table.is_list_table ~}}
{ name='{{table.name}}', file='{{table.output_data_file}}', mode='list', index='{{table.index}}', value_type='{{table.value_ttype.def_bean.full_name}}' },
{{~else~}}
{ name='{{table.name}}', file='{{table.output_data_file}}', mode='one', value_type='{{table.value_ttype.def_bean.full_name}}'},
{{~end~}}
{{~end~}}
}
return { enums = enums, beans = beans, tables = tables }