Files
esengine/packages/behavior-tree-editor/src/application/use-cases/UpdateNodeDataUseCase.ts
T

22 lines
638 B
TypeScript
Raw Normal View History

import { CommandManager } from '@esengine/editor-core';
2025-11-03 21:22:16 +08:00
import { UpdateNodeDataCommand } from '../commands/tree/UpdateNodeDataCommand';
import { ITreeState } from '../commands/ITreeState';
/**
* 更新节点数据用例
*/
export class UpdateNodeDataUseCase {
constructor(
private readonly commandManager: CommandManager,
private readonly treeState: ITreeState
) {}
/**
* 更新节点数据
*/
execute(nodeId: string, data: Record<string, unknown>): void {
const command = new UpdateNodeDataCommand(this.treeState, nodeId, data);
this.commandManager.execute(command);
}
}