mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 09:02:47 +02:00
* Replace various `scene` pass-arounds with global scene variable * Modify tests * Add scene back to `fade[in|out]()` calls Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Fix Bug Superfan ME test Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Re-enable fixed test Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Rename `gScene` to `globalScene` * Move `globalScene` to its own file to fix import/async issues * Fix `SelectModifierPhase` tests * Fix ME tests by removing `scene` from `expect()`s * Resolve merge issues * Remove tsdocs referencing `scene` params Remove missed instances of `.scene` * Remove unnecessary `globalScene` usage in `loading-scene.ts` * Fix merge conflicts * Attempt to fix circular import issue * Found the source of the import issue * Fix merge issues --------- Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com>
46 lines
1.5 KiB
TypeScript
46 lines
1.5 KiB
TypeScript
import type { Mode } from "./ui";
|
|
import UiHandler from "./ui-handler";
|
|
import { Button } from "#enums/buttons";
|
|
import { globalScene } from "#app/global-scene";
|
|
|
|
export default abstract class AwaitableUiHandler extends UiHandler {
|
|
protected awaitingActionInput: boolean;
|
|
protected onActionInput: Function | null;
|
|
public tutorialActive: boolean = false;
|
|
public tutorialOverlay: Phaser.GameObjects.Rectangle;
|
|
|
|
constructor(mode: Mode | null = null) {
|
|
super(mode);
|
|
}
|
|
|
|
processTutorialInput(button: Button): boolean {
|
|
if ((button === Button.ACTION || button === Button.CANCEL) && this.onActionInput) {
|
|
this.getUi().playSelect();
|
|
const originalOnActionInput = this.onActionInput;
|
|
this.onActionInput = null;
|
|
originalOnActionInput();
|
|
this.awaitingActionInput = false;
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Create a semi transparent overlay that will get shown during tutorials
|
|
* @param container the container to add the overlay to
|
|
*/
|
|
initTutorialOverlay(container: Phaser.GameObjects.Container) {
|
|
if (!this.tutorialOverlay) {
|
|
this.tutorialOverlay = new Phaser.GameObjects.Rectangle(globalScene, -1, -1, globalScene.scaledCanvas.width, globalScene.scaledCanvas.height, 0x070707);
|
|
this.tutorialOverlay.setName("tutorial-overlay");
|
|
this.tutorialOverlay.setOrigin(0, 0);
|
|
this.tutorialOverlay.setAlpha(0);
|
|
}
|
|
|
|
if (container) {
|
|
container.add(this.tutorialOverlay);
|
|
}
|
|
}
|
|
}
|