Browse Source

音效完成

181404010226 3 months ago
parent
commit
aed43cdac3

+ 4 - 4
assets/resources/prefabs/Upgrade/Unlock.prefab

@@ -351,7 +351,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": 28.5,
+      "y": 19.369,
       "z": 0
     },
     "_lrot": {
@@ -363,8 +363,8 @@
     },
     "_lscale": {
       "__type__": "cc.Vec3",
-      "x": 1,
-      "y": 1,
+      "x": 0.8,
+      "y": 0.8,
       "z": 1
     },
     "_mobility": 0,
@@ -464,7 +464,7 @@
     "_left": 0,
     "_right": 0,
     "_top": 0,
-    "_bottom": 72.5,
+    "_bottom": 79.869,
     "_horizontalCenter": 0,
     "_verticalCenter": 0,
     "_isAbsLeft": true,

+ 3 - 0
assets/scripts/CombatSystem/BlockSelection/GameBlockSelection.ts

@@ -361,6 +361,9 @@ export class GameBlockSelection extends Component {
             return;
         }
         
+        // 播放UI音效
+        Audio.playUISound('data/弹球音效/ui play');
+        
         // 保存已放置的方块
         this.preservePlacedBlocks();
         

+ 7 - 7
assets/scripts/CombatSystem/GameEnd.ts

@@ -305,13 +305,17 @@ export class GameEnd extends Component {
             console.log('[GameEnd] 已将游戏状态切换为SUCCESS');
         }
         
-        // 2. 设置EndLabel文本
+        // 2. 播放游戏成功音效
+        Audio.playUISound('data/弹球音效/win');
+        console.log('[GameEnd] 已播放游戏成功音效');
+        
+        // 3. 设置EndLabel文本
         this.setEndLabelText('SUCCESS');
         
-        // 3. 显示UI面板
+        // 4. 显示UI面板
         this.showEndPanelWithAnimation();
         
-        // 4. 计算和显示奖励
+        // 5. 计算和显示奖励
         this.isGameSuccess = true;
         this.calculateAndShowRewards();
     }
@@ -322,10 +326,6 @@ export class GameEnd extends Component {
      */
     private onGameDefeat() {
         console.log('[GameEnd] 接收到GAME_DEFEAT事件');
-        console.log('[GameEnd] 游戏失败,开始统一处理流程');
-        console.log('[GameEnd] 当前节点激活状态:', this.node.active);
-        console.log('[GameEnd] moneyLabel绑定状态:', !!this.moneyLabel);
-        console.log('[GameEnd] diamondLabel绑定状态:', !!this.diamondLabel);
         
         // 1. 设置游戏状态为失败(如果还未设置)
         if (this.inGameManager && this.inGameManager.getCurrentState() !== GameState.DEFEAT) {

+ 22 - 2
assets/scripts/FourUI/MainSystem/MainUIControlller.ts

@@ -53,6 +53,9 @@ export class MainUIController extends Component {
     // TopArea 默认隐藏,在点击战斗后再显示
     if (this.topArea) this.topArea.active = false;
     
+    // 播放主界面背景音乐
+    this.playMainUIBGM();
+    
     console.log('[MainUIController] onLoad 执行完成');
   }
 
@@ -153,8 +156,11 @@ export class MainUIController extends Component {
   }
 
   private onBattle () {
-    // 播放UI点击音效
-    Audio.playUISound('data/弹球音效/ui play');
+    // 播放游戏开始音效
+    Audio.playUISound('data/弹球音效/start zombie');
+    console.log('[MainUIController] 播放游戏开始音效');
+    // 停止主界面背景音乐,避免与游戏内音效冲突
+    Audio.stopMusic();
     // 显示 TopArea(拖拽引用),避免使用 find()
     if (this.topArea) this.topArea.active = true;
 
@@ -329,6 +335,8 @@ export class MainUIController extends Component {
       console.log('NavBar 已显示');
     }
     
+    // 播放主界面背景音乐
+    this.playMainUIBGM();
 
     // 刷新UI显示
     this.refreshAll();
@@ -399,6 +407,18 @@ export class MainUIController extends Component {
   
 
   
+  /**
+   * 播放主界面背景音乐
+   */
+  private playMainUIBGM(): void {
+    console.log('[MainUIController] 开始播放主界面背景音乐');
+    
+    // 播放主界面BGM,循环播放
+    Audio.playMusic('data/弹球音效/ui bgm', true);
+    
+    console.log('[MainUIController] 主界面背景音乐播放完成');
+  }
+
   /* =============== Util =============== */
   private format(n:number){ return n>=1000000? (n/1e6).toFixed(1)+'M' : n>=1000? (n/1e3).toFixed(1)+'K' : n.toString(); }
 }

+ 6 - 0
assets/scripts/FourUI/NavBarController.ts

@@ -172,6 +172,12 @@ export class NavBarController extends Component {
         // 显示对应面板
         this.panels.forEach((p, i) => p.active = i === index);
 
+        // 当切换到主界面时播放背景音乐
+        if (index === 0) {
+            console.log('[NavBarController] 切换到主界面,播放背景音乐');
+            Audio.playMusic('data/弹球音效/ui bgm', true);
+        }
+
         // 按钮索引到面板索引的映射:根据实际的点击事件调用
         // 按钮索引: [0:Battle, 1:Shop, 2:Upgrade, 3:Skill]
         // 面板索引: [0:Main, 1:Shop, 2:Upgrade, 3:Skill]

+ 1 - 3
assets/scripts/LevelSystem/GameManager.ts

@@ -602,9 +602,7 @@ export class GameManager extends Component {
         this.gameStarted = true;
         this.gameStartTime = Date.now();
         // 游戏状态管理已迁移到 InGameManager
-        
-
-        
+    
         // 发送游戏开始事件,通知其他组件
         const eventBus = EventBus.getInstance();
         eventBus.emit(GameEvents.GAME_START);