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: "昆特牌", 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 + 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"; 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); + }); + } } 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 - 扩展名 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:`; 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 +}