mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-19 20:59:37 +08:00
fix: 高倍速动画
This commit is contained in:
parent
001c91c312
commit
c6cf6287de
@ -1324,7 +1324,10 @@ control.prototype.startReplay = function (list) {
|
|||||||
core.setOpacity('replay', 0.6);
|
core.setOpacity('replay', 0.6);
|
||||||
this._replay_drawProgress();
|
this._replay_drawProgress();
|
||||||
core.updateStatusBar(false, true);
|
core.updateStatusBar(false, true);
|
||||||
core.drawTip('开始播放');
|
// Mota.Plugin.require('utils_r').tip(
|
||||||
|
// 'warn',
|
||||||
|
// '由于不可抗力,录像播放过程中将没有勇士移动动画'
|
||||||
|
// );
|
||||||
Mota.require('var', 'hook').emit('replayStatus', false);
|
Mota.require('var', 'hook').emit('replayStatus', false);
|
||||||
Mota.require('class', 'CustomToolbar').setDefaultTool(true);
|
Mota.require('class', 'CustomToolbar').setDefaultTool(true);
|
||||||
this.replay();
|
this.replay();
|
||||||
|
@ -40,6 +40,8 @@ export class HeroRenderer
|
|||||||
|
|
||||||
/** 勇士移动速度 */
|
/** 勇士移动速度 */
|
||||||
speed: number = 100;
|
speed: number = 100;
|
||||||
|
/** 勇士移动的真正速度,经过录像修正 */
|
||||||
|
realSpeed: number = 100;
|
||||||
|
|
||||||
/** 当前的移动方向 */
|
/** 当前的移动方向 */
|
||||||
moveDir: Dir2 = 'down';
|
moveDir: Dir2 = 'down';
|
||||||
@ -83,6 +85,7 @@ export class HeroRenderer
|
|||||||
*/
|
*/
|
||||||
setMoveSpeed(speed: number) {
|
setMoveSpeed(speed: number) {
|
||||||
this.speed = speed;
|
this.speed = speed;
|
||||||
|
this.fixMoveSpeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -200,13 +203,14 @@ export class HeroRenderer
|
|||||||
if (!this.renderable) return;
|
if (!this.renderable) return;
|
||||||
|
|
||||||
if (this.moving) {
|
if (this.moving) {
|
||||||
const progress = (time - this.lastStepTime) / this.speed;
|
const progress = (time - this.lastStepTime) / this.realSpeed;
|
||||||
|
|
||||||
const { x: dx, y: dy } = this.stepDelta;
|
const { x: dx, y: dy } = this.stepDelta;
|
||||||
const { x, y } = core.status.hero.loc;
|
const { x, y } = core.status.hero.loc;
|
||||||
if (progress >= 1) {
|
if (progress >= 1) {
|
||||||
this.renderable.x = x + dx;
|
this.renderable.x = x + dx;
|
||||||
this.renderable.y = y + dy;
|
this.renderable.y = y + dy;
|
||||||
|
this.fixMoveSpeed();
|
||||||
this.emit('stepEnd');
|
this.emit('stepEnd');
|
||||||
} else {
|
} else {
|
||||||
const rx = dx * progress + x;
|
const rx = dx * progress + x;
|
||||||
@ -229,6 +233,15 @@ export class HeroRenderer
|
|||||||
this.turn(this.stepDir);
|
this.turn(this.stepDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fixMoveSpeed() {
|
||||||
|
if (!core.isReplaying()) {
|
||||||
|
this.realSpeed = this.speed;
|
||||||
|
} else {
|
||||||
|
const replay = core.status.replay.speed;
|
||||||
|
this.realSpeed = replay === 24 ? 1 : this.speed / replay;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 准备开始移动
|
* 准备开始移动
|
||||||
*/
|
*/
|
||||||
|
@ -486,10 +486,10 @@ export class HeroMover extends ObjectMoverBase {
|
|||||||
const adapter = HeroMover.adapter;
|
const adapter = HeroMover.adapter;
|
||||||
const viewport = HeroMover.viewport;
|
const viewport = HeroMover.viewport;
|
||||||
if (!adapter || !viewport) return;
|
if (!adapter || !viewport) return;
|
||||||
if (!core.isReplaying()) {
|
// if (!core.isReplaying()) {
|
||||||
adapter.sync('startAnimate');
|
adapter.sync('startAnimate');
|
||||||
await adapter.all('readyMove');
|
await adapter.all('readyMove');
|
||||||
}
|
// }
|
||||||
// 这里要检查前面那一格能不能走,不能走则不触发平滑视角,以避免撞墙上视角卡住
|
// 这里要检查前面那一格能不能走,不能走则不触发平滑视角,以避免撞墙上视角卡住
|
||||||
if (!this.ignoreTerrain) {
|
if (!this.ignoreTerrain) {
|
||||||
const { x, y } = core.status.hero.loc;
|
const { x, y } = core.status.hero.loc;
|
||||||
@ -511,10 +511,10 @@ export class HeroMover extends ObjectMoverBase {
|
|||||||
const adapter = HeroMover.adapter;
|
const adapter = HeroMover.adapter;
|
||||||
const viewport = HeroMover.viewport;
|
const viewport = HeroMover.viewport;
|
||||||
if (!adapter || !viewport) return;
|
if (!adapter || !viewport) return;
|
||||||
if (!core.isReplaying()) {
|
// if (!core.isReplaying()) {
|
||||||
await adapter.all('endMove');
|
await adapter.all('endMove');
|
||||||
adapter.sync('endAnimate');
|
adapter.sync('endAnimate');
|
||||||
}
|
// }
|
||||||
viewport.sync('endMove');
|
viewport.sync('endMove');
|
||||||
core.clearContinueAutomaticRoute();
|
core.clearContinueAutomaticRoute();
|
||||||
core.stopAutomaticRoute();
|
core.stopAutomaticRoute();
|
||||||
@ -685,12 +685,12 @@ export class HeroMover extends ObjectMoverBase {
|
|||||||
const speed = replay === 24 ? 1 : this.moveSpeed / replay;
|
const speed = replay === 24 ? 1 : this.moveSpeed / replay;
|
||||||
viewport.all('moveTo', x, y, speed * 1.6);
|
viewport.all('moveTo', x, y, speed * 1.6);
|
||||||
adapter.sync('setAnimateDir', showDir);
|
adapter.sync('setAnimateDir', showDir);
|
||||||
if (core.isReplaying()) {
|
// if (core.isReplaying()) {
|
||||||
await sleep(speed);
|
// await sleep(speed);
|
||||||
await adapter.all('setHeroLoc', x, y);
|
// await adapter.all('setHeroLoc', x, y);
|
||||||
} else {
|
// } else {
|
||||||
await adapter.all('move', moveDir);
|
await adapter.all('move', moveDir);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7,6 +7,7 @@ import * as gameCanvas from './fx/gameCanvas';
|
|||||||
import * as animateController from './animateController';
|
import * as animateController from './animateController';
|
||||||
import * as achievement from './ui/achievement';
|
import * as achievement from './ui/achievement';
|
||||||
import * as boss from './boss';
|
import * as boss from './boss';
|
||||||
|
import * as utils from './utils';
|
||||||
import './loopMap';
|
import './loopMap';
|
||||||
|
|
||||||
Mota.Plugin.register('fly_r', fly);
|
Mota.Plugin.register('fly_r', fly);
|
||||||
@ -23,3 +24,4 @@ Mota.Plugin.register(
|
|||||||
Mota.Plugin.register('chase_r', chase);
|
Mota.Plugin.register('chase_r', chase);
|
||||||
Mota.Plugin.register('achievement_r', achievement);
|
Mota.Plugin.register('achievement_r', achievement);
|
||||||
Mota.Plugin.register('boss_r', boss);
|
Mota.Plugin.register('boss_r', boss);
|
||||||
|
Mota.Plugin.register('utils_r', utils);
|
||||||
|
Loading…
Reference in New Issue
Block a user