mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-26 18:26:23 +00:00
update
This commit is contained in:
@@ -16,7 +16,7 @@ const excel = require('exceljs');
|
||||
* @param {*} name excel文件名
|
||||
* @param {*} isClient 是否为客户端数据
|
||||
*/
|
||||
async function convert(src, dst, name, isClient) {
|
||||
async function convert(src, dst, name, isClient,outLocalJsonPath) {
|
||||
let r = {};
|
||||
let names = []; // 文名字段名
|
||||
let keys = []; // 字段名
|
||||
@@ -282,11 +282,14 @@ async function convert(src, dst, name, isClient) {
|
||||
});
|
||||
// 写入流
|
||||
if (r["undefined"] == null) {
|
||||
|
||||
await fs.writeFileSync(dst, JSON.stringify(r));
|
||||
await fs.writeFileSync(outLocalJsonPath, JSON.stringify(r));
|
||||
// 生成客户端脚本
|
||||
if (isClient)
|
||||
(0, JsonToTs_1.createTs)(name, types_client, r, primary);
|
||||
console.log(isClient ? "客户端数据" : "服务器数据", "生成成功", dst);
|
||||
|
||||
}
|
||||
else {
|
||||
console.warn(isClient ? "客户端数据" : "服务器数据", "无数据", dst);
|
||||
@@ -296,12 +299,13 @@ async function convert(src, dst, name, isClient) {
|
||||
function run() {
|
||||
var inputExcelPath = path_1.default.join(__dirname, main_1.config.PathExcel);
|
||||
var outJsonPath = path_1.default.join(__dirname, main_1.config.PathJson);
|
||||
var outLocalJsonPath = path_1.default.join(__dirname, "../json/");
|
||||
const files = fs.readdirSync(inputExcelPath);
|
||||
files.forEach((f) => {
|
||||
let name = f.substring(0, f.indexOf("."));
|
||||
let ext = f.toString().substring(f.lastIndexOf(".") + 1);
|
||||
if (ext == "xlsx") {
|
||||
convert(inputExcelPath + f, outJsonPath + name + ".json", name, true); // 客户端数据
|
||||
convert(inputExcelPath + f, outJsonPath + name + ".json", name, true, outLocalJsonPath + name + ".json"); // 客户端数据
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -278,6 +278,7 @@ async function convert(src: string, dst: string, name: string, isClient: boolean
|
||||
});
|
||||
// 写入流
|
||||
if (r["undefined"] == null) {
|
||||
|
||||
await fs.writeFileSync(dst, JSON.stringify(r));
|
||||
|
||||
// 生成客户端脚本
|
||||
|
@@ -32,7 +32,7 @@ export async function createTs(name: string, fieldType: any, data: any, primary:
|
||||
}
|
||||
|
||||
var script =
|
||||
`import { JsonUtil } from "../../../ngame/util/JsonUtil";
|
||||
`import { JsonUtil } from "../../../../extensions/ngame/assets/ngame/util/JsonUtil";
|
||||
|
||||
export class Table${name} {
|
||||
static TableName: string = "${name}";
|
||||
|
Reference in New Issue
Block a user