181404010226 4 сар өмнө
parent
commit
10f9ff9dfb

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 458 - 99
assets/Scenes/GameLevel.scene


BIN
assets/resources/images/UI/主界面/dibantubian.png


+ 134 - 0
assets/resources/images/UI/主界面/dibantubian.png.meta

@@ -0,0 +1,134 @@
+{
+  "ver": "1.0.27",
+  "importer": "image",
+  "imported": true,
+  "uuid": "91fa449d-8ddb-4dd9-8f63-7886eb441e30",
+  "files": [
+    ".json",
+    ".png"
+  ],
+  "subMetas": {
+    "6c48a": {
+      "importer": "texture",
+      "uuid": "91fa449d-8ddb-4dd9-8f63-7886eb441e30@6c48a",
+      "displayName": "dibantubian",
+      "id": "6c48a",
+      "name": "texture",
+      "userData": {
+        "wrapModeS": "clamp-to-edge",
+        "wrapModeT": "clamp-to-edge",
+        "imageUuidOrDatabaseUri": "91fa449d-8ddb-4dd9-8f63-7886eb441e30",
+        "isUuid": true,
+        "visible": false,
+        "minfilter": "linear",
+        "magfilter": "linear",
+        "mipfilter": "none",
+        "anisotropy": 0
+      },
+      "ver": "1.0.22",
+      "imported": true,
+      "files": [
+        ".json"
+      ],
+      "subMetas": {}
+    },
+    "f9941": {
+      "importer": "sprite-frame",
+      "uuid": "91fa449d-8ddb-4dd9-8f63-7886eb441e30@f9941",
+      "displayName": "dibantubian",
+      "id": "f9941",
+      "name": "spriteFrame",
+      "userData": {
+        "trimThreshold": 1,
+        "rotated": false,
+        "offsetX": 0,
+        "offsetY": 0,
+        "trimX": 0,
+        "trimY": 0,
+        "width": 187,
+        "height": 135,
+        "rawWidth": 187,
+        "rawHeight": 135,
+        "borderTop": 0,
+        "borderBottom": 0,
+        "borderLeft": 0,
+        "borderRight": 0,
+        "packable": true,
+        "pixelsToUnit": 100,
+        "pivotX": 0.5,
+        "pivotY": 0.5,
+        "meshType": 0,
+        "vertices": {
+          "rawPosition": [
+            -93.5,
+            -67.5,
+            0,
+            93.5,
+            -67.5,
+            0,
+            -93.5,
+            67.5,
+            0,
+            93.5,
+            67.5,
+            0
+          ],
+          "indexes": [
+            0,
+            1,
+            2,
+            2,
+            1,
+            3
+          ],
+          "uv": [
+            0,
+            135,
+            187,
+            135,
+            0,
+            0,
+            187,
+            0
+          ],
+          "nuv": [
+            0,
+            0,
+            1,
+            0,
+            0,
+            1,
+            1,
+            1
+          ],
+          "minPos": [
+            -93.5,
+            -67.5,
+            0
+          ],
+          "maxPos": [
+            93.5,
+            67.5,
+            0
+          ]
+        },
+        "isUuid": true,
+        "imageUuidOrDatabaseUri": "91fa449d-8ddb-4dd9-8f63-7886eb441e30@6c48a",
+        "atlasUuid": "",
+        "trimType": "auto"
+      },
+      "ver": "1.0.12",
+      "imported": true,
+      "files": [
+        ".json"
+      ],
+      "subMetas": {}
+    }
+  },
+  "userData": {
+    "type": "sprite-frame",
+    "hasAlpha": true,
+    "fixAlphaTransparencyArtifacts": false,
+    "redirect": "91fa449d-8ddb-4dd9-8f63-7886eb441e30@6c48a"
+  }
+}

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

@@ -36,13 +36,6 @@ export class GameBlockSelection extends Component {
     })
     public coinLabelNode: Node = null;
 
