Compare commits
3 Commits
a0b2003c65
...
9ed23295ae
| Author | SHA1 | Date |
|---|---|---|
|
|
9ed23295ae | |
|
|
ca86bfc427 | |
|
|
09c3fc443b |
|
|
@ -18,7 +18,7 @@
|
|||
"scripts": {
|
||||
"build": "tsup",
|
||||
"build:samples": "tsup --config tsup.samples.config.ts",
|
||||
"prepare": "npm run build",
|
||||
"prepare": "npm run build && npm run build:samples",
|
||||
"test": "vitest",
|
||||
"test:run": "vitest run",
|
||||
"typecheck": "tsc --noEmit"
|
||||
|
|
|
|||
|
|
@ -60,7 +60,9 @@ export abstract class BaseGameClient<
|
|||
|
||||
assignSelector<S>(selector: (t: T) => S, callback: (s: S) => void) {
|
||||
const selected = computed(() => selector(this._context.value));
|
||||
return selected.subscribe(callback);
|
||||
return effect(() => {
|
||||
callback(selected.value);
|
||||
});
|
||||
}
|
||||
|
||||
addInterruption() {
|
||||
|
|
@ -87,17 +89,20 @@ export abstract class BaseGameClient<
|
|||
}
|
||||
}
|
||||
|
||||
callback({
|
||||
hasPrompt: true,
|
||||
player: ctx.player || "global",
|
||||
def: ctx.def,
|
||||
tryAnswer,
|
||||
});
|
||||
await next();
|
||||
callback({
|
||||
hasPrompt: false,
|
||||
player: ctx.player || "global",
|
||||
});
|
||||
try {
|
||||
callback({
|
||||
hasPrompt: true,
|
||||
player: ctx.player || "global",
|
||||
def: ctx.def,
|
||||
tryAnswer,
|
||||
});
|
||||
return await next();
|
||||
} finally {
|
||||
callback({
|
||||
hasPrompt: false,
|
||||
player: ctx.player || "global",
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
selectStatus(callback: (status: ClientStatus) => void) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue