feat: 录像记录 & CoreState 存储接口

This commit is contained in:
AncTe committed 2026-09-14 18:09:45 +08:00
1 parent 5470f7a90e
commit cee843981f
16 files changed
+156 -51

No files matched your search

+15 -2
View File
@@ -1,6 +1,10 @@
import { ITileLocator, logger } from '@motajs/common';
import { IObjectMovable, IObjectMover } from '@user/data-common';
import { IStateBase } from '@user/data-base';
import {
IObjectMovable,
IObjectMover,
ReplayCommandCode
} from '@user/data-common';
import { HeroMover, IStateBase } from '@user/data-base';
import { isNil } from 'lodash-es';
import { PathfindingFinder } from './finder';
import {
@@ -95,6 +99,15 @@ export class PathfindingSystem implements IPathfindingSystem {
if (!this.policy || this.policy(path)) {
return this.startMove(path, false);
} else {
// 录像记录
// TODO:后续需要调整设计方式,最好不用 instanceof
if (this.mover instanceof HeroMover) {
const replay = this.state.replaySystem;
replay.route.add(ReplayCommandCode.Teleport, [
target.x,
target.y
]);
}
return this.startMove(path, true);
}
}
+1 -3
View File
@@ -1,6 +1,6 @@
import { IStateBase } from '@user/data-base';
import { IEnemyContext } from './combat';
import { IEnemyAttr, IHeroAttr, IReplaySystem } from '@user/data-common';
import { IEnemyAttr, IHeroAttr } from '@user/data-common';
import { IGameEventSystem } from './event';
import { IPathfindingSystem } from './path';
@@ -11,8 +11,6 @@ export interface IStateSystem extends IStateBase {
readonly eventSystem: IGameEventSystem;
/** 已绑定勇士移动器的寻路系统 */
readonly pathfinding: IPathfindingSystem;
/** 当前 CoreState 独立拥有的录像系统 */
readonly replaySystem: IReplaySystem;
}
export interface IStateSystemExtended {