From a943d43409f1fef131c8e0daae64d31f5d95904c Mon Sep 17 00:00:00 2001 From: Rintim Date: Mon, 22 Apr 2024 20:58:09 +0800 Subject: [PATCH 1/7] feat: change origin import character function. --- noname/init/import.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/noname/init/import.js b/noname/init/import.js index 776ea605c..a20bc3dc8 100644 --- a/noname/init/import.js +++ b/noname/init/import.js @@ -11,10 +11,13 @@ export const importCardPack = generateImportFunction("card", (name) => `../../ca * @param {string} name - 武将包名 * @returns {Promise} */ -export const importCharacterPack = generateImportFunction( - "character", - (name) => `../../character/${name}.js` -); +export const importCharacterPack = generateImportFunction("character", (name) => { + const alreadyModernCharacterPack = ["key"]; + + return alreadyModernCharacterPack.includes(name) + ? `../../character/${name}/index.js` + : `../../character/${name}.js`; +}); /** * @param {string} name - 扩展名 From 479559493f7e80df17a2a33b4986a9a8c781f565 Mon Sep 17 00:00:00 2001 From: Rintim Date: Mon, 22 Apr 2024 20:58:21 +0800 Subject: [PATCH 2/7] refactor: rename. --- game/package.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game/package.js b/game/package.js index fb9054467..d50575b1b 100644 --- a/game/package.js +++ b/game/package.js @@ -23,7 +23,7 @@ window.noname_package = { old: "怀旧", diy: "DIY", ddd: "3D精选", - 'key/index' : "Key", + key: "Key", yxs: "英雄杀", hearth: "炉石传说", gwent: "昆特牌", From 3a3d3cd5217b31b23eb6774e74950367a3f9c4a5 Mon Sep 17 00:00:00 2001 From: Rintim Date: Mon, 22 Apr 2024 20:58:31 +0800 Subject: [PATCH 3/7] feat: add game.promises.getFileList. --- noname/game/promises.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/noname/game/promises.js b/noname/game/promises.js index a79a407d3..a8c3943d9 100644 --- a/noname/game/promises.js +++ b/noname/game/promises.js @@ -126,4 +126,17 @@ export class GamePromises { }) ); } + + /** + * 获取文件列表 + * + * @param { string } dir 目录 + * @returns { Promise<[string[], string[]]> } 返回一个数组,第一个元素是文件夹列表,第二个元素是文件列表 + */ + getFileList(dir) { + return new Promise((resolve, reject) => { + // @ts-ignore + game.getFileList(dir, (folders, files) => resolve([folders, files]), reject); + }); + } } From 9b0de829230f761b7241869dc60046a646e513e7 Mon Sep 17 00:00:00 2001 From: Rintim Date: Mon, 22 Apr 2024 20:59:46 +0800 Subject: [PATCH 4/7] fix: allow ts import with ts extension. --- tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 8ae43aff5..36330b331 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -43,6 +43,7 @@ // "noResolve": true, /* Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project. */ /* JavaScript Support */ "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ + "allowImportingTsExtensions": true, "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ /* Emit */ @@ -101,4 +102,4 @@ "ignoreDeprecations": "5.0", "suppressImplicitAnyIndexErrors": true } -} \ No newline at end of file +} From 8e12c5a2ea23c26f3f168fb7b1170891fc93c344 Mon Sep 17 00:00:00 2001 From: Rintim Date: Mon, 22 Apr 2024 21:00:14 +0800 Subject: [PATCH 5/7] feat: add project root url to relative. --- noname.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/noname.js b/noname.js index 24d68dcae..ab93299fa 100644 --- a/noname.js +++ b/noname.js @@ -1,8 +1,10 @@ -export { GNC, gnc, setGNC } from './noname/gnc/index.js'; -export { AI, ai, setAI } from './noname/ai/index.js'; -export { Game, game, setGame } from './noname/game/index.js'; -export { Get, get, setGet } from './noname/get/index.js'; -export { Library, lib, setLibrary } from './noname/library/index.js'; -export { status, _status, setStatus } from './noname/status/index.js'; -export { UI, ui, setUI } from './noname/ui/index.js'; -export { boot } from './noname/init/index.js'; +export const rootURL = new URL(import.meta.url); + +export { GNC, gnc, setGNC } from "./noname/gnc/index.js"; +export { AI, ai, setAI } from "./noname/ai/index.js"; +export { Game, game, setGame } from "./noname/game/index.js"; +export { Get, get, setGet } from "./noname/get/index.js"; +export { Library, lib, setLibrary } from "./noname/library/index.js"; +export { status, _status, setStatus } from "./noname/status/index.js"; +export { UI, ui, setUI } from "./noname/ui/index.js"; +export { boot } from "./noname/init/index.js"; From 8a28a7f00d828ba9ed1d35529fa66ca3453985e8 Mon Sep 17 00:00:00 2001 From: Rintim Date: Mon, 22 Apr 2024 21:47:07 +0800 Subject: [PATCH 6/7] fix: api error and format. --- index.html | 175 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 101 insertions(+), 74 deletions(-) diff --git a/index.html b/index.html index 4fa7ada28..9573fe2c0 100755 --- a/index.html +++ b/index.html @@ -1,28 +1,29 @@ - + - - - - + + + + 无名杀 - \ No newline at end of file + From 150c503ca193fe8f6416ce6544e8fe6723b74459 Mon Sep 17 00:00:00 2001 From: Rintim Date: Mon, 22 Apr 2024 22:11:56 +0800 Subject: [PATCH 7/7] fix: pretteir format uncheck. --- noname/library/init/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noname/library/init/index.js b/noname/library/init/index.js index 380e5018a..61f512b81 100644 --- a/noname/library/init/index.js +++ b/noname/library/init/index.js @@ -724,7 +724,7 @@ export class LibInit { let k = 0; let result; //去除99个step的限制 - while ((result = str.slice(skip).match(new RegExp(`['"]step ${k}['"]`))) != null) { + while ((result = str.slice(skip).match(new RegExp(`\\(?['"]step ${k}['"]\\)?;?`))) != null) { let insertStr; if (k == 0) { insertStr = `switch(step){case 0:`;