fix: overlay init

This commit is contained in:
hyper 2026-04-12 18:11:23 +08:00
parent f6f18b4789
commit 6584578316
2 changed files with 7 additions and 7 deletions

View File

@ -49,9 +49,9 @@ export function PhaserGame(props: PhaserGameProps) {
};
const phaserGame = new Phaser.Game(config);
// 添加 FadeScene
// 添加 FadeScene 并启动它来初始化 overlay
const fadeScene = new FadeSceneClass();
phaserGame.scene.add(FADE_SCENE_KEY, fadeScene, false);
phaserGame.scene.add(FADE_SCENE_KEY, fadeScene, true); // 改为 true 以触发 create
// 创建 SceneController
const currentScene = signal<string | null>(null);

View File

@ -81,16 +81,16 @@ export class MenuScene extends ReactiveScene {
const { button, colors } = MENU_CONFIG;
this.startButtonBg = this.add.rectangle(
center.x,
center.y + MENU_CONFIG.positions.buttonY,
-button.width/2,
-button.height/2,
button.width,
button.height,
colors.buttonBg
).setInteractive({ useHandCursor: true });
).setOrigin(0.5).setInteractive({ useHandCursor: true });
this.startButtonText = this.add.text(
center.x,
center.y + MENU_CONFIG.positions.buttonY,
-button.width/2,
-button.height/2,
'Start Game',
{
fontSize: MENU_CONFIG.fontSize.button,