莉莉丝游戏达芬奇计划内容组Excel转Lua工具(适用于Ava框架),简称x2l
ava-xls2lua是一款编辑器的外部工具,可将Excel表格批量转换成Lua脚本,简称x2l
- 开发语言:
js
- 打包工具:
Electron Packager
,Electron Wix Msi
- 👤 主干分支
main
主干分支,所有新功能开发后直接合入主干,以及debug - 👥 开发分支
dev-
开头的分支,用于开发对应的功能 - 🗣️ 发布分支
release
最近的发版分支,当发布新版本的时候,需要将release分支更新到最近tag位置
下载并安装 Node.js v14.17.3
打开cmd
或PowerShell
,切换到项目根目录
- 输入
npm install
,进行包的安装 - 输入
npm install -g bower
,安装bower - 输入
bower i
,进行包安装 - 输入
npm start
,运行x2l
打开cmd
或PowerShell
,切换到项目根目录
- 输入
npm package-win
,生成windows平台的软件包 - 输入
npm package-mac
,生成mac平台的软件包 - 输入
npm setup-win
,生成windows平台的安装包
- 将Excel文件批量生成对应的Lua脚本,支持
.xls
.xlsx
.xlsm
- 可以根据不同的项目结构配置目录和文件名前后缀
- 最多保存5个设置,适用多个项目分别进行转换
- 基础类型:
Int
,Float
,String
,Bool
- 数组类型:
Int[]
,Float[]
,String[]
,Bool[]
- 编辑器类型:
Vector2
,Vector3
,Euler
,Color
- Lua代码:
Lua
- 批注类型:
Comment
(不会被转换成Lua代码)
- 初次使用
- 项目配置界面
- 输出信息
- 项目列表
- 新建或更改配置并转换
- 快速转换
Excel文件中,有output_
或kv_
前缀的Sheet表格会生成对应的lua文件
- output: 普通配置表
- kv: kv表
支持Excel中多张Sheet的导出
表头有四行,分别是:变量中文描述,英文变量名,数据类型,主键
- 变量中文描述:表述列的信息,如何配置,不会导出到Lua中
- 英文变量名:导出Lua脚本中的变量名称
- 数据类型:x2l会根据不动的变量类型生成对应的Lua行,支持类型,支持大小写模糊
- 主键:最多有三个,
Key1
,Key2
,Key3
,x2l会根据主键来生成Lua Table的结构,主键必须是Int
或String
,支持大小写模糊 - 数据:从第
5
行开始
- 在配置中配置
KV Format Excel Files:
,支持多张KV样式的Excel - 表中有
3
列,Key
,Value
,Des
Key
:类型为Int
或String
,设为主键Key1
Value
:类型为Lua
,直接在数据中填写LuaDes
:类型为Comment
,不进行Lua生成
- KV表格示例
Excel目录
策划表ExampleTable1.xls
的output_Example1
表数据
生成Lua脚本目录
output_Example1
表生成对应Lua脚本['World']['Global']['Xls']['Example1XlsModule'].ModuleScript.lua
--- This file is generated by ava-x2l.exe,
--- Don't change it manaully.
--- @copyright Lilith Games, Project Da Vinci(Avatar Team)
--- @see Official Website: https://www.projectdavinci.com/
--- @see Dev Framework: https://github.com/lilith-avatar/avatar-ava
--- @see X2L Tool: https://github.com/lilith-avatar/avatar-ava-xls2lua
local Example1Xls = {
[1] = {
house = {
id = 1,
name = 'house',
use_money = 1000,
use_food = 2.33,
is_init = true,
defense = 100,
args_int_arr = {1, 2, 3},
args_float_arr = {1.23, 2, 3.23},
args_string_arr = {'sdf', '23e', 's'},
args_bool_arr = {true, false, true},
args_vect2 = Vector2(-1, 0.5),
args_vect3 = Vector3(2, 0.3, -4),
args_euler = EulerDegree(12, 23, 43),
args_color = Color(129, 12, 3, 0),
args_lua = function() print(23) end,
Des1 = 'output_Example1_Des1_1_house',
Des2 = 'output_Example1_Des2_1_house'
},
MMM = {
id = 1,
name = 'MMM',
use_money = 123,
use_food = 336.2,
is_init = true,
defense = nil,
args_int_arr = {1, 2, 3},
args_float_arr = {1, 2.3445, 3},
args_string_arr = {'你好', '你在哪'},
args_bool_arr = {true, false},
args_vect2 = Vector2(0, 4),
args_vect3 = Vector3(-2, 3, 5),
args_euler = nil,
args_color = nil,
args_lua = {a = 2, b='234'},
Des1 = 'output_Example1_Des1_1_MMM',
Des2 = 'output_Example1_Des2_1_MMM'
},
ddd = {
id = 1,
name = 'ddd',
use_money = 456,
use_food = 222.33665,
is_init = false,
defense = 130,
args_int_arr = {3, 2, 5},
args_float_arr = {3, 2, 2.5},
args_string_arr = {'我在这里啊', '你在那', '呢'},
args_bool_arr = {false, true},
args_vect2 = Vector2(2, 0.5),
args_vect3 = Vector3(0.6, 3, -8.4),
args_euler = nil,
args_color = nil,
args_lua = nil,
Des1 = 'output_Example1_Des1_1_ddd',
Des2 = 'output_Example1_Des2_1_ddd'
}
},
[2] = {
farm = {
id = 2,
name = 'farm',
use_money = 100,
use_food = 220,
is_init = false,
defense = 200,
args_int_arr = {2, 3},
args_float_arr = {200.3, 3, 234.23},
args_string_arr = {'df', 'ssd', 'dd', 'dd'},
args_bool_arr = nil,
args_vect2 = nil,
args_vect3 = nil,
args_euler = nil,
args_color = nil,
args_lua = nil,
Des1 = 'output_Example1_Des1_2_farm',
Des2 = 'output_Example1_Des2_2_farm'
},
MMM = {
id = 2,
name = 'MMM',
use_money = nil,
use_food = 22.1,
is_init = nil,
defense = 234,
args_int_arr = {3, 6, 6, 7},
args_float_arr = {3, 6.3, 6, 7},
args_string_arr = {'ss', 'd', 'd', 'd'},
args_bool_arr = {true, true},
args_vect2 = nil,
args_vect3 = nil,
args_euler = nil,
args_color = nil,
args_lua = "还没有添加检查",
Des1 = 'output_Example1_Des1_2_MMM',
Des2 = 'output_Example1_Des2_2_MMM'
}
},
[3] = {
horse3 = {
id = 3,
name = 'horse3',
use_money = 200,
use_food = nil,
is_init = false,
defense = 333,
args_int_arr = nil,
args_float_arr = nil,
args_string_arr = {'2e', 'w', 'e', 'we'},
args_bool_arr = {false, false, false, false},
args_vect2 = nil,
args_vect3 = nil,
args_euler = nil,
args_color = nil,
args_lua = nil,
Des1 = nil,
Des2 = nil
}
}
}
return Example1Xls
在Config
中配置[GlobalSetting.xlsx]
表为KV格式的表格,并生成Lua脚本
生成后的['World']['Global']['Xls']['GlobalSettingXlsModule'].ModuleScript.lua
--- This file is generated by ava-x2l.exe,
--- Don't change it manaully.
--- @copyright Lilith Games, Project Da Vinci(Avatar Team)
--- @see Official Website: https://www.projectdavinci.com/
--- @see Dev Framework: https://github.com/lilith-avatar/avatar-ava
--- @see X2L Tool: https://github.com/lilith-avatar/avatar-ava-xls2lua
--- source file: D:\x2l_doc\xls\/GlobalSetting.xlsx
local GlobalSettingXls = {
SeaLevelMax = true,
SeaLevelMiddle = Vector3(0,-14.5,0),
SeaLevelMin = Vector3(0,-21.4,0),
FloorMax = Vector3(0,0.02,0),
FloorMin = Vector3(0,-15,0),
BridgeMax = Vector3(0,0.25,0),
BridgeMin = Vector3(0,-15,0),
PlaneSideLength = 30,
FlashFrequency = 0.1,
NoticeMoveTime = 0.5,
NoticeStayTime = 3,
SwimmingSpeed = 3,
DrowningStrength = 0.5,
LandingRecover = 2,
DrowningHealth = 10,
DelaySank = 15,
MaxFootsteps = false,
MaxCrack = 50,
MinVoiceDis = 2,
VoicePromptPeriod = 0.15,
WalkSpeed = 4.5,
BulletCount = 50,
BackSpeed = 3.5
}
return GlobalSettingXls