fix: fix bugs

This commit is contained in:
2026-04-04 00:10:26 +08:00
parent 656c33cb59
commit 7501b5f592
3 changed files with 29 additions and 24 deletions
+4 -14
View File
@@ -83,24 +83,14 @@ export class GameScene extends ReactiveScene<TicTacToeState> {
}
private setupInput(): void {
const scene = this;
const activePromptRef = {
get current() { return scene.activePrompt; }
};
this.inputMapper = createInputMapper(
this,
this.commands,
activePromptRef,
{ current: null }, // 不再需要,保留以兼容接口
(cmd: string) => {
const activePrompt = this.activePrompt;
if (!activePrompt) return 'No active prompt';
const error = activePrompt.tryCommit(cmd);
if (error === null) {
this.activePrompt = null;
this.promptHandler.start();
}
return error;
// 使用 PromptHandler.submit() 而不是直接 tryCommit
// 这样会自动处理没有活跃 prompt 时的排队逻辑
return this.promptHandler.submit(cmd);
}
);