-    // 移除toastNode属性,改用事件机制
-    // @property({
-    //     type: Node,
-    //     tooltip: '拖拽Canvas/Toast节点到这里'
-    // })
-    // public toastNode: Node = null;
-
     @property({
         type: Node,
         tooltip: '拖拽Canvas/GameLevelUI/BallController节点到这里'

+ 82 - 14
assets/scripts/FourUI/NavBarController.ts

@@ -1,4 +1,4 @@
-import { _decorator, Color, Component, Node, Sprite, find } from 'cc';
+import { _decorator, Color, Component, Node, Sprite, find, Vec3 } from 'cc';
 import EventBus, { GameEvents } from '../Core/EventBus';
 import { GameStartMove } from '../Animations/GameStartMove';
 const { ccclass, property } = _decorator;
@@ -7,17 +7,26 @@ const { ccclass, property } = _decorator;
 export class NavBarController extends Component {
     @property({ type: [Node] }) panels: Node[] = [];      // 依次给 Main、Shop、Upgrade、Skill
     @property({ type: [Node] }) buttons: Node[] = [];     // 依次给 Battle、Shop、Upgrade、Skill
+    @property({ type: [Node] }) buttonBorders: Node[] = []; // 按钮边框节点数组,需要手动配置
+    
     private normalColor = new Color(255, 255, 255, 255);
-    private activeColor = new Color(255, 0, 0, 255);      // 红色
     private lockedColor = new Color(128, 128, 128, 255);   // 灰色(锁定状态)
     
     // 按钮锁定状态数组 - 对应 Battle、Shop、Upgrade、Skill 四个按钮
     private buttonLockStates: boolean[] = [false, true, false, false];  // 默认只锁定Shop按钮
     
+    // 存储按钮原始位置
+    private buttonOriginalPositions: Vec3[] = [];
+    
+    // 当前激活的按钮索引
+    private currentActiveButtonIndex: number = -1;
+    
     // GameStartMove组件引用,用于重置镜头位置
     private gameStartMoveComponent: GameStartMove = null;
 
     start () {
+        // 保存按钮原始位置
+        this.saveButtonOriginalPositions();
         // 默认打开 MainUI
         this.switchTo(0);
         // 初始化按钮状态,设置shop按钮为锁定状态
@@ -50,6 +59,17 @@ export class NavBarController extends Component {
         eventBus.off(GameEvents.RETURN_TO_MAIN_MENU, this.onReturnToMainMenu, this);
     }
     
+    /**
+     * 保存按钮原始位置
+     */
+    private saveButtonOriginalPositions() {
+        this.buttonOriginalPositions = [];
+        this.buttons.forEach(btn => {
+            this.buttonOriginalPositions.push(btn.position.clone());
+        });
+        console.log('[NavBarController] 已保存按钮原始位置');
+    }
+    
     /**
      * 处理返回主菜单事件
      */
@@ -149,39 +169,80 @@ export class NavBarController extends Component {
         // 实际映射: Battle->Main(0), Shop->Upgrade(2), Upgrade->Shop(1), Skill->Skill(3)
         const buttonToPanelMap = [0, 2, 1, 3]; // Battle->Main(0), Shop->Upgrade(2), Upgrade->Shop(1), Skill->Skill(3)
         
-        // 设置按钮颜色,考虑锁定状态
+        // 重置所有按钮到原始位置和状态
         this.buttons.forEach((btn, buttonIndex) => {
             const sp = btn.getComponent(Sprite);
             if (sp) {
-                // 检查按钮是否被锁定
+                // 重置按钮位置到原始位置
+                if (this.buttonOriginalPositions[buttonIndex]) {
+                    btn.position = this.buttonOriginalPositions[buttonIndex].clone();
+                }
+                
+                // 设置按钮颜色(只处理锁定状态)
                 if (this.buttonLockStates[buttonIndex]) {
                     sp.color = this.lockedColor;  // 锁定状态显示灰色
                 } else {
-                    // 检查当前按钮对应的面板是否是激活的面板
-                    const panelIndex = buttonToPanelMap[buttonIndex];
-                    sp.color = (panelIndex === index) ? this.activeColor : this.normalColor;
+                    sp.color = this.normalColor;  // 正常状态显示白色
                 }
             }
         });
+        
+        // 隐藏所有边框
+        this.buttonBorders.forEach(border => {
+            if (border) {
+                border.active = false;
+            }
+        });
+        
+        // 找到当前激活的按钮索引
+        let activeButtonIndex = -1;
+        for (let buttonIndex = 0; buttonIndex < buttonToPanelMap.length; buttonIndex++) {
+            if (buttonToPanelMap[buttonIndex] === index) {
+                activeButtonIndex = buttonIndex;
+                break;
+            }
+        }
+        
+        // 如果找到激活按钮且未被锁定,则应用激活效果
+        if (activeButtonIndex !== -1 && !this.buttonLockStates[activeButtonIndex]) {
+            const activeBtn = this.buttons[activeButtonIndex];
+            if (activeBtn && this.buttonOriginalPositions[activeButtonIndex]) {
+                // 向上移动20px
+                const newPos = this.buttonOriginalPositions[activeButtonIndex].clone();
+                newPos.y += 20;
+                activeBtn.position = newPos;
+                
+                // 显示对应的边框
+                if (this.buttonBorders[activeButtonIndex]) {
+                    this.buttonBorders[activeButtonIndex].active = true;
+                }
+                
+                this.currentActiveButtonIndex = activeButtonIndex;
+            }
+        } else {
+            this.currentActiveButtonIndex = -1;
+        }
     }
     
     /**
      * 更新按钮状态,主要用于设置锁定按钮的视觉效果
      */
     private updateButtonStates() {
-        // 按钮索引到面板索引的映射:根据实际的点击事件调用
-        const buttonToPanelMap = [0, 2, 1, 3]; // Battle->Main(0), Shop->Upgrade(2), Upgrade->Shop(1), Skill->Skill(3)
-        
         this.buttons.forEach((btn, buttonIndex) => {
             const sp = btn.getComponent(Sprite);
             if (sp) {
                 if (this.buttonLockStates[buttonIndex]) {
                     sp.color = this.lockedColor;  // 设置锁定按钮为锁定颜色
+                    // 确保锁定的按钮在原始位置
+                    if (this.buttonOriginalPositions[buttonIndex]) {
+                        btn.position = this.buttonOriginalPositions[buttonIndex].clone();
+                    }
+                    // 隐藏锁定按钮的边框
+                    if (this.buttonBorders[buttonIndex]) {
+                        this.buttonBorders[buttonIndex].active = false;
+                    }
                 } else {
-                    // 对于未锁定的按钮,设置为正常颜色(除非它是当前激活的)
-                    // 这里我们需要知道当前激活的面板,但为了简化,先设置为正常颜色
-                    // 实际的激活状态会在switchTo中正确设置
-                    sp.color = this.normalColor;
+                    sp.color = this.normalColor;  // 设置未锁定按钮为正常颜色
                 }
             }
         });
@@ -242,4 +303,11 @@ export class NavBarController extends Component {
     public getButtonLockStates(): boolean[] {
         return [...this.buttonLockStates];
     }
+    
+    /**
+     * 获取当前激活的按钮索引
+     */
+    public getCurrentActiveButtonIndex(): number {
+        return this.currentActiveButtonIndex;
+    }
 }

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно