mirror of
https://github.com/unanmed/HumanBreak.git
synced 2026-11-01 07:24:30 +08:00
fix: 录像播放
This commit is contained in:
1 parent
7ed74c8004
commit
ffc4aaa865
10 files changed
+43
-33
No files matched your search
@@ -530,14 +530,6 @@ loading.once('coreInit', () => {
|
||||
});
|
||||
});
|
||||
|
||||
const { hook } = Mota.requireAll('var');
|
||||
hook.on('reset', () => {
|
||||
const HeroSkill = Mota.require('module', 'Mechanism').HeroSkill;
|
||||
mainSetting.reset({
|
||||
'action.autoSkill': HeroSkill.getAutoSkill()
|
||||
});
|
||||
});
|
||||
|
||||
interface SettingTextData {
|
||||
[x: string]: string[] | SettingTextData;
|
||||
}
|
||||
|
||||
@@ -91,6 +91,10 @@ export namespace HeroSkill {
|
||||
learned.delete(skill);
|
||||
}
|
||||
|
||||
export function clearSkill() {
|
||||
learned.clear();
|
||||
}
|
||||
|
||||
export function saveSkill(): SkillSave {
|
||||
return { autoSkill, learned: [...learned] };
|
||||
}
|
||||
|
||||
+19
-19
@@ -204,13 +204,18 @@ export function init() {
|
||||
control.prototype.waitHeroToStop = function (callback?: () => void) {
|
||||
core.stopAutomaticRoute();
|
||||
core.clearContinueAutomaticRoute();
|
||||
|
||||
if (heroMover.controller) {
|
||||
heroMover.controller.stop().then(() => {
|
||||
callback?.();
|
||||
});
|
||||
} else {
|
||||
callback?.();
|
||||
heroMover.controller?.stop();
|
||||
if (callback) {
|
||||
core.status.replay.animate = true;
|
||||
core.lockControl();
|
||||
core.status.automaticRoute.moveDirectly = false;
|
||||
setTimeout(
|
||||
function () {
|
||||
core.status.replay.animate = false;
|
||||
callback();
|
||||
},
|
||||
core.status.replay.speed === 24 ? 1 : 30
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -653,29 +658,24 @@ export function init() {
|
||||
});
|
||||
|
||||
const moveAction = new Set<string>(['up', 'down', 'left', 'right']);
|
||||
let controller: IMoveController | null = null;
|
||||
// 复写录像的移动
|
||||
core.registerReplayAction('move', action => {
|
||||
if (moveAction.has(action)) {
|
||||
const next = core.status.replay.toReplay[1];
|
||||
if (!heroMover.moving) {
|
||||
controller = heroMover.startMove();
|
||||
heroMover.startMove();
|
||||
}
|
||||
if (!controller) {
|
||||
if (!heroMover.controller) {
|
||||
return false;
|
||||
}
|
||||
controller.push({
|
||||
heroMover.controller.push({
|
||||
type: 'dir',
|
||||
value: action as Dir
|
||||
});
|
||||
if (moveAction.has(next)) {
|
||||
|
||||
heroMover.controller.onEnd.then(() => {
|
||||
core.replay();
|
||||
} else {
|
||||
controller.onEnd.then(() => {
|
||||
core.replay();
|
||||
controller = null;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@@ -20,6 +20,7 @@ export function clip(...replace: string[]) {
|
||||
}
|
||||
|
||||
export function init() {
|
||||
const { HeroSkill } = Mota.require('module', 'Mechanism');
|
||||
// 注册修改设置的录像操作
|
||||
core.registerReplayAction('settings', name => {
|
||||
if (!name.startsWith('set:')) return false;
|
||||
@@ -27,7 +28,11 @@ export function init() {
|
||||
const v = eval(value);
|
||||
if (typeof v !== 'boolean') return false;
|
||||
if (!replayableSettings.includes(setting)) return false;
|
||||
flags[setting] = v;
|
||||
switch (setting) {
|
||||
case 'autoSkill':
|
||||
HeroSkill.setAutoSkill(v);
|
||||
break;
|
||||
}
|
||||
core.status.route.push(name);
|
||||
core.replay();
|
||||
return true;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// @ts-nocheck
|
||||
|
||||
export function init() {
|
||||
if (main.mode === 'editor') return;
|
||||
const { mainUi, fixedUi, mainSetting } = Mota.requireAll('var');
|
||||
const CustomToolbar = Mota.require('class', 'CustomToolbar');
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -348,7 +348,7 @@ interface Control {
|
||||
* @example core.waitHeroToStop(core.vibrate); // 等待勇士停下,然后视野左右抖动1秒
|
||||
* @param callback 勇士停止后的回调函数
|
||||
*/
|
||||
waitHeroToStop(callback?: () => void): void;
|
||||
waitHeroToStop(callback?: () => void, waitOnly?: boolean): void;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
|
||||
@@ -206,7 +206,7 @@ function update() {
|
||||
skillOpened.value = core.getFlag('chapter', 0) > 0;
|
||||
|
||||
jumpCnt.value =
|
||||
HeroSkill.learnedSkill(HeroSkill.Jump) &&
|
||||
!HeroSkill.learnedSkill(HeroSkill.Jump) ||
|
||||
Mota.Plugin.require('skill_g').jumpIgnoreFloor.has(core.status.floorId)
|
||||
? -1
|
||||
: 3 - (flags[`jump_${core.status.floorId}`] ?? 0);
|
||||
|
||||
Reference in new issue
Block a user