refactor: update api

This commit is contained in:
2026-04-06 13:59:00 +08:00
parent fa104d10f2
commit a53f162c03
2 changed files with 110 additions and 10 deletions
@@ -18,6 +18,10 @@ export abstract class GameHostScene<TState extends Record<string, unknown>>
public get gameHost(): GameHost<TState> {
return this._gameHost;
}
public get state(): TState {
return this.gameHost?.state.value;
}
addInterruption(promise: Promise<void>){
this.gameHost?.addInterruption(promise);
@@ -41,11 +45,6 @@ export abstract class GameHostScene<TState extends Record<string, unknown>>
this.disposables.dispose();
}
/** 获取当前状态的只读快照 */
public get state(): TState {
return this.gameHost.context.value;
}
public addDisposable(disposable: IDisposable){
this.disposables.add(disposable);
}