|
@@ -1128,6 +1128,11 @@ class MainScene extends Phaser.Scene {
|
|
|
this.sandiaGroup = null; // 置空引用
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+restartGame() {
|
|
|
+ this.resetScene();
|
|
|
+ this.scene.start("play");
|
|
|
+}
|
|
|
}
|
|
|
|
|
|
// 游戏场景
|
|
@@ -1698,7 +1703,16 @@ const getActiveScene = () => {
|
|
|
|
|
|
// 再次游戏
|
|
|
const getResumeGame = async () => {
|
|
|
-
|
|
|
+ const game = gameRef.value;
|
|
|
+ if (game) {
|
|
|
+ const mainScene = game.scene.getScene('main');
|
|
|
+ if (mainScene) {
|
|
|
+ mainScene.restartGame();
|
|
|
+ } else {
|
|
|
+ // 如果主场景未激活,直接启动游戏场景
|
|
|
+ game.scene.start('play');
|
|
|
+ }
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
onBeforeMount(() => {
|