소스 검색

方块选择ui优化

181404010226 4 달 전
부모
커밋
f4673780f5

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 264 - 197
assets/Scenes/GameLevel.scene


+ 74 - 129
assets/scripts/Animations/GameStartMove.ts

@@ -33,6 +33,15 @@ export class GameStartMove extends Component {
     public moveDuration: number = 0.4;
 
     private _originalPos: Vec3 = new Vec3();
+
+    /** 需要下滑的 diban 节点(外部拖拽赋值) */
+    @property({ type: Node, tooltip: 'diban 节点' })
+    public dibanNode: Node = null;
+
+    /** Gray遮罩节点 */
+    @property({ type: Node, tooltip: 'Canvas/GameLevelUI/Gray节点' })
+    public grayNode: Node = null;
+
     private _originalDibanPos: Vec3 = new Vec3();
 
     onLoad () {
@@ -43,7 +52,7 @@ export class GameStartMove extends Component {
         // Save initial position so we can always restore relative to it.
         this._originalPos.set(this.cameraNode.position);
         
-        // Save diban original position if available
+        // Save diban original position if dibanNode is assigned
         if (this.dibanNode) {
             this._originalDibanPos.set(this.dibanNode.position);
         }
@@ -57,6 +66,11 @@ export class GameStartMove extends Component {
         const pos = this.cameraNode.position.clone();
         pos.y -= this.offset;
         this.cameraNode.setPosition(pos);
+        console.log('GameStartMove.moveDownInstant 镜头下移,当前位置:', pos);
+        // 镜头下移时显示Gray遮罩
+        if (this.grayNode) {
+            this.grayNode.active = true;
+        }
     }
 
     /**
@@ -67,173 +81,104 @@ export class GameStartMove extends Component {
         const startPos = this.cameraNode.position.clone();
         const targetPos = new Vec3(startPos.x, startPos.y + this.offset, startPos.z);
         // Stop any running tweens on this node to avoid conflicting animations.
+        console.log('GameStartMove.moveUpSmooth 镜头上移,开始执行');
         Tween.stopAllByTarget(this.cameraNode);
         tween(this.cameraNode)
             .to(this.moveDuration, { position: targetPos }, { easing: 'quadOut' })
             .start();
     }
 
-    /* ========= BlockSelectionUI 动画 ========= */
-    /** BlockSelectionUI 根节点(外部在编辑器拖拽赋值) */
-    @property({ type: Node, tooltip: 'BlockSelectionUI 根节点' })
-    public blockSelectionUI: Node = null;
-
-    /** BlockSelectionUI 中需要下滑的 diban 节点(外部拖拽赋值) */
-    @property({ type: Node, tooltip: 'BlockSelectionUI 中的 diban 节点' })
-    public dibanNode: Node = null;
-
-    /**
-     * 下滑 diban 并在动画结束后隐藏 BlockSelectionUI。
-     * @param distance 向下移动距离,默认 300
-     * @param duration 动画时长,默认 0.3s
-     */
-    public slideDibanDownAndHide(distance: number = 300, duration: number = 0.3) {
-        console.log('GameStartMove.slideDibanDownAndHide 开始执行');
-        
-        if (!this.dibanNode || !this.blockSelectionUI) {
-            console.log('GameStartMove.slideDibanDownAndHide 条件检查失败:', {
-                dibanNode: !!this.dibanNode,
-                blockSelectionUI: !!this.blockSelectionUI
-            });
-            return;
-        }
-
-        // 使用存储的原始位置,如果没有存储则使用当前位置
-        let originalPos: Vec3;
-        if (this._originalDibanPos.equals(Vec3.ZERO)) {
-            // 如果没有存储原始位置,使用当前位置并存储它
-            originalPos = this.dibanNode.position.clone();
-            this._originalDibanPos = originalPos.clone();
-            console.log('GameStartMove.slideDibanDownAndHide 首次使用,存储原始位置:', this._originalDibanPos);
-        } else {
-            // 使用存储的原始位置
-            originalPos = this._originalDibanPos.clone();
-            console.log('GameStartMove.slideDibanDownAndHide 使用存储的原始位置:', originalPos);
-        }
 
-        // 获取当前位置作为动画起始位置
-        const currentPos = this.dibanNode.position.clone();
-        console.log('GameStartMove.slideDibanDownAndHide 当前位置:', currentPos);
 
-        // 停止现有 tween
-        Tween.stopAllByTarget(this.dibanNode);
 
-        const targetPos = new Vec3(currentPos.x, currentPos.y - distance, currentPos.z);
-        console.log('GameStartMove.slideDibanDownAndHide 目标位置:', targetPos);
 
-        tween(this.dibanNode)
-            .to(duration, { position: targetPos }, { easing: 'quadIn' })
-            .call(() => {
-                console.log('GameStartMove.slideDibanDownAndHide 动画完成回调');
-                // 先隐藏BlockSelectionUI,然后立即重置diban位置到存储的原始位置
-                // 这样用户就看不到位置重置的过程
-                this.blockSelectionUI.active = false;
-                this.dibanNode.setPosition(originalPos);
-                console.log('GameStartMove.slideDibanDownAndHide UI已隐藏,位置已重置到:', originalPos);
-            })
-            .start();
-            
-        console.log('GameStartMove.slideDibanDownAndHide 动画已启动');
-    }
+    /* ========= 高级动画方法 ========= */
 
     /**
-     * 从底部上滑显示 diban
-     * @param distance 从下方移动的距离,默认 300
+     * 上滑 diban节点,进入备战状态。同时镜头下移。
+     * @param distance 向上移动距离,默认 300
      * @param duration 动画时长,默认 0.3s
      */
     public slideUpFromBottom(distance: number = 300, duration: number = 0.3) {
         console.log('GameStartMove.slideUpFromBottom 开始执行');
         
-        if (!this.dibanNode || !this.blockSelectionUI) {
-            console.log('GameStartMove.slideUpFromBottom 条件检查失败:', {
-                dibanNode: !!this.dibanNode,
-                blockSelectionUI: !!this.blockSelectionUI
-            });
+        // 使用装饰器属性中的diban节点
+        if (!this.dibanNode) {
+            console.warn('GameStartMove.slideUpFromBottom diban节点未设置');
             return;
         }
-
-        // BlockSelectionUI现在默认就是可见状态,无需手动设置
-        // this.blockSelectionUI.active = true; // 已移除,因为UI默认激活
-
-        // 使用存储的原始位置作为目标位置
-        let targetPos: Vec3;
+        
+        // 保存diban的原始位置(如果还没保存的话)
         if (this._originalDibanPos.equals(Vec3.ZERO)) {
-            // 如果没有存储原始位置,使用当前位置并存储它
-            targetPos = this.dibanNode.position.clone();
-            this._originalDibanPos = targetPos.clone();
-            console.log('GameStartMove.slideUpFromBottom 首次使用,存储原始位置:', this._originalDibanPos);
-        } else {
-            // 使用存储的原始位置
-            targetPos = this._originalDibanPos.clone();
-            console.log('GameStartMove.slideUpFromBottom 使用存储的原始位置:', targetPos);
+            this._originalDibanPos.set(this.dibanNode.position);
         }
         
-        // 设置初始位置(在目标位置下方)
-        const startPos = new Vec3(targetPos.x, targetPos.y - distance, targetPos.z);
+        // 设置diban初始位置(在屏幕下方)
+        const startPos = this._originalDibanPos.clone();
+        startPos.y -= distance;
         this.dibanNode.setPosition(startPos);
-        console.log('GameStartMove.slideUpFromBottom 起始位置:', startPos);
-
-        // 停止现有 tween
+        
+        console.log('GameStartMove.slideUpFromBottom diban初始位置:', startPos);
+        console.log('GameStartMove.slideUpFromBottom diban目标位置:', this._originalDibanPos);
+        
+        // 停止任何正在运行的动画
         Tween.stopAllByTarget(this.dibanNode);
-
-        // 播放上滑动画到目标位置
+        
+        // 执行上滑动画
         tween(this.dibanNode)
-            .to(duration, { position: targetPos }, { easing: 'quadOut' })
+            .to(duration, { position: this._originalDibanPos }, { easing: 'quadOut' })
             .call(() => {
-                console.log('GameStartMove.slideUpFromBottom 动画完成');
+                console.log('GameStartMove.slideUpFromBottom diban上滑动画完成');
             })
             .start();
             
-        console.log('GameStartMove.slideUpFromBottom 动画已启动');
+        // 同时执行camera下移动画
+        this.moveDownInstant();
+        
+        console.log('GameStartMove.slideUpFromBottom diban上滑动画已启动');
     }
 
     /**
-     * 更新保存的diban原始位置(当diban节点在运行时改变时调用)
+     * 下滑 diban节点,结束备战进入playing 状态。
+     * @param distance 向下移动距离,默认 300
+     * @param duration 动画时长,默认 0.3s
      */
-    public updateDibanOriginalPosition() {
-        if (this.dibanNode) {
-            this._originalDibanPos.set(this.dibanNode.position);
-            console.log('GameStartMove.updateDibanOriginalPosition 存储原始位置:', this._originalDibanPos);
-        } else {
-            console.log('GameStartMove.updateDibanOriginalPosition dibanNode为空,无法存储位置');
+    public slideDibanDownAndHide(distance: number = 300, duration: number = 0.3) {
+        console.log('GameStartMove.slideDibanDownAndHide 开始执行');
+        
+        // 使用装饰器属性中的diban节点
+        if (!this.dibanNode) {
+            console.warn('GameStartMove.slideDibanDownAndHide diban节点未设置');
+            return;
         }
-    }
-
-    /* ========= 高级动画方法 ========= */
-    
-    /**
-     * 进入方块选择模式的完整动画
-     * 包含摄像机下移和UI上滑入场
-     * @param distance UI移动距离,默认 300
-     * @param duration UI动画时长,默认 0.3s
-     */
-    public enterBlockSelectionMode(distance: number = 300, duration: number = 0.3) {
-        console.log('GameStartMove.enterBlockSelectionMode 开始执行进入方块选择模式动画');
         
-        // 摄像机瞬间下移
-        //this.moveDownInstant();
+        // 获取当前位置
+        const currentPos = this.dibanNode.position.clone();
+        console.log('GameStartMove.slideDibanDownAndHide diban当前位置:', currentPos);
         
-        // 方块选择UI从底部上滑入场
-        //this.slideUpFromBottom(distance, duration);
+        // 计算目标位置(向下移动)
+        const targetPos = new Vec3(currentPos.x, currentPos.y - distance, currentPos.z);
+        console.log('GameStartMove.slideDibanDownAndHide diban目标位置:', targetPos);
         
-        console.log('GameStartMove.enterBlockSelectionMode 动画已启动');
-    }
-    
-    /**
-     * 退出方块选择模式的完整动画
-     * 包含摄像机上移和UI下滑隐藏
-     * @param distance UI移动距离,默认 300
-     * @param duration UI动画时长,默认 0.3s
-     */
-    public exitBlockSelectionMode(distance: number = 300, duration: number = 0.3) {
-        console.log('GameStartMove.exitBlockSelectionMode 开始执行退出方块选择模式动画');
+        // 停止任何正在运行的动画
+        Tween.stopAllByTarget(this.dibanNode);
         
-        // 摄像机平滑上移
+        // 执行下滑动画
+        tween(this.dibanNode)
+            .to(duration, { position: targetPos }, { easing: 'quadOut' })
+            .call(() => {
+                console.log('GameStartMove.slideDibanDownAndHide diban下滑动画完成');
+                // 动画完成时隐藏Gray遮罩
+                if (this.grayNode) {
+                    this.grayNode.active = false;
+                }
+            })
+            .start();
+            
+        // 同时执行camera上移动画
         this.moveUpSmooth();
         
-        // 方块选择UI下滑并隐藏
-        this.slideDibanDownAndHide(distance, duration);
-        
-        console.log('GameStartMove.exitBlockSelectionMode 动画已启动');
+        console.log('GameStartMove.slideDibanDownAndHide diban下滑动画已启动');
     }
+
 }

+ 52 - 195
assets/scripts/CombatSystem/BlockSelection/GameBlockSelection.ts

@@ -1,8 +1,7 @@
-import { _decorator, Component, Node, Button, Label, find, UITransform, Sprite, Color, tween, Tween, Prefab, instantiate } from 'cc';
+import { _decorator, Component, Node, Button, Label, find, UITransform, Sprite, Color, Prefab, instantiate, Vec3 } from 'cc';
 import { LevelSessionManager } from '../../Core/LevelSessionManager';
 import { BallController } from '../BallController';
 import { BlockManager } from '../BlockManager';
-import { GameStartMove } from '../../Animations/GameStartMove';
 
 import { BlockTag } from './BlockTag';
 import { SkillManager } from '../SkillSelection/SkillManager';
@@ -15,19 +14,19 @@ export class GameBlockSelection extends Component {
     
     @property({
         type: Node,
-        tooltip: '拖拽BlockSelectionUI/diban/ann001按钮节点到这里'
+        tooltip: '拖拽diban/ann001按钮节点到这里'
     })
     public addBallButton: Node = null;
 
     @property({
         type: Node,
-        tooltip: '拖拽BlockSelectionUI/diban/ann002按钮节点到这里'
+        tooltip: '拖拽diban/ann002按钮节点到这里'
     })
     public addCoinButton: Node = null;
 
     @property({
         type: Node,
-        tooltip: '拖拽BlockSelectionUI/diban/ann003按钮节点到这里'
+        tooltip: '拖拽diban/ann003按钮节点到这里'
     })
     public refreshButton: Node = null;
 
@@ -55,12 +54,6 @@ export class GameBlockSelection extends Component {
     })
     public blockManagerNode: Node = null;
 
-    @property({
-        type: Node,
-        tooltip: '拖拽Canvas/Camera节点到这里'
-    })
-    public cameraNode: Node = null;
-
     @property({
         type: Node,
         tooltip: '拖拽Canvas/GameLevelUI/GameArea/GridContainer节点到这里'
@@ -75,15 +68,15 @@ export class GameBlockSelection extends Component {
 
     @property({
         type: Node,
-        tooltip: '拖拽BlockSelectionUI根节点到这里'
+        tooltip: '拖拽Canvas/GameLevelUI/InGameManager节点到这里'
     })
-    public blockSelectionUINode: Node = null;
+    public inGameManagerNode: Node = null;
 
     @property({
         type: Node,
-        tooltip: '拖拽BlockSelectionUI/diban节点到这里'
+        tooltip: '拖拽Canvas/Camera节点到这里'
     })
-    public dibanNode: Node = null;
+    public cameraNode: Node = null;
 
     // 按钮费用配置
     private readonly ADD_BALL_COST = 80;
@@ -93,7 +86,6 @@ export class GameBlockSelection extends Component {
     private session: LevelSessionManager = null;
     private ballController: BallController = null;
     private blockManager: BlockManager = null;
-    private gameStartMove: GameStartMove = null;
 
     // 回调函数,用于通知GameManager
     public onConfirmCallback: () => void = null;
@@ -128,21 +120,7 @@ export class GameBlockSelection extends Component {
         // 获取管理器实例
         this.session = LevelSessionManager.inst;
         
-        // 如果组件挂载在BlockSelectionUI节点上,则将该节点设为blockSelectionUINode
-        if (!this.blockSelectionUINode && this.node.name === 'BlockSelectionUI') {
-            this.blockSelectionUINode = this.node;
-            console.log('[GameBlockSelection] 组件挂载在BlockSelectionUI节点上,设置为blockSelectionUINode:', this.blockSelectionUINode.name);
-        }
-        
-        // 如果dibanNode未绑定,尝试在当前节点下查找
-        if (!this.dibanNode && this.blockSelectionUINode) {
-            this.dibanNode = this.blockSelectionUINode.getChildByName('diban');
-            if (this.dibanNode) {
-                console.log('[GameBlockSelection] 找到diban节点:', this.dibanNode.name);
-            } else {
-                console.error('[GameBlockSelection] 无法找到diban节点');
-            }
-        }
+
         
         // 获取BallController
         if (this.ballControllerNode) {
@@ -158,33 +136,7 @@ export class GameBlockSelection extends Component {
             console.warn('BlockManager节点未绑定,请在Inspector中拖拽Canvas/GameLevelUI/BlockController节点');
         }
 
-        // 获取GameStartMove组件
-        if (this.cameraNode) {
-            this.gameStartMove = this.cameraNode.getComponent(GameStartMove);
-            console.log('GameStartMove组件获取结果:', !!this.gameStartMove);
-            
-            // 如果GameStartMove存在,设置BlockSelectionUI和diban引用,并更新原始位置
-            if (this.gameStartMove && this.blockSelectionUINode && this.dibanNode) {
-                this.gameStartMove.blockSelectionUI = this.blockSelectionUINode;
-                this.gameStartMove.dibanNode = this.dibanNode;
-                this.gameStartMove.updateDibanOriginalPosition();
-                
-                console.log('GameStartMove引用设置完成:', {
-                    blockSelectionUISet: !!this.gameStartMove.blockSelectionUI,
-                    dibanNodeSet: !!this.gameStartMove.dibanNode,
-                    blockSelectionUINodeName: this.blockSelectionUINode.name,
-                    dibanNodeName: this.dibanNode.name
-                });
-            } else {
-                console.warn('GameStartMove引用设置失败:', {
-                    gameStartMove: !!this.gameStartMove,
-                    blockSelectionUINode: !!this.blockSelectionUINode,
-                    dibanNode: !!this.dibanNode
-                });
-            }
-        } else {
-            console.warn('Camera节点未绑定,请在Inspector中拖拽Canvas/Camera节点');
-        }
+
 
         // 如果没有指定coinLabelNode,尝试找到它
         if (!this.coinLabelNode) {
@@ -217,8 +169,7 @@ export class GameBlockSelection extends Component {
         console.log('[GameBlockSelection] RESET_BLOCK_SELECTION事件监听器已设置');
         
         // 监听显示方块选择事件
-        eventBus.on(GameEvents.SHOW_BLOCK_SELECTION, this.onShowBlockSelectionEvent, this);
-        console.log('[GameBlockSelection] SHOW_BLOCK_SELECTION事件监听器已设置');
+
         
         // 监听游戏开始事件,用于标记可以开始生成方块
         eventBus.on(GameEvents.GAME_START, this.onGameStartEvent, this);
@@ -234,14 +185,7 @@ export class GameBlockSelection extends Component {
         this.resetSelection();
     }
     
-    // 处理显示方块选择事件
-    private onShowBlockSelectionEvent() {
-        console.log('[GameBlockSelection] ===== 接收到显示方块选择事件 =====');
-        console.log('[GameBlockSelection] 当前组件节点:', this.node.name, '状态:', this.node.active);
-        console.log('[GameBlockSelection] blockSelectionUINode:', this.blockSelectionUINode?.name, '状态:', this.blockSelectionUINode?.active);
-        this.showBlockSelection(true); // false表示不是下一波,而是游戏开始
-        console.log('[GameBlockSelection] ===== 显示方块选择事件处理完成 =====');
-    }
+
     
     // 处理游戏开始事件
     private onGameStartEvent() {
@@ -369,7 +313,7 @@ export class GameBlockSelection extends Component {
         }
     }
 
-    // 确认按钮点击(从GameManager迁移的onConfirmButtonClicked)
+    // 确认按钮点击
     public onConfirmButtonClicked() {
         // 检查是否有上阵方块
         const hasBlocks = this.hasPlacedBlocks();
@@ -382,14 +326,42 @@ export class GameBlockSelection extends Component {
         
         // 保存已放置的方块
         this.preservePlacedBlocks();
+        
+        // 清理kuang区域的方块(用户期望的行为)
+        if (this.blockManager) {
+            this.blockManager.clearBlocks();
+            console.log('[GameBlockSelection] 已清理kuang区域的方块');
+        }
 
         // 先回调通知GameManager,让它处理波次逻辑
         if (this.onConfirmCallback) {
             this.onConfirmCallback();
         }
         
-        // 然后隐藏UI并恢复游戏
-        this.hideBlockSelection();
+        // 播放下滑diban动画,结束备战进入playing状态
+        this.playDibanSlideDownAnimation();
+    }
+    
+    // 播放diban下滑动画
+    private playDibanSlideDownAnimation() {
+        console.log('[GameBlockSelection] 开始播放diban下滑动画');
+        
+        // 使用装饰器属性获取Camera节点上的GameStartMove组件
+        if (!this.cameraNode) {
+            console.warn('[GameBlockSelection] Camera节点未设置,请在Inspector中拖拽Canvas/Camera节点');
+            return;
+        }
+        
+        const gameStartMove = this.cameraNode.getComponent('GameStartMove');
+        if (!gameStartMove) {
+            console.warn('[GameBlockSelection] GameStartMove组件未找到');
+            return;
+        }
+        
+        // 调用GameStartMove的下滑动画方法
+        (gameStartMove as any).slideDibanDownAndHide(300, 0.3);
+        
+        console.log('[GameBlockSelection] 已调用GameStartMove的diban下滑动画');
     }
 
     // 保存已放置的方块(从GameManager迁移)
@@ -467,142 +439,27 @@ export class GameBlockSelection extends Component {
 
     // === 公共方法:供GameManager调用 ===
 
-    // 显示方块选择UI(用于游戏开始或下一波)
-    public showBlockSelection(isNextWave: boolean = false) {
-        console.log('[GameBlockSelection] showBlockSelection开始执行');
-        console.log('[GameBlockSelection] 节点状态检查:', {
-            node: !!this.node,
-            nodeActive: this.node?.active,
-            nodeName: this.node?.name,
-            gridContainer: !!this.gridContainer,
-            gridContainerActive: this.gridContainer?.active,
-            blockSelectionUINode: !!this.blockSelectionUINode,
-            blockSelectionUINodeActive: this.blockSelectionUINode?.active,
-            blockSelectionUINodeName: this.blockSelectionUINode?.name
-        });
-        
-        // 通过事件系统暂停游戏
-        const eventBus = EventBus.getInstance();
-        eventBus.emit(GameEvents.GAME_PAUSE);
-        console.log('[GameBlockSelection] 显示方块选择UI,确保游戏暂停');
+    // 生成方块选择(不再控制UI显示,只负责生成方块)
+    public generateBlockSelection() {
+        console.log('[GameBlockSelection] generateBlockSelection开始执行');
         
-        // BlockSelectionUI节点现在默认就是激活状态,无需手动设置
-        // 只需要确认节点状态用于调试
-        if (this.blockSelectionUINode) {
-            console.log('[GameBlockSelection] BlockSelectionUI节点状态:', this.blockSelectionUINode.active, this.blockSelectionUINode.name);
-        } else {
-            console.log('[GameBlockSelection] 组件节点状态:', this.node.active, this.node.name);
-        }
-        
-        if (this.gridContainer) {
-            this.gridContainer.active = true;
-            console.log('[GameBlockSelection] gridContainer已激活:', this.gridContainer.active);
-        } else {
-            console.warn('[GameBlockSelection] gridContainer未找到');
-        }
-
-        // 只有在onBattle触发后才生成方块
-        if (this.shouldGenerateBlocks && this.blockManager) {
+        // 直接生成方块,不再依赖shouldGenerateBlocks标志
+        if (this.blockManager) {
             this.blockManager.refreshBlocks();
             console.log('[GameBlockSelection] 生成新的随机方块');
-        } else if (!this.shouldGenerateBlocks) {
-            console.log('[GameBlockSelection] 等待onBattle触发后才生成方块');
         } else {
             console.warn('[GameBlockSelection] BlockManager未找到,无法生成随机方块');
         }
 
-        // 播放BlockSelectionUI出现动画
-        console.log('[GameBlockSelection] 准备播放显示动画');
-        this.playShowAnimation();
-
         // 触发进入备战状态事件
         EventBus.getInstance().emit(GameEvents.ENTER_BATTLE_PREPARATION);
-
-        // 派发事件
-        EventBus.getInstance().emit(GameEvents.BLOCK_SELECTION_OPEN);
-
-        console.log(`[GameBlockSelection] ${isNextWave ? '显示下一波方块选择UI' : '显示游戏开始方块选择UI'} 完成`);
+        
+        console.log('[GameBlockSelection] 方块生成完成');
     }
 
-    // 隐藏方块选择UI
-    public hideBlockSelection() {
-        // 播放隐藏动画,动画完成后隐藏UI
-        this.playHideAnimation(() => {
-            this.node.active = false;
-            
-            // 派发事件
-            EventBus.getInstance().emit(GameEvents.BLOCK_SELECTION_CLOSE);
-            
-            // 发送游戏开始事件,确保GamePause正确设置isInGameMode状态
-            console.log('[GameBlockSelection] 隐藏方块选择UI、发送游戏开始事件');
-            EventBus.getInstance().emit(GameEvents.GAME_START);
-            
-            // 通过事件系统恢复游戏状态
-            console.log('[GameBlockSelection] 恢复游戏状态');
-            EventBus.getInstance().emit(GameEvents.GAME_RESUME);
-            
-            // 移除这里的波次提示调用,让GameManager统一控制波次提示的显示时机
-            // 显示波次提示Toast并开始敌人生成
-            // const enemyController = EnemyController.getInstance();
-            // if (enemyController) {
-            //     enemyController.showStartWavePromptUI(2); // 显示2秒Toast提示
-            // }
-        });
-    }
+   
 
-    // 播放显示动画
-    private playShowAnimation() {
-        console.log('播放显示动画playShowAnimation');
-        if (this.gameStartMove && this.blockSelectionUINode && this.dibanNode) {
-            // 设置GameStartMove的blockSelectionUI和dibanNode引用
-            this.gameStartMove.blockSelectionUI = this.blockSelectionUINode;
-            this.gameStartMove.dibanNode = this.dibanNode;
-            
-            // 使用GameStartMove的进入方块选择模式动画
-            this.gameStartMove.enterBlockSelectionMode(300, 0.3);
-            console.log('进入方块选择模式动画已启动');
-        }
-    }
 
-    // 播放隐藏动画
-    private playHideAnimation(onComplete?: () => void) {
-        console.log('播放隐藏动画playHideAnimation');
-        console.log('GameBlockSelection 引用检查:', {
-            gameStartMove: !!this.gameStartMove,
-            blockSelectionUINode: !!this.blockSelectionUINode,
-            dibanNode: !!this.dibanNode,
-            blockSelectionUINodeName: this.blockSelectionUINode?.name,
-            dibanNodeName: this.dibanNode?.name
-        });
-        
-        if (this.gameStartMove && this.blockSelectionUINode && this.dibanNode) {
-            // 设置GameStartMove的blockSelectionUI和dibanNode引用
-            this.gameStartMove.blockSelectionUI = this.blockSelectionUINode;
-            this.gameStartMove.dibanNode = this.dibanNode;
-            
-            console.log('GameStartMove 引用设置后检查:', {
-                gameStartMoveBlockSelectionUI: !!this.gameStartMove.blockSelectionUI,
-                gameStartMoveDibanNode: !!this.gameStartMove.dibanNode
-            });
-            
-            // 使用GameStartMove的退出方块选择模式动画
-            this.gameStartMove.exitBlockSelectionMode(300, 0.3);
-            console.log('退出方块选择模式动画已启动');
-            
-            // 由于slideDibanDownAndHide会自动隐藏blockSelectionUI和重置位置,我们需要在动画完成后执行回调
-            if (onComplete) {
-                this.scheduleOnce(() => {
-                    onComplete();
-                }, 0.3); // 与动画时长一致
-            }
-        } else {
-            console.log('GameBlockSelection 条件检查失败,无法播放动画');
-            if (onComplete) {
-                // 如果没有动画组件,直接执行回调
-                onComplete();
-            }
-        }
-    }
 
     // 设置确认回调
     public setConfirmCallback(callback: () => void) {
@@ -701,7 +558,7 @@ export class GameBlockSelection extends Component {
         // 清理事件监听
         const eventBus = EventBus.getInstance();
         eventBus.off(GameEvents.RESET_BLOCK_SELECTION, this.onResetBlockSelectionEvent, this);
-        eventBus.off(GameEvents.SHOW_BLOCK_SELECTION, this.onShowBlockSelectionEvent, this);
+
         eventBus.off(GameEvents.GAME_START, this.onGameStartEvent, this);
     }
 }

+ 1 - 9
assets/scripts/CombatSystem/GamePause.ts

@@ -40,7 +40,6 @@ export class GamePause extends Component {
         
         // 监听游戏开始和结束事件来更新游戏模式状态
         eventBus.on(GameEvents.GAME_START, this.onGameStartEvent, this);
-        eventBus.on(GameEvents.SHOW_BLOCK_SELECTION, this.onShowBlockSelectionEvent, this);
         
         // 监听子弹发射检查事件
         eventBus.on(GameEvents.BALL_FIRE_BULLET, this.onBallFireBulletEvent, this);
@@ -76,13 +75,7 @@ export class GamePause extends Component {
         this.isInGameMode = false;
     }
     
-    /**
-     * 处理显示方块选择事件
-     */
-    private onShowBlockSelectionEvent() {
-        console.log('[GamePause] 接收到显示方块选择事件,进入方块选择模式');
-        this.isInGameMode = false; // 方块选择时不在游戏模式中
-    }
+
     
     /**
      * 处理子弹发射检查事件
@@ -286,7 +279,6 @@ export class GamePause extends Component {
         eventBus.off(GameEvents.RESET_GAME_PAUSE, this.onResetGamePauseEvent, this);
         eventBus.off(GameEvents.GAME_START, this.onGameStartEvent, this);
         eventBus.off(GameEvents.GAME_CHECK_OVER, this.onGameCheckOverEvent, this);
-        eventBus.off(GameEvents.SHOW_BLOCK_SELECTION, this.onShowBlockSelectionEvent, this);
         
         GamePause._instance = null;
     }

+ 3 - 36
assets/scripts/CombatSystem/SkillSelection/SkillSelectionController.ts

@@ -41,24 +41,7 @@ export class SkillSelectionController extends Component {
         this.loadSkillConfig();
     }
     
-    /**
-     * 当技能选择UI激活时暂停游戏
-     */
-    onEnable() {
-        // 通过事件系统暂停游戏
-        const eventBus = EventBus.getInstance();
-        eventBus.emit(GameEvents.GAME_PAUSE);
-    }
 
-    /**
-     * 当技能选择UI关闭时的处理
-     * 注意:这里不直接恢复游戏,因为可能需要显示方块选择UI
-     */
-    onDisable() {
-        console.log('[SkillSelectionController] 技能选择UI关闭');
-        // 不在这里直接恢复游戏,因为可能需要显示方块选择UI
-        // 游戏恢复的逻辑在onSkillSelected方法中处理
-    }
 
     /**
      * 加载技能配置
@@ -218,25 +201,9 @@ export class SkillSelectionController extends Component {
                     if (igm) {
                         igm.resetEnergyValue();
                         
-                        // 检查是否需要弹出方块选择UI
-                        if (igm.shouldShowBlockSelection()) {
-                            // 需要显示方块选择UI,保持游戏暂停状态
-                            console.log('[SkillSelectionController] 技能选择完成,即将显示方块选择UI,保持游戏暂停');
-                            // 关闭技能UI
-                            this.node.active = false;
-                            // 立即显示方块选择UI,不恢复游戏
-                            igm.showBlockSelectionAfterSkill();
-                        } else {
-                            // 不需要显示方块选择UI,关闭技能UI并恢复游戏
-                            console.log('[SkillSelectionController] 技能选择完成,没有方块选择UI,恢复游戏');
-                            this.node.active = false;
-                            // 通过事件系统恢复游戏
-                            const eventBus = EventBus.getInstance();
-                            eventBus.emit(GameEvents.GAME_RESUME);
-                        }
-                    } else {
-                        // 没有InGameManager,直接关闭UI
-                        this.node.active = false;
+                        // 检查是否需要播放diban动画
+                        // 通过InGameManager处理后续逻辑
+                        igm.onSkillSelectionComplete();
                     }
                     
                     // 关闭后立刻重置UI

+ 1 - 7
assets/scripts/Core/EventBus.ts

@@ -34,10 +34,6 @@ export enum GameEvents {
     
     // UI事件
     SHOP_UPDATED = 'SHOP_UPDATED',
-    BLOCK_SELECTION_OPEN = 'BLOCK_SELECTION_OPEN',
-    BLOCK_SELECTION_CLOSE = 'BLOCK_SELECTION_CLOSE',
-    SHOW_GAME_BLOCK_SELECTION = 'SHOW_GAME_BLOCK_SELECTION',
-    SHOW_BLOCK_SELECTION = 'SHOW_BLOCK_SELECTION',
     RETURN_TO_MAIN_MENU = 'RETURN_TO_MAIN_MENU',
     
     // UI状态切换事件(根据游戏管理文档)
@@ -77,9 +73,7 @@ export enum GameEvents {
     // 游戏状态检查事件
     GAME_CHECK_OVER = 'GAME_CHECK_OVER',
     
-    // 方块选择事件
-    BLOCK_SELECTION_HIDE = 'BLOCK_SELECTION_HIDE',
-    BLOCK_SELECTION_SHOW = 'BLOCK_SELECTION_SHOW',
+
     
     // 方块生成事件
     GENERATE_BLOCKS = 'GENERATE_BLOCKS',

+ 1 - 3
assets/scripts/FourUI/MainSystem/MainUIControlller.ts

@@ -113,9 +113,7 @@ export class MainUIController extends Component {
     
     gm?.loadCurrentLevelConfig();
 
-    // Camera move down instantly for battle prep
-    const gsm = this.cameraNode?.getComponent(GameStartMove);
-    gsm?.moveDownInstant();
+    // 镜头下移动画现在已集成到StartGame流程中的slideUpFromBottom方法里
   }
 
 

+ 26 - 119
assets/scripts/LevelSystem/GameManager.ts

@@ -52,6 +52,12 @@ export class GameManager extends Component {
     })
     public gameBlockSelection: Node = null;
 
+    @property({
+        type: Node,
+        tooltip: '拖拽diban面板动画节点到这里 (Canvas/GameLevelUI/BlockSelectionUI/diban)'
+    })
+    public dibanAnimationNode: Node = null;
+
     @property({
         type: Node,
         tooltip: '拖拽GameArea节点到这里'
@@ -112,10 +118,7 @@ export class GameManager extends Component {
     
 
     
-    // BlockSelection UI状态监听
-    private blockSelectionUIWasActive: boolean = false;  // 记录BlockSelection UI的上一次状态
-    private blockSelectionUIInitialized: boolean = false;  // 标记是否已初始化
-    private blockSelectionUIMonitoringEnabled: boolean = false;  // 标记是否启用监听
+
 
     // 游戏区域的边界
     private gameBounds = {
@@ -173,6 +176,9 @@ export class GameManager extends Component {
         // 初始化管理器
         this.initializeManagers();
 
+        // 先初始化UI节点,确保inGameManager可用
+        this.initUINodes();
+        
         // 提前初始化本局数据,确保 BlockManager 在 start 时能拿到正确金币
         if (!LevelSessionManager.inst.runtime) {
             LevelSessionManager.inst.initialize(
@@ -187,42 +193,25 @@ export class GameManager extends Component {
         // 初始化游戏状态
         this.initializeGameState();
         
-        // 设置应用状态为游戏中
-        this.currentAppState = AppState.IN_GAME;
-        console.log('[GameManager] 设置应用状态为IN_GAME');
-        
-        // 先初始化UI状态监听(记录真实的初始状态)
-        this.initializeBlockSelectionUIListener();
-        
-        // 启用BlockSelection UI状态监听
-        this.blockSelectionUIMonitoringEnabled = true;
-        console.log('[GameManager] 游戏启动,启用BlockSelection UI状态监听');
-        
-        // 再初始化UI节点(可能会改变UI状态)
-        this.initUINodes();
+        // 保持在主菜单状态,等待用户点击战斗按钮
+        console.log('[GameManager] 初始化完成,当前状态为MAIN_MENU,等待用户操作');
         
         // 敌人控制器已通过事件系统解耦,不再需要直接查找和设置
         
         // 设置UI按钮
         this.setupUIButtons();
         
-        // 初始化组件
-        this.initGameBlockSelection();
+        // 初始化GameStartMove组件(不包含GameBlockSelection,避免过早设置确认回调)
         this.initGameStartMove();
         
+        // GameBlockSelection的确认回调将在游戏真正开始时设置,避免场景加载时的意外触发
+        
         // 关卡配置加载已移至StartGame.initializeGameData()中,确保正确的时序
         
         // 监听GamePause状态变化事件
         this.setupGamePauseEventListeners();
         
-        // 初始化游戏计时器
-        this.gameStartTime = Date.now();
-        
-        // 触发游戏启动流程(显示方块选择UI)
-        console.log('[GameManager] 触发游戏启动流程');
-        StartGame.startGameFlow().catch(error => {
-            console.error('[GameManager] 游戏启动流程出错:', error);
-        });
+        // 游戏启动流程将在用户点击战斗按钮时触发,而不是在场景加载时自动触发
     }
 
     /**
@@ -307,9 +296,7 @@ export class GameManager extends Component {
         this.gameStartTime = 0;
         this.gameEndTime = 0;
         
-        // 启用BlockSelection UI状态监听
-        this.blockSelectionUIMonitoringEnabled = true;
-        console.log('[GameManager] 游戏重启,启用BlockSelection UI状态监听');
+
         
         console.log('[GameManager] GameManager状态重置完成');
         
@@ -331,87 +318,9 @@ export class GameManager extends Component {
         this.gameStartTime = 0;
         this.gameEndTime = 0;
         
-        // 禁用UI状态监听
-        this.blockSelectionUIMonitoringEnabled = false;
-        
-        console.log('[GameManager] 游戏管理器状态已重置,UI监听已禁用');
-    }
-    
-
-    
-    /**
-     * 初始化BlockSelection UI状态监听
-     */
-    private initializeBlockSelectionUIListener() {
-        if (!this.gameBlockSelection) {
-            console.warn('[GameManager] BlockSelection UI节点未找到,无法初始化状态监听');
-            return;
-        }
-        
-        // 获取GameBlockSelection组件,检查是否有blockSelectionUINode引用
-        const blockSelectionComponent = this.gameBlockSelection.getComponent(GameBlockSelection);
-        let targetNode = this.gameBlockSelection; // 默认监听gameBlockSelection节点
-        
-        if (blockSelectionComponent && blockSelectionComponent.blockSelectionUINode) {
-            // 如果组件有blockSelectionUINode引用,监听该节点
-            targetNode = blockSelectionComponent.blockSelectionUINode;
-            console.log('[GameManager] 将监听blockSelectionUINode:', targetNode.name);
-        } else {
-            console.log('[GameManager] 将监听gameBlockSelection节点:', targetNode.name);
-        }
-        
-        // 记录初始状态
-        this.blockSelectionUIWasActive = targetNode.active;
-        this.blockSelectionUIInitialized = true;
-        
-        console.log(`[GameManager] BlockSelection UI状态监听已初始化,目标节点: ${targetNode.name},初始状态: ${this.blockSelectionUIWasActive}`);
-    }
-    
 
-    
-    /**
-     * 检查BlockSelection UI状态变化并处理清理逻辑
-     */
-    private checkBlockSelectionUIStateChange() {
-        if (!this.blockSelectionUIInitialized || !this.gameBlockSelection || !this.blockSelectionUIMonitoringEnabled) {
-            return;
-        }
-        
-        // 获取要监听的目标节点
-        const blockSelectionComponent = this.gameBlockSelection.getComponent(GameBlockSelection);
-        let targetNode = this.gameBlockSelection;
-        
-        if (blockSelectionComponent && blockSelectionComponent.blockSelectionUINode) {
-            targetNode = blockSelectionComponent.blockSelectionUINode;
-        }
-        
-        const currentActive = targetNode.active;
-        
-        // 检测从非激活状态变为激活状态(UI显示)
-        if (!this.blockSelectionUIWasActive && currentActive) {
-            console.log(`[GameManager] 检测到BlockSelection UI显示 (${targetNode.name}),触发方块清理`);
-            this.onBlockSelectionUIShow();
-        }
         
-        // 更新状态记录
-        this.blockSelectionUIWasActive = currentActive;
-    }
-    
-
-    
-
-    
-    /**
-     * 处理BlockSelection UI显示事件
-     */
-    private onBlockSelectionUIShow() {
-        console.log('[GameManager] BlockSelection UI显示,触发方块清理');
-        
-        // 触发方块清理事件
-        const eventBus = EventBus.getInstance();
-        eventBus.emit(GameEvents.RESET_BLOCK_MANAGER);
-        
-        console.log('[GameManager] 方块清理事件已发送');
+        console.log('[GameManager] 游戏管理器状态已重置');
     }
     
     // 敌人击杀事件处理已迁移到 InGameManager
@@ -440,9 +349,6 @@ export class GameManager extends Component {
     }
 
     update(deltaTime: number) {
-        // 检查UI状态变化(无论在什么状态下都要检查)
-        this.checkBlockSelectionUIStateChange();
-        
         // 只有在游戏中时才进行游戏逻辑更新
         if (this.currentAppState !== AppState.IN_GAME) {
             return;
@@ -696,8 +602,6 @@ export class GameManager extends Component {
      */
     private fallbackMainMenuLogic(mainUIController: any) {
         console.warn('[GameManager] 使用兜底逻辑返回主界面');
-        const gameLevelUI = find('Canvas/GameLevelUI');
-        if (gameLevelUI) gameLevelUI.active = false;
         if (this.mainUI) this.mainUI.active = true;
         
         if (mainUIController && typeof (mainUIController as any).updateUI === 'function') {
@@ -745,9 +649,7 @@ export class GameManager extends Component {
         this.gameStartTime = Date.now();
         // 游戏状态管理已迁移到 InGameManager
         
-        // 启用BlockSelection UI状态监听
-        this.blockSelectionUIMonitoringEnabled = true;
-        console.log('[GameManager] 游戏开始,启用BlockSelection UI状态监听');
+
         
         // 发送游戏开始事件,通知其他组件
         const eventBus = EventBus.getInstance();
@@ -881,7 +783,12 @@ export class GameManager extends Component {
         // 播放退出BLOCK_SELECTION状态的动画
         if (this.gameStartMoveComponent) {
             console.log('[GameManager] 执行退出BLOCK_SELECTION状态的动画');
-            this.gameStartMoveComponent.exitBlockSelectionMode(300, 0.3);
+            // 调用GameStartMove的退出方块选择模式方法
+            if (this.gameStartMoveComponent && typeof this.gameStartMoveComponent['exitBlockSelectionMode'] === 'function') {
+                (this.gameStartMoveComponent as any).exitBlockSelectionMode(300, 0.3);
+            } else {
+                console.warn('[GameManager] GameStartMove组件未实现exitBlockSelectionMode方法');
+            }
         }
         
         // 游戏状态管理已迁移到 InGameManager
@@ -1093,7 +1000,7 @@ export class GameManager extends Component {
     }
 
     // 初始化GameBlockSelection组件
-    private initGameBlockSelection() {
+    public initGameBlockSelection() {
         console.log('[GameManager] 初始化GameBlockSelection组件');
         console.log('[GameManager] gameBlockSelection节点:', !!this.gameBlockSelection, this.gameBlockSelection?.name);
         

+ 50 - 26
assets/scripts/LevelSystem/IN_game.ts

@@ -273,52 +273,77 @@ export class InGameManager extends Component {
     }
 
     /**
-     * 检查是否应该显示方块选择UI
+     * 检查是否应该播放diban动画
      */
-    public shouldShowBlockSelection(): boolean {
+    public shouldPlayDibanAnimation(): boolean {
         return this.preparingNextWave && this.currentState === GameState.BLOCK_SELECTION;
     }
 
     /**
-     * 在技能选择后显示方块选择UI
+     * 技能选择完成后的处理
      */
-    public showBlockSelectionAfterSkill() {
+    public onSkillSelectionComplete() {
+        console.log('[InGameManager] 技能选择完成');
+        
+        // 关闭技能选择UI
+        if (this.selectSkillUI) {
+            this.selectSkillUI.active = false;
+            console.log('[InGameManager] 技能选择UI已关闭');
+        }
+        
+        // 如果有等待的diban动画,现在播放diban动画
+        if (this.pendingBlockSelection) {
+            console.log('[InGameManager] 技能选择完成,现在播放diban动画');
+            this.playDibanAnimationAfterSkill();
+        }
+    }
+
+    /**
+     * 在技能选择后播放diban动画
+     */
+    public playDibanAnimationAfterSkill() {
         if (this.pendingBlockSelection) {
-            console.log('[InGameManager] 技能选择完成,现在显示方块选择UI');
+            console.log('[InGameManager] 技能选择完成,现在播放diban动画');
             this.pendingBlockSelection = false;
             
             if (this.currentWave < (this.levelWaves?.length || 1)) {
-                this.showBlockSelectionForNextWave();
+                this.playDibanAnimationForNextWave();
             } else {
                 console.log('[InGameManager] 最后一波结束,触发游戏胜利');
                 this.triggerGameSuccess();
             }
-        } else if (this.shouldShowBlockSelection()) {
-            this.showBlockSelectionForNextWave();
+        } else if (this.shouldPlayDibanAnimation()) {
+            this.playDibanAnimationForNextWave();
         }
     }
 
     /**
-     * 显示下一波方块选择UI
+     * 播放下一波diban动画
      */
-    private showBlockSelectionForNextWave() {
-        // 如果游戏已经结束,不显示方块选择UI
+    private playDibanAnimationForNextWave() {
+        // 如果游戏已经结束,不播放diban动画
         if (this.isGameOver()) {
-            console.warn('[InGameManager] 游戏已经结束(胜利或失败),不显示下一波方块选择UI!');
+            console.warn('[InGameManager] 游戏已经结束(胜利或失败),不播放下一波diban动画!');
             return;
         }
         
-        console.log('[InGameManager] 显示方块选择UI,准备播放进入动画');
+        console.log('[InGameManager] 播放diban动画');
         
+        // 生成方块选择(不显示UI)
         if (this.blockSelectionComponent) {
-            this.blockSelectionComponent.showBlockSelection(true);
-            
-            // 通过事件系统暂停游戏
-            EventBus.getInstance().emit(GameEvents.GAME_PAUSE);
+            this.blockSelectionComponent.generateBlockSelection();
         }
         
-        // 注意:不在这里直接调用动画,showBlockSelection()内部的playShowAnimation()会处理动画
-        // 避免重复调用enterBlockSelectionMode导致摄像头偏移两倍
+        // 使用GameStartMove组件播放diban上滑动画和镜头下移动画
+        if (this.gameStartMoveComponent) {
+            console.log('[InGameManager] 调用GameStartMove组件播放diban上滑动画');
+            this.gameStartMoveComponent.slideUpFromBottom(300, 0.3);
+        } else {
+            console.warn('[InGameManager] GameStartMove组件未找到,无法播放diban动画');
+        }
+        
+        // 通过事件系统暂停游戏
+        EventBus.getInstance().emit(GameEvents.GAME_PAUSE);
     }
 
     /**
@@ -432,13 +457,13 @@ export class InGameManager extends Component {
         this.pendingBlockSelection = true;
         this.currentState = GameState.BLOCK_SELECTION;
         
-        console.log('[InGameManager] 设置准备下一波状态,准备显示方块选择UI');
+        console.log('[InGameManager] 设置准备下一波状态,准备播放diban动画');
         
-        // 如果当前没有技能选择UI显示,立即显示方块选择UI
+        // 如果当前没有技能选择UI显示,立即播放diban动画
         if (!this.selectSkillUI || !this.selectSkillUI.active) {
-            this.showBlockSelectionForNextWave();
+            this.playDibanAnimationForNextWave();
         }
-        // 如果技能选择UI正在显示,则等待技能选择完成后再显示方块选择UI
+        // 如果技能选择UI正在显示,则等待技能选择完成后再播放diban动画
         // 这种情况下,pendingBlockSelection已经在onEnemyKilledEvent中设置为true
     }
 
@@ -821,9 +846,8 @@ export class InGameManager extends Component {
         // 触发进入游玩状态事件
         EventBus.getInstance().emit(GameEvents.ENTER_PLAYING_STATE);
         
-        // 发送游戏开始事件,确保GamePause正确设置状态
-        EventBus.getInstance().emit(GameEvents.GAME_START);
-        console.log('[InGameManager] 发送GAME_START事件');
+        // 注意:不再发送GAME_START事件,避免重复触发游戏启动流程
+        // 游戏启动流程已在用户点击战斗按钮时完成,这里只需要启动游戏逻辑
         
         // 通过事件系统启动球的移动
         EventBus.getInstance().emit(GameEvents.BALL_START);

+ 40 - 9
assets/scripts/LevelSystem/StartGame.ts

@@ -7,7 +7,7 @@ const { ccclass } = _decorator;
 
 /**
  * 游戏启动管理器
- * 负责统一处理游戏启动流程:显示方块选择UI → 玩家选择方块 → 确认开始游戏,并加载游戏状态
+ * 负责统一处理游戏启动流程:生成方块选择 → 播放diban动画 → 确认开始游戏,并加载游戏状态
  * 不区分首次游戏和重启游戏,统一按照流程进行
  * 
  * 注意:这个类主要提供静态方法,不需要挂载到场景节点上
@@ -68,14 +68,45 @@ export class StartGame extends Component {
         console.log('[StartGame] 初始化游戏数据');
         await StartGame.initializeGameData();
         
-        // 2. 显示方块选择UI
-        console.log('[StartGame] 显示方块选择UI');
-        setTimeout(() => {
-            console.log('[StartGame] 准备发送SHOW_BLOCK_SELECTION事件');
-            eventBus.emit(GameEvents.SHOW_BLOCK_SELECTION);
-            console.log('[StartGame] SHOW_BLOCK_SELECTION事件已发送');
-            console.log('[StartGame] 游戏启动流程完成');
-        }, 600);
+        // 2. 初始化GameBlockSelection确认回调(避免场景加载时过早设置)
+        console.log('[StartGame] 设置GameBlockSelection确认回调');
+        const gameManager = GameManager.getInstance();
+        if (gameManager) {
+            (gameManager as any).initGameBlockSelection();
+            console.log('[StartGame] GameBlockSelection确认回调设置完成');
+        }
+        
+        // 3. 生成初始方块
+        console.log('[StartGame] 生成初始方块');
+        const blockSelectionUINode = find('Canvas/GameLevelUI/BlockSelectionUI');
+        if (blockSelectionUINode) {
+            const gameBlockSelection = blockSelectionUINode.getComponent('GameBlockSelection');
+            if (gameBlockSelection) {
+                (gameBlockSelection as any).generateBlockSelection();
+                console.log('[StartGame] 初始方块生成完成');
+            } else {
+                console.warn('[StartGame] GameBlockSelection组件未找到');
+            }
+        } else {
+            console.warn('[StartGame] diban容器节点未找到');
+        }
+        
+        // 4. 播放diban上移动画和镜头下移动画
+        console.log('[StartGame] 播放diban上移动画和镜头下移动画');
+        const cameraNode = find('Canvas/Camera');
+        if (cameraNode) {
+            const gameStartMove = cameraNode.getComponent('GameStartMove');
+            if (gameStartMove) {
+                (gameStartMove as any).slideUpFromBottom(300, 0.3);
+                console.log('[StartGame] diban上移动画和镜头下移动画已启动');
+            } else {
+                console.warn('[StartGame] GameStartMove组件未找到');
+            }
+        } else {
+            console.warn('[StartGame] Camera节点未找到');
+        }
+        
+        console.log('[StartGame] 游戏启动流程完成');
     }
     
 

+ 2 - 17
assets/scripts/LevelSystem/UIStateManager.ts

@@ -107,28 +107,13 @@ export class UIStateManager extends BaseSingleton {
             console.log('[UIStateManager] 已关闭GameEnd面板');
         }
         
-        // 关闭技能选择面板
-        const selectSkillUI = find('Canvas/SelectSkillUI');
-        if (selectSkillUI && selectSkillUI.active) {
-            selectSkillUI.active = false;
-            console.log('[UIStateManager] 已关闭SelectSkillUI面板');
-        }
-        
-        // 关闭其他可能的游戏UI面板
-        const gameBlockSelection = find('Canvas/GameBlockSelection');
-        if (gameBlockSelection && gameBlockSelection.active) {
-            gameBlockSelection.active = false;
-            console.log('[UIStateManager] 已关闭GameBlockSelection面板');
-        }
-        
         // 暂时禁用游戏事件响应,避免与GameManager冲突
         this.shouldRespondToGameEvents = false;
-        console.log('[UIStateManager] 已禁用游戏事件响应');
         
-        // 延迟重新启用,给GameManager足够时间处理
+        // 延迟重新启用游戏事件响应
         this.scheduleOnce(() => {
             this.shouldRespondToGameEvents = true;
-            console.log('[UIStateManager] 已重新启用游戏事件响应');
+            console.log('[UIStateManager] 游戏事件响应已重新启用');
         }, 1.0);
     }
 

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.