refactor: addInterrupt is now on GameHost

This commit is contained in:
2026-04-04 15:37:22 +08:00
parent 60a6bcad77
commit 775bb00bed
4 changed files with 40 additions and 5 deletions
+16
View File
@@ -79,6 +79,22 @@ export class GameHost<TState extends Record<string, unknown>> {
return this.commands._tryCommit(input);
}
/**
* 为下一个 produceAsync 注册中断 Promise(通常用于 UI 动画)。
* @see MutableSignal.addInterruption
*/
addInterruption(promise: Promise<void>): void {
this._state.addInterruption(promise);
}
/**
* 清除所有未完成的中断。
* @see MutableSignal.clearInterruptions
*/
clearInterruptions(): void {
this._state.clearInterruptions();
}
async setup(setupCommand: string): Promise<void> {
if (this._isDisposed) {
throw new Error('GameHost is disposed');