From ba269df86251f9ae61fd312a3356ad495d5840a6 Mon Sep 17 00:00:00 2001 From: walon Date: Sat, 12 Feb 2022 13:42:12 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E5=A4=8D=E3=80=91=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Dlua=5Fbin=E7=94=9F=E6=88=90=E7=9A=84=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=5Fname=E4=BD=9C=E4=B8=BA=E5=A4=9A=E6=80=81ke?= =?UTF-8?q?y=E7=9A=84bug=E3=80=82=E5=BA=94=E8=AF=A5=5Ftype=5F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en-us.md | 10 +++++----- src/Luban.Job.Cfg/Source/Defs/DefBean.cs | 2 +- .../Templates/config/lua_bin/all.tpl | 4 ++-- .../Templates/config/lua_lua/all.tpl | 17 +---------------- 4 files changed, 9 insertions(+), 24 deletions(-) diff --git a/README.en-us.md b/README.en-us.md index 5ec5b18..c557373 100644 --- a/README.en-us.md +++ b/README.en-us.md @@ -322,7 +322,7 @@ Reward is a substructure containing the three fields of "int item_id; int count; ##varidshapeshape2 ##typeintShapeShape -##var__type__radiuswidthheight +##var$typeradiuswidthheight 1Circle10Circle100 2Rectangle1020Rectangle1020 3Circle10Triangle151515 @@ -402,14 +402,14 @@ Take the behavior tree as an example to show how to configure the behavior tree "executor": "SERVER", "blackboard_id": "demo", "root": { - "__type__": "Sequence", + "$type": "Sequence", "id": 1, "node_name": "test", "desc": "root", "services": [], "decorators": [ { - "__type__": "UeLoop", + "$type": "UeLoop", "id": 3, "node_name": "", "flow_abort_mode": "SELF", @@ -420,7 +420,7 @@ Take the behavior tree as an example to show how to configure the behavior tree ], "children": [ { - "__type__": "UeWait", + "$type": "UeWait", "id": 30, "node_name": "", "ignore_restart_self": false, @@ -430,7 +430,7 @@ Take the behavior tree as an example to show how to configure the behavior tree "decorators": [] }, { - "__type__": "MoveToRandomLocation", + "$type": "MoveToRandomLocation", "id": 75, "node_name": "", "ignore_restart_self": false, diff --git a/src/Luban.Job.Cfg/Source/Defs/DefBean.cs b/src/Luban.Job.Cfg/Source/Defs/DefBean.cs index a13821d..cb7a91f 100644 --- a/src/Luban.Job.Cfg/Source/Defs/DefBean.cs +++ b/src/Luban.Job.Cfg/Source/Defs/DefBean.cs @@ -26,7 +26,7 @@ namespace Luban.Job.Cfg.Defs public string JsonTypeNameKey => JSON_TYPE_NAME_KEY; - + public string LuaTypeNameKey => LUA_TYPE_NAME_KEY; public string Alias { get; } diff --git a/src/Luban.Server/Templates/config/lua_bin/all.tpl b/src/Luban.Server/Templates/config/lua_bin/all.tpl index 02734bf..8e1692d 100644 --- a/src/Luban.Server/Templates/config/lua_bin/all.tpl +++ b/src/Luban.Server/Templates/config/lua_bin/all.tpl @@ -83,7 +83,7 @@ local function InitTypes(methods) {{~end~}} local class = SimpleClass() class._id = {{bean.id}} - class._name = '{{bean.full_name}}' + class['{{bean.lua_type_name_key}}'] = '{{bean.full_name}}' local id2name = { {{for c in bean.hierarchy_not_abstract_children}} [{{c.id}}] = '{{c.full_name}}', {{end}} } {{~if bean.is_abstract_type~}} class._deserialize = function(bs) @@ -105,7 +105,7 @@ local function InitTypes(methods) return o end {{~end~}} - beans[class._name] = class + beans[class['{{bean.lua_type_name_key}}']] = class end {{~end~}} diff --git a/src/Luban.Server/Templates/config/lua_lua/all.tpl b/src/Luban.Server/Templates/config/lua_lua/all.tpl index 07eb94e..849ccab 100644 --- a/src/Luban.Server/Templates/config/lua_lua/all.tpl +++ b/src/Luban.Server/Templates/config/lua_lua/all.tpl @@ -9,21 +9,6 @@ local enums = {{~end~}} } -local beans = {} -{{~ for bean in beans ~}} ----@class {{bean.full_name}} {{if bean.parent_def_type}}:{{bean.parent}} {{end}} -{{~ for field in bean.export_fields~}} ----@field public {{field.convention_name}} {{lua_comment_type field.ctype}} -{{~end~}} -beans['{{bean.full_name}}'] = -{ -{{~ for field in bean.hierarchy_export_fields ~}} - { name='{{field.convention_name}}', type='{{lua_comment_type field.ctype}}'}, -{{~end~}} -} - -{{~end~}} - local tables = { {{~for table in tables ~}} @@ -37,4 +22,4 @@ local tables = {{~end~}} } -return { enums = enums, beans = beans, tables = tables } +return { enums = enums, tables = tables }