mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-18 20:09:27 +08:00
修复录像!
This commit is contained in:
parent
4135d06ccd
commit
bd4a7f946a
3
.gitignore
vendored
3
.gitignore
vendored
@ -30,4 +30,5 @@ dist.zip
|
|||||||
story.md
|
story.md
|
||||||
dist.rar
|
dist.rar
|
||||||
*.h5save
|
*.h5save
|
||||||
*.h5route
|
*.h5route
|
||||||
|
index.cjs
|
@ -310,17 +310,38 @@ core.prototype.init = async function (coreData, callback) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
core.prototype.initSync = function (coreData, callback) {
|
||||||
|
this._forwardFuncs();
|
||||||
|
for (var key in coreData) core[key] = coreData[key];
|
||||||
|
this._init_flags();
|
||||||
|
this._init_platform();
|
||||||
|
this._init_others();
|
||||||
|
this._loadPluginSync();
|
||||||
|
|
||||||
|
core.loader._load(function () {
|
||||||
|
core.extensions._load(function () {
|
||||||
|
core._afterLoadResources(callback);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
core.prototype._loadPluginSync = function () {
|
||||||
|
core.plugin = {};
|
||||||
|
if (main.useCompress) main.loadMod('project', 'plugin', () => 0);
|
||||||
|
else main.loadMod('project', 'plugin.min', () => 0);
|
||||||
|
};
|
||||||
|
|
||||||
core.prototype._loadPlugin = async function () {
|
core.prototype._loadPlugin = async function () {
|
||||||
const mainData = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main;
|
const mainData = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main;
|
||||||
core.plugin = {};
|
core.plugin = {};
|
||||||
// 加载插件
|
// 加载插件
|
||||||
if (!main.replayChecking && main.mode === 'play') {
|
if (main.mode === 'play') {
|
||||||
main.forward();
|
main.forward();
|
||||||
core.resetSettings();
|
core.resetSettings();
|
||||||
core.plugin.showMarkedEnemy.value = true;
|
core.plugin.showMarkedEnemy.value = true;
|
||||||
}
|
}
|
||||||
if (main.pluginUseCompress) {
|
if (main.pluginUseCompress) {
|
||||||
await main.loadScript(`project/plugin.m.js?v=${main.version}`);
|
await main.loadScript(`project/plugin.min.js?v=${main.version}`);
|
||||||
} else {
|
} else {
|
||||||
await main.loadScript(
|
await main.loadScript(
|
||||||
`project/plugin/index.js?v=${main.version}`,
|
`project/plugin/index.js?v=${main.version}`,
|
||||||
|
@ -25,8 +25,10 @@ events.prototype.resetGame = function (hero, hard, floorId, maps, values) {
|
|||||||
events.prototype.startGame = function (hard, seed, route, callback) {
|
events.prototype.startGame = function (hard, seed, route, callback) {
|
||||||
hard = hard || '';
|
hard = hard || '';
|
||||||
core.dom.gameGroup.style.display = 'block';
|
core.dom.gameGroup.style.display = 'block';
|
||||||
core.plugin.startOpened.value = false;
|
if (!main.replayChecking) {
|
||||||
core.plugin.loaded.value = false;
|
core.plugin.startOpened.value = false;
|
||||||
|
core.plugin.loaded.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (main.mode != 'play') return;
|
if (main.mode != 'play') return;
|
||||||
core.plugin.skillTree.resetSkillLevel();
|
core.plugin.skillTree.resetSkillLevel();
|
||||||
@ -73,7 +75,9 @@ events.prototype._startGame_start = function (hard, seed, route, callback) {
|
|||||||
core.events._startGame_afterStart(callback);
|
core.events._startGame_afterStart(callback);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (route != null) core.startReplay(route);
|
if (route != null) {
|
||||||
|
core.startReplay(route);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
events.prototype._startGame_setHard = function () {
|
events.prototype._startGame_setHard = function () {
|
||||||
|
@ -3202,7 +3202,7 @@ maps.prototype.removeBlock = function (x, y, floorId) {
|
|||||||
const block = blocks[i];
|
const block = blocks[i];
|
||||||
this.removeBlockByIndex(i, floorId);
|
this.removeBlockByIndex(i, floorId);
|
||||||
this._removeBlockFromMap(floorId, block);
|
this._removeBlockFromMap(floorId, block);
|
||||||
core.updateShadow(true);
|
if (!main.replayChecking) core.updateShadow(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -3365,7 +3365,7 @@ maps.prototype.setBlock = function (number, x, y, floorId, noredraw) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
core.updateShadow(true);
|
if (!main.replayChecking) core.updateShadow(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
maps.prototype.animateSetBlock = function (
|
maps.prototype.animateSetBlock = function (
|
||||||
|
@ -942,40 +942,19 @@ ui.prototype.clearUI = function () {
|
|||||||
|
|
||||||
////// 左上角绘制一段提示 //////
|
////// 左上角绘制一段提示 //////
|
||||||
ui.prototype.drawTip = function (text, id, frame) {
|
ui.prototype.drawTip = function (text, id, frame) {
|
||||||
text = core.replaceText(text) || '';
|
let t =
|
||||||
var realText = this._getRealContent(text);
|
text +
|
||||||
var one = {
|
' [' +
|
||||||
text: text,
|
core.status.hero.loc.x +
|
||||||
textX: 21,
|
',' +
|
||||||
width: 26 + core.calWidth('data', realText, '16px Arial'),
|
core.status.hero.loc.y +
|
||||||
opacity: 0.1,
|
',' +
|
||||||
stage: 1,
|
core.status.floorId +
|
||||||
frame: frame || 0,
|
'] ';
|
||||||
time: 0
|
if (core.status.floorId === 'tower6')
|
||||||
};
|
t += core.searchBlockWithFilter(v => v.event.cls === 'enemys').length;
|
||||||
if (id != null) {
|
|
||||||
var info = core.getBlockInfo(id);
|
console.log(t);
|
||||||
if (info == null || !info.image || info.bigImage) {
|
|
||||||
// 检查状态栏图标
|
|
||||||
if (core.statusBar.icons[id] instanceof Image) {
|
|
||||||
info = {
|
|
||||||
image: core.statusBar.icons[id],
|
|
||||||
posX: 0,
|
|
||||||
posY: 0,
|
|
||||||
height: 32
|
|
||||||
};
|
|
||||||
} else info = null;
|
|
||||||
}
|
|
||||||
if (info != null) {
|
|
||||||
one.image = info.image;
|
|
||||||
one.posX = info.posX;
|
|
||||||
one.posY = info.posY;
|
|
||||||
one.height = info.height;
|
|
||||||
one.textX += 24;
|
|
||||||
one.width += 24;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
core.animateFrame.tip = one;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ui.prototype._drawTip_drawOne = function (tip) {
|
ui.prototype._drawTip_drawOne = function (tip) {
|
||||||
@ -4229,5 +4208,5 @@ ui.prototype.deleteAllCanvas = function () {
|
|||||||
this.deleteCanvas(function () {
|
this.deleteCanvas(function () {
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
if (main.mode === 'play' && !core.isReplaying()) core.initShadowCanvas();
|
if (main.mode === 'play' && !main.replayChecking) core.initShadowCanvas();
|
||||||
};
|
};
|
||||||
|
@ -219,7 +219,7 @@ function main() {
|
|||||||
}
|
}
|
||||||
// >>>> body end
|
// >>>> body end
|
||||||
|
|
||||||
main.prototype.loadScript = async function (src, module) {
|
main.prototype.loadScript = function (src, module) {
|
||||||
const script = document.createElement('script');
|
const script = document.createElement('script');
|
||||||
script.src = src;
|
script.src = src;
|
||||||
if (module) script.type = 'module';
|
if (module) script.type = 'module';
|
||||||
@ -243,6 +243,67 @@ main.prototype.init = async function (mode, callback) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (main.replayChecking) {
|
||||||
|
main.loadSync(mode, callback);
|
||||||
|
} else {
|
||||||
|
main.loadAsync(mode, callback);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
main.prototype.loadSync = function (mode, callback) {
|
||||||
|
main.mode = mode;
|
||||||
|
if (main.useCompress) {
|
||||||
|
main.loadMod('project', 'project', () => 0);
|
||||||
|
} else {
|
||||||
|
main.pureData.forEach(v => {
|
||||||
|
main.loadMod('project', v, () => 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const mainData = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main;
|
||||||
|
Object.assign(main, mainData);
|
||||||
|
|
||||||
|
if (main.useCompress) {
|
||||||
|
main.loadMod('libs', 'libs', () => 0);
|
||||||
|
} else {
|
||||||
|
main.loadList.forEach(v => {
|
||||||
|
main.loadMod('libs', v, () => 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const name of main.loadList) {
|
||||||
|
if (name === 'core') continue;
|
||||||
|
core[name] = new window[name]();
|
||||||
|
}
|
||||||
|
|
||||||
|
main.loadFloors(() => 0);
|
||||||
|
|
||||||
|
const coreData = {};
|
||||||
|
[
|
||||||
|
'dom',
|
||||||
|
'statusBar',
|
||||||
|
'canvas',
|
||||||
|
'images',
|
||||||
|
'tilesets',
|
||||||
|
'materials',
|
||||||
|
'animates',
|
||||||
|
'bgms',
|
||||||
|
'sounds',
|
||||||
|
'floorIds',
|
||||||
|
'floors',
|
||||||
|
'floorPartitions'
|
||||||
|
].forEach(function (t) {
|
||||||
|
coreData[t] = main[t];
|
||||||
|
});
|
||||||
|
|
||||||
|
core.initSync(coreData, callback);
|
||||||
|
core.resize();
|
||||||
|
main.core = core;
|
||||||
|
|
||||||
|
core.completeAchievement = () => 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
main.prototype.loadAsync = async function (mode, callback) {
|
||||||
for (var i = 0; i < main.dom.gameCanvas.length; i++) {
|
for (var i = 0; i < main.dom.gameCanvas.length; i++) {
|
||||||
main.canvas[main.dom.gameCanvas[i].id] =
|
main.canvas[main.dom.gameCanvas[i].id] =
|
||||||
main.dom.gameCanvas[i].getContext('2d');
|
main.dom.gameCanvas[i].getContext('2d');
|
||||||
|
@ -13,6 +13,16 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
|
|||||||
core.status = core.clone(core.initStatus, function (name) {
|
core.status = core.clone(core.initStatus, function (name) {
|
||||||
return name != 'hero' && name != 'maps';
|
return name != 'hero' && name != 'maps';
|
||||||
});
|
});
|
||||||
|
const bgmaps = {};
|
||||||
|
const handler = {
|
||||||
|
set(target, p, v) {
|
||||||
|
if (core.status.floorId === 'tower6') console.trace();
|
||||||
|
|
||||||
|
target[p] = v;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
core.status.bgmaps = new Proxy(bgmaps, handler);
|
||||||
core.control._bindRoutePush();
|
core.control._bindRoutePush();
|
||||||
core.status.played = true;
|
core.status.played = true;
|
||||||
// 初始化人物,图标,统计信息
|
// 初始化人物,图标,统计信息
|
||||||
@ -52,6 +62,10 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
|
|||||||
if (main.mode === 'play' && !main.replayChecking) {
|
if (main.mode === 'play' && !main.replayChecking) {
|
||||||
core.splitArea();
|
core.splitArea();
|
||||||
core.resetFlagSettings();
|
core.resetFlagSettings();
|
||||||
|
} else {
|
||||||
|
flags.autoSkill ??= true;
|
||||||
|
flags.itemDetail ??= true;
|
||||||
|
flags.autoLocate ??= true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
win: function (reason, norank, noexit) {
|
win: function (reason, norank, noexit) {
|
||||||
@ -141,7 +155,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
|
|||||||
// ---------- 重绘新地图;这一步将会设置core.status.floorId ---------- //
|
// ---------- 重绘新地图;这一步将会设置core.status.floorId ---------- //
|
||||||
core.drawMap(floorId);
|
core.drawMap(floorId);
|
||||||
|
|
||||||
core.updateShadow();
|
if (!main.replayChecking) core.updateShadow();
|
||||||
|
|
||||||
// 切换楼层BGM
|
// 切换楼层BGM
|
||||||
if (core.status.maps[floorId].bgm) {
|
if (core.status.maps[floorId].bgm) {
|
||||||
@ -200,7 +214,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
|
|||||||
core.visitFloor(floorId);
|
core.visitFloor(floorId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!flags.debug) core.checkVisitedFloor();
|
if (!flags.debug && !main.replayChecking) core.checkVisitedFloor();
|
||||||
},
|
},
|
||||||
flyTo: function (toId, callback) {
|
flyTo: function (toId, callback) {
|
||||||
// 楼层传送器的使用,从当前楼层飞往toId
|
// 楼层传送器的使用,从当前楼层飞往toId
|
||||||
@ -1119,7 +1133,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const [x, y] = flags.mouseLoc;
|
const [x, y] = flags.mouseLoc ?? [];
|
||||||
const mx = Math.round(x + core.bigmap.offsetX / 32);
|
const mx = Math.round(x + core.bigmap.offsetX / 32);
|
||||||
const my = Math.round(y + core.bigmap.offsetY / 32);
|
const my = Math.round(y + core.bigmap.offsetY / 32);
|
||||||
|
|
||||||
@ -1408,6 +1422,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
|
|||||||
// 更新全地图显伤
|
// 更新全地图显伤
|
||||||
core.updateDamage();
|
core.updateDamage();
|
||||||
|
|
||||||
|
if (main.replayChecking) return;
|
||||||
|
|
||||||
// 已学习的技能
|
// 已学习的技能
|
||||||
if (
|
if (
|
||||||
core.plugin.skillTree.getSkillLevel(11) > 0 &&
|
core.plugin.skillTree.getSkillLevel(11) > 0 &&
|
||||||
|
@ -80,7 +80,7 @@ core.registerReplayAction('buy', name => {
|
|||||||
const [type, id, num] = name
|
const [type, id, num] = name
|
||||||
.split(':')
|
.split(':')
|
||||||
.map(v => (/^\d+$/.test(v) ? parseInt(v) : v));
|
.map(v => (/^\d+$/.test(v) ? parseInt(v) : v));
|
||||||
const shop = core.status.shops[id];
|
const shop = core.status.shops[openedShopId];
|
||||||
const item = shop.choices.find(v => v.id === id);
|
const item = shop.choices.find(v => v.id === id);
|
||||||
if (!item) return false;
|
if (!item) return false;
|
||||||
flags.itemShop ??= {};
|
flags.itemShop ??= {};
|
||||||
@ -98,6 +98,7 @@ core.registerReplayAction('buy', name => {
|
|||||||
if (cost > core.status.hero.money) return false;
|
if (cost > core.status.hero.money) return false;
|
||||||
core.status.hero.money -= cost;
|
core.status.hero.money -= cost;
|
||||||
flags.itemShop[openedShopId][id] += type === 'buy' ? num : -num;
|
flags.itemShop[openedShopId][id] += type === 'buy' ? num : -num;
|
||||||
|
core.addItem(id, type === 'buy' ? num : -num);
|
||||||
core.status.route.push(name);
|
core.status.route.push(name);
|
||||||
core.replay();
|
core.replay();
|
||||||
return true;
|
return true;
|
||||||
|
@ -2,10 +2,15 @@
|
|||||||
export {};
|
export {};
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
if (main.replayChecking) return (core.plugin.gameUi = {});
|
if (main.replayChecking)
|
||||||
|
return (core.plugin.gameUi = {
|
||||||
|
openItemShop: () => 0,
|
||||||
|
showChapter: () => 0,
|
||||||
|
openSkill: () => 0
|
||||||
|
});
|
||||||
|
|
||||||
function openItemShop(itemShopId) {
|
function openItemShop(itemShopId) {
|
||||||
if (!main.replayChecking) {
|
if (!core.isReplaying()) {
|
||||||
core.plugin.openedShopId = itemShopId;
|
core.plugin.openedShopId = itemShopId;
|
||||||
core.plugin.shopOpened.value = true;
|
core.plugin.shopOpened.value = true;
|
||||||
}
|
}
|
||||||
|
@ -51,3 +51,4 @@ core.plugin.utils = {
|
|||||||
has,
|
has,
|
||||||
maxGameScale
|
maxGameScale
|
||||||
};
|
};
|
||||||
|
core.has = has;
|
||||||
|
@ -109,7 +109,7 @@ import * as rollup from 'rollup';
|
|||||||
name: 'CorePlugin'
|
name: 'CorePlugin'
|
||||||
});
|
});
|
||||||
const compressed = babel.transformSync(code.output[0].code)?.code!;
|
const compressed = babel.transformSync(code.output[0].code)?.code!;
|
||||||
await fs.writeFile('./dist/project/plugin.m.js', compressed, 'utf-8');
|
await fs.writeFile('./dist/project/plugin.min.js', compressed, 'utf-8');
|
||||||
|
|
||||||
await fse.remove('./dist/project/plugin/');
|
await fse.remove('./dist/project/plugin/');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user