mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-19 04:19:30 +08:00
修复bug
This commit is contained in:
parent
81f6815429
commit
225585977a
@ -2568,7 +2568,7 @@ control.prototype._doSL_load = function (id, callback) {
|
||||
id == 'autoSave' ? id : 'save' + id,
|
||||
null,
|
||||
function (data) {
|
||||
if (!main.replayChecking) {
|
||||
if (!main.replayChecking && data) {
|
||||
core.plugin.startOpened.value = false;
|
||||
core.plugin.loaded.value = false;
|
||||
}
|
||||
|
@ -322,12 +322,11 @@ core.prototype._loadPlugin = async function () {
|
||||
if (main.pluginUseCompress) {
|
||||
await main.loadScript(`project/plugin.m.js?v=${main.version}`);
|
||||
} else {
|
||||
for await (const plugin of mainData.plugin) {
|
||||
await main.loadScript(
|
||||
`project/plugin/${plugin}.js?v=${main.version}`
|
||||
`project/plugin/index.js?v=${main.version}`,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
core.prototype._init_flags = function () {
|
||||
|
@ -5,7 +5,7 @@ function main() {
|
||||
this.version = '1.0.0'; // 游戏版本号;如果更改了游戏内容建议修改此version以免造成缓存问题。
|
||||
|
||||
this.useCompress = false; // 是否使用压缩文件
|
||||
this.pluginUseCompress = false; // 仅限于gh-pages使用
|
||||
this.pluginUseCompress = false;
|
||||
// 当你即将发布你的塔时,请使用“JS代码压缩工具”将所有js代码进行压缩,然后将这里的useCompress改为true。
|
||||
// 请注意,只有useCompress是false时才会读取floors目录下的文件,为true时会直接读取libs目录下的floors.min.js文件。
|
||||
// 如果要进行剧本的修改请务必将其改成false。
|
||||
@ -219,9 +219,10 @@ function main() {
|
||||
}
|
||||
// >>>> body end
|
||||
|
||||
main.prototype.loadScript = async function (src) {
|
||||
main.prototype.loadScript = async function (src, module) {
|
||||
const script = document.createElement('script');
|
||||
script.src = src;
|
||||
if (module) script.type = 'module';
|
||||
document.body.appendChild(script);
|
||||
await new Promise(res => {
|
||||
script.addEventListener('load', res);
|
||||
|
@ -59,13 +59,6 @@ main.floors.MT42=
|
||||
0,
|
||||
13
|
||||
]
|
||||
},
|
||||
"8,12": {
|
||||
"floorId": "MT48",
|
||||
"loc": [
|
||||
3,
|
||||
7
|
||||
]
|
||||
}
|
||||
},
|
||||
"beforeBattle": {},
|
||||
|
@ -1,21 +1,21 @@
|
||||
import './fiveLayer';
|
||||
import './heroFourFrames';
|
||||
import './hotReload';
|
||||
import './itemDetail';
|
||||
import './popup';
|
||||
import './replay';
|
||||
import './ui';
|
||||
import * as halo from './halo';
|
||||
import * as hero from './hero';
|
||||
import * as loopMap from './loopMap';
|
||||
import * as remainEnemy from './remainEnemy';
|
||||
import * as removeMap from './removeMap';
|
||||
import * as shop from './shop';
|
||||
import * as skill from './skills';
|
||||
import * as skillTree from './skillTree';
|
||||
import * as study from './study';
|
||||
import * as towerBoss from './towerBoss';
|
||||
import * as utils from './utils';
|
||||
import './fiveLayer.js';
|
||||
import './heroFourFrames.js';
|
||||
import './hotReload.js';
|
||||
import './itemDetail.js';
|
||||
import './popup.js';
|
||||
import './replay.js';
|
||||
import './ui.js';
|
||||
import * as halo from './halo.js';
|
||||
import * as hero from './hero.js';
|
||||
import * as loopMap from './loopMap.js';
|
||||
import * as remainEnemy from './remainEnemy.js';
|
||||
import * as removeMap from './removeMap.js';
|
||||
import * as shop from './shop.js';
|
||||
import * as skill from './skills.js';
|
||||
import * as skillTree from './skillTree.js';
|
||||
import * as study from './study.js';
|
||||
import * as towerBoss from './towerBoss.js';
|
||||
import * as utils from './utils.js';
|
||||
|
||||
export {
|
||||
halo,
|
||||
|
@ -1,5 +1,5 @@
|
||||
///<reference path="../../../src/types/core.d.ts" />
|
||||
import { slide } from './utils';
|
||||
import { slide } from './utils.js';
|
||||
|
||||
const list = ['tower6'];
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
///<reference path="../../../src/types/core.d.ts" />
|
||||
|
||||
import { studySkill, canStudySkill } from './study';
|
||||
import { studySkill, canStudySkill } from './study.js';
|
||||
|
||||
const replayableSettings = ['autoSkill'];
|
||||
|
||||
|
@ -108,11 +108,6 @@ import * as rollup from 'rollup';
|
||||
const compressed = babel.transformSync(code.output[0].code)?.code!;
|
||||
await fs.writeFile('./dist/project/plugin.m.js', compressed, 'utf-8');
|
||||
|
||||
const main = await fs.readFile('./dist/main.js', 'utf-8');
|
||||
main.replace(
|
||||
/this.pluginUseCompress\s*=\s*false\;/,
|
||||
'this.pluginUseCompress = true;'
|
||||
);
|
||||
await fse.remove('./dist/project/plugin/');
|
||||
} catch (e) {
|
||||
console.log('压缩插件失败');
|
||||
@ -121,7 +116,11 @@ import * as rollup from 'rollup';
|
||||
// 4. 压缩main.js
|
||||
try {
|
||||
// 先获取不能压缩的部分
|
||||
const main = await fs.readFile('./dist/main.js', 'utf-8');
|
||||
const main = (await fs.readFile('./public/main.js', 'utf-8')).replace(
|
||||
/this.pluginUseCompress\s*=\s*false\;/,
|
||||
'this.pluginUseCompress = true;'
|
||||
);
|
||||
|
||||
const endIndex = main.indexOf('// >>>> body end');
|
||||
const nonCompress = main.slice(0, endIndex);
|
||||
const needCompress = main.slice(endIndex + 17);
|
||||
|
2
src/types/core.d.ts
vendored
2
src/types/core.d.ts
vendored
@ -1267,7 +1267,7 @@ interface Main extends MainData {
|
||||
* 加载一个脚本
|
||||
* @param src 脚本路径
|
||||
*/
|
||||
loadScript(src: string): Promise<void>;
|
||||
loadScript(src: string, module?: boolean): Promise<void>;
|
||||
|
||||
/**
|
||||
* 动态加载js文件
|
||||
|
Loading…
Reference in New Issue
Block a user