瀏覽代碼

StartWaveUI

181404010226 5 月之前
父節點
當前提交
ff4fb87754

+ 9 - 9
assets/Scenes/GameLevel.scene

@@ -15569,14 +15569,14 @@
     "waveNumberLabelNode": {
       "__id__": 36
     },
-    "nextWaveUI": {
+    "startWaveUI": {
       "__id__": 410
     },
     "_id": "9amDpc1aVBv5cH9P2SGl05"
   },
   {
     "__type__": "cc.Node",
-    "_name": "NextWaveUI",
+    "_name": "startWaveUI",
     "_objFlags": 0,
     "__editorExtras__": {},
     "_parent": {
@@ -15773,7 +15773,7 @@
   },
   {
     "__type__": "cc.Node",
-    "_name": "NextLabel",
+    "_name": "startWave",
     "_objFlags": 0,
     "__editorExtras__": {},
     "_parent": {
@@ -15834,8 +15834,8 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 610.6278280709945,
-      "height": 50.4
+      "width": 392.4354452584945,
+      "height": 54.4
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -15864,7 +15864,7 @@
       "b": 255,
       "a": 255
     },
-    "_string": "下一波敌人即将来袭!!!",
+    "_string": "第1波敌人来袭!",
     "_horizontalAlign": 1,
     "_verticalAlign": 1,
     "_actualFontSize": 50,
@@ -15881,7 +15881,7 @@
     "_isUnderline": false,
     "_underlineHeight": 2,
     "_cacheMode": 0,
-    "_enableOutline": false,
+    "_enableOutline": true,
     "_outlineColor": {
       "__type__": "cc.Color",
       "r": 0,
@@ -18029,7 +18029,7 @@
         "__id__": 471
       }
     ],
-    "_active": true,
+    "_active": false,
     "_components": [
       {
         "__id__": 514
@@ -20532,7 +20532,7 @@
         "__id__": 631
       }
     ],
-    "_active": true,
+    "_active": false,
     "_components": [
       {
         "__id__": 683

+ 16 - 9
assets/scripts/CombatSystem/EnemyController.ts

@@ -95,9 +95,9 @@ export class EnemyController extends BaseSingleton {
 
     @property({
         type: Node,
-        tooltip: '下一波提示UI节点 (NextWaveUI)'
+        tooltip: '每波开始提示UI节点 (StartWaveUI)'
     })
-    public nextWaveUI: Node = null;
+    public startWaveUI: Node = null;
 
     private totalWaves: number = 1;
     private currentWave: number = 1;
@@ -146,8 +146,8 @@ export class EnemyController extends BaseSingleton {
         if (!this.waveNumberLabelNode) {
             this.waveNumberLabelNode = find('Canvas/GameLevelUI/WaveInfo/WaveNumber');
         }
-        if (!this.nextWaveUI) {
-            this.nextWaveUI = find('Canvas/GameLevelUI/NextWaveUI');
+        if (!this.startWaveUI) {
+            this.startWaveUI = find('Canvas/GameLevelUI/StartWaveUI') || find('Canvas/GameLevelUI/NextWaveUI');
         }
         // 初始化敌人数量显示
         this.updateEnemyCountLabel();
@@ -570,7 +570,7 @@ export class EnemyController extends BaseSingleton {
         this.currentWaveEnemiesKilled = 0;
         this.updateWaveLabel();
         this.updateEnemyCountLabel();
-        if (this.nextWaveUI) this.nextWaveUI.active = false;
+        if (this.startWaveUI) this.startWaveUI.active = false;
     }
 
     private updateWaveLabel() {
@@ -581,13 +581,20 @@ export class EnemyController extends BaseSingleton {
         }
     }
 
-    public showNextWavePromptUI(duration: number = 2) {
-        if (!this.nextWaveUI) return;
-        this.nextWaveUI.active = true;
+    /** 显示每波开始提示,随后开启敌人生成 */
+    public showStartWavePromptUI(duration: number = 2) {
+        if (!this.startWaveUI) return;
+        this.startWaveUI.active = true;
+        // 暂停生成(确保未重复)
+        this.pauseSpawning();
         if (duration > 0) {
             this.scheduleOnce(() => {
-                if (this.nextWaveUI) this.nextWaveUI.active = false;
+                if (this.startWaveUI) this.startWaveUI.active = false;
+                // 真正开始/恢复生成敌人
+                this.startGame();
             }, duration);
+        } else {
+            this.startGame();
         }
     }
 } 

+ 17 - 6
assets/scripts/LevelSystem/GameManager.ts

@@ -127,6 +127,14 @@ export class GameManager extends Component {
         
         // 初始化管理器
         this.initializeManagers();
+
+        // 提前初始化本局数据,确保 BlockManager 在 start 时能拿到正确金币
+        if (!LevelSessionManager.inst.runtime) {
+            LevelSessionManager.inst.initialize(
+                this.saveDataManager?.getCurrentLevel() || 1,
+                this.wallHealth
+            );
+        }
         
         // 计算游戏区域边界
         this.calculateGameBounds();
@@ -730,7 +738,7 @@ export class GameManager extends Component {
         this.gameStartTime = Date.now();
         this.currentState = GameState.PLAYING;
         
-        // 开始敌人生成
+        // 开始生成
         this.spawnBall();
         
         // 启动状态检查
@@ -738,9 +746,12 @@ export class GameManager extends Component {
         
         // 设置UI按钮事件
         this.setupUIButtons();
-        
-        // 开始生成敌人
-        this.forceStartEnemySpawning();
+        // 第一波提示UI后再开始生成敌人
+        if (this.enemyController && this.enemyController.showStartWavePromptUI) {
+            this.enemyController.showStartWavePromptUI();
+        } else {
+            this.forceStartEnemySpawning();
+        }
 
         LevelSessionManager.inst.initialize(
             SaveDataManager.getInstance().getCurrentLevel(),
@@ -1052,8 +1063,8 @@ export class GameManager extends Component {
 
     /** 显示下一波提示并在短暂延迟后开始下一波 */
     private showNextWavePrompt() {
-        if (this.enemyController) {
-            this.enemyController.showNextWavePromptUI();
+        if (this.enemyController && this.enemyController.showStartWavePromptUI) {
+            this.enemyController.showStartWavePromptUI();
         }
         // 2 秒后开始下一波
         this.scheduleOnce(() => {