fix: overlay init
This commit is contained in:
parent
f6f18b4789
commit
6584578316
|
|
@ -49,9 +49,9 @@ export function PhaserGame(props: PhaserGameProps) {
|
||||||
};
|
};
|
||||||
const phaserGame = new Phaser.Game(config);
|
const phaserGame = new Phaser.Game(config);
|
||||||
|
|
||||||
// 添加 FadeScene
|
// 添加 FadeScene 并启动它来初始化 overlay
|
||||||
const fadeScene = new FadeSceneClass();
|
const fadeScene = new FadeSceneClass();
|
||||||
phaserGame.scene.add(FADE_SCENE_KEY, fadeScene, false);
|
phaserGame.scene.add(FADE_SCENE_KEY, fadeScene, true); // 改为 true 以触发 create
|
||||||
|
|
||||||
// 创建 SceneController
|
// 创建 SceneController
|
||||||
const currentScene = signal<string | null>(null);
|
const currentScene = signal<string | null>(null);
|
||||||
|
|
|
||||||
|
|
@ -81,16 +81,16 @@ export class MenuScene extends ReactiveScene {
|
||||||
const { button, colors } = MENU_CONFIG;
|
const { button, colors } = MENU_CONFIG;
|
||||||
|
|
||||||
this.startButtonBg = this.add.rectangle(
|
this.startButtonBg = this.add.rectangle(
|
||||||
center.x,
|
-button.width/2,
|
||||||
center.y + MENU_CONFIG.positions.buttonY,
|
-button.height/2,
|
||||||
button.width,
|
button.width,
|
||||||
button.height,
|
button.height,
|
||||||
colors.buttonBg
|
colors.buttonBg
|
||||||
).setInteractive({ useHandCursor: true });
|
).setOrigin(0.5).setInteractive({ useHandCursor: true });
|
||||||
|
|
||||||
this.startButtonText = this.add.text(
|
this.startButtonText = this.add.text(
|
||||||
center.x,
|
-button.width/2,
|
||||||
center.y + MENU_CONFIG.positions.buttonY,
|
-button.height/2,
|
||||||
'Start Game',
|
'Start Game',
|
||||||
{
|
{
|
||||||
fontSize: MENU_CONFIG.fontSize.button,
|
fontSize: MENU_CONFIG.fontSize.button,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue