mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-19 20:59:37 +08:00
fix: 加载 & 热重载
This commit is contained in:
parent
938bd18808
commit
61b47929f6
@ -305,10 +305,15 @@ main.prototype.loadSync = function (mode, callback) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
core.initSync(coreData, callback);
|
core.initSync(coreData, callback);
|
||||||
|
main.loading.emit('coreLoaded');
|
||||||
|
main.loading.emit('coreInit');
|
||||||
|
core.initStatus.maps = core.maps._initMaps();
|
||||||
core.resize();
|
core.resize();
|
||||||
main.core = core;
|
main.core = core;
|
||||||
|
|
||||||
core.completeAchievement = () => 0;
|
core.completeAchievement = () => 0;
|
||||||
|
|
||||||
|
core.plugin = { drawLight: 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
main.prototype.loadAsync = async function (mode, callback) {
|
main.prototype.loadAsync = async function (mode, callback) {
|
||||||
@ -402,20 +407,30 @@ main.prototype.loadAsync = async function (mode, callback) {
|
|||||||
].forEach(function (t) {
|
].forEach(function (t) {
|
||||||
coreData[t] = main[t];
|
coreData[t] = main[t];
|
||||||
});
|
});
|
||||||
|
if (main.mode === 'play') {
|
||||||
await core.init(coreData, callback);
|
await core.init(coreData, callback);
|
||||||
if (main.mode === 'play') main.loading.emit('coreInit');
|
main.loading.emit('coreInit');
|
||||||
core.initStatus.maps = core.maps._initMaps();
|
core.initStatus.maps = core.maps._initMaps();
|
||||||
|
} else {
|
||||||
|
await core.init(coreData, () => {
|
||||||
|
callback();
|
||||||
|
core.initStatus.maps = core.maps._initMaps();
|
||||||
|
});
|
||||||
|
main.loading.emit('coreInit');
|
||||||
|
}
|
||||||
|
|
||||||
core.resize();
|
core.resize();
|
||||||
|
|
||||||
main.core = core;
|
main.core = core;
|
||||||
|
|
||||||
|
if (main.mode === 'editor') return;
|
||||||
|
|
||||||
// 自动放缩最大化
|
// 自动放缩最大化
|
||||||
let auto = Mota.require('var', 'mainSetting').getValue('autoSclae');
|
let auto = Mota.require('var', 'mainSetting').getValue('autoScale', true);
|
||||||
|
|
||||||
if (auto && !core.domStyle.isVertical) {
|
if (auto && !core.domStyle.isVertical) {
|
||||||
try {
|
try {
|
||||||
Mota.Plugin.require('utils_g').maxGameScale();
|
Mota.Plugin.require('utils_g').maxGameScale(1);
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
var style = getComputedStyle(main.dom.gameGroup);
|
var style = getComputedStyle(main.dom.gameGroup);
|
||||||
var height = parseFloat(style.height);
|
var height = parseFloat(style.height);
|
||||||
|
@ -131,7 +131,16 @@ main.floors.MT48=
|
|||||||
"value": "1"
|
"value": "1"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"false": []
|
"false": [
|
||||||
|
{
|
||||||
|
"type": "changeFloor",
|
||||||
|
"floorId": "MT49",
|
||||||
|
"loc": [
|
||||||
|
7,
|
||||||
|
14
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -527,6 +527,7 @@ function watchProject() {
|
|||||||
/_.*/
|
/_.*/
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
watcher.removeAllListeners();
|
||||||
watcher.on('change', async path => {
|
watcher.on('change', async path => {
|
||||||
// 楼层热重载
|
// 楼层热重载
|
||||||
if (/project(\/|\\)floors(\/|\\).*\.js$/.test(path)) {
|
if (/project(\/|\\)floors(\/|\\).*\.js$/.test(path)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user