mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-14 11:29:28 +02:00
Fixed didLog
to not start phases again when interrupted
This commit is contained in:
parent
99a5f0d9ba
commit
62aea1ad8d
@ -82,9 +82,11 @@ export class PhaseInterceptor {
|
|||||||
async () => {
|
async () => {
|
||||||
// If we were interrupted by a UI prompt, we assume that the calling code will queue inputs to
|
// If we were interrupted by a UI prompt, we assume that the calling code will queue inputs to
|
||||||
// end the current phase manually, so we just wait for the phase to end from the caller.
|
// end the current phase manually, so we just wait for the phase to end from the caller.
|
||||||
if (this.state === "interrupted" && !didLog) {
|
if (this.state === "interrupted") {
|
||||||
this.doLog("PhaseInterceptor.to: Waiting for phase to end after being interrupted!");
|
if (!didLog) {
|
||||||
didLog = true;
|
this.doLog("PhaseInterceptor.to: Waiting for phase to end after being interrupted!");
|
||||||
|
didLog = true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +104,7 @@ export class PhaseInterceptor {
|
|||||||
await this.run(currentPhase);
|
await this.run(currentPhase);
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
{ interval: 0, timeout: 5_000 },
|
{ interval: 0, timeout: 20_000 },
|
||||||
);
|
);
|
||||||
|
|
||||||
// We hit the target; run as applicable and wrap up.
|
// We hit the target; run as applicable and wrap up.
|
||||||
|
@ -44,7 +44,7 @@ describe("Test Utils - PromptHandler", () => {
|
|||||||
phaseManager: {
|
phaseManager: {
|
||||||
getCurrentPhase: () =>
|
getCurrentPhase: () =>
|
||||||
({
|
({
|
||||||
phaseName: "testDialoguePhase",
|
phaseName: "CommandPhase",
|
||||||
}) as unknown as Phase,
|
}) as unknown as Phase,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -67,7 +67,7 @@ describe("Test Utils - PromptHandler", () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
describe("setMode", () => {
|
describe("setMode", () => {
|
||||||
it("should wrap and pass along original function arguments", async () => {
|
it("should wrap and pass along original function arguments from setModeInternal", async () => {
|
||||||
const setModeSpy = vi.spyOn(promptHandler as any, "setMode");
|
const setModeSpy = vi.spyOn(promptHandler as any, "setMode");
|
||||||
promptHandler["game"].scene.ui["setModeInternal"](UiMode.PARTY, false, false, false, []);
|
promptHandler["game"].scene.ui["setModeInternal"](UiMode.PARTY, false, false, false, []);
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ describe("Test Utils - PromptHandler", () => {
|
|||||||
expect(setModeCallback).toHaveBeenCalledAfter(setModeSpy);
|
expect(setModeCallback).toHaveBeenCalledAfter(setModeSpy);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should call PhaseInterceptor.checkMode", async () => {
|
it("should call PhaseInterceptor.checkMode if current phase in `endBySetMode`", async () => {
|
||||||
promptHandler["game"].scene.ui["setModeInternal"](UiMode.PARTY, false, false, false, []);
|
promptHandler["game"].scene.ui["setModeInternal"](UiMode.PARTY, false, false, false, []);
|
||||||
|
|
||||||
expect(checkModeCallback).toHaveBeenCalledOnce();
|
expect(checkModeCallback).toHaveBeenCalledOnce();
|
||||||
|
Loading…
Reference in New Issue
Block a user