Quellcode durchsuchen

完善游戏按钮功能

mojunshou vor 8 Monaten
Ursprung
Commit
4212268135

Datei-Diff unterdrückt, da er zu groß ist
+ 1553 - 229
assets/bundle/gui/eliminate/eliminate.prefab


BIN
assets/bundle/gui/eliminate/texture/button/sound_off.png


+ 0 - 134
assets/bundle/gui/eliminate/texture/button/sound_off.png.meta

@@ -1,134 +0,0 @@
-{
-  "ver": "1.0.27",
-  "importer": "image",
-  "imported": true,
-  "uuid": "d28d5b72-a621-4899-a00c-5eea43317e6c",
-  "files": [
-    ".json",
-    ".png"
-  ],
-  "subMetas": {
-    "6c48a": {
-      "importer": "texture",
-      "uuid": "d28d5b72-a621-4899-a00c-5eea43317e6c@6c48a",
-      "displayName": "sound_off",
-      "id": "6c48a",
-      "name": "texture",
-      "userData": {
-        "wrapModeS": "clamp-to-edge",
-        "wrapModeT": "clamp-to-edge",
-        "imageUuidOrDatabaseUri": "d28d5b72-a621-4899-a00c-5eea43317e6c",
-        "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": "d28d5b72-a621-4899-a00c-5eea43317e6c@f9941",
-      "displayName": "sound_off",
-      "id": "f9941",
-      "name": "spriteFrame",
-      "userData": {
-        "trimType": "auto",
-        "trimThreshold": 1,
-        "rotated": false,
-        "offsetX": 0,
-        "offsetY": 0,
-        "trimX": 0,
-        "trimY": 0,
-        "width": 73,
-        "height": 149,
-        "rawWidth": 73,
-        "rawHeight": 149,
-        "borderTop": 0,
-        "borderBottom": 0,
-        "borderLeft": 0,
-        "borderRight": 0,
-        "packable": true,
-        "pixelsToUnit": 100,
-        "pivotX": 0.5,
-        "pivotY": 0.5,
-        "meshType": 0,
-        "vertices": {
-          "rawPosition": [
-            -36.5,
-            -74.5,
-            0,
-            36.5,
-            -74.5,
-            0,
-            -36.5,
-            74.5,
-            0,
-            36.5,
-            74.5,
-            0
-          ],
-          "indexes": [
-            0,
-            1,
-            2,
-            2,
-            1,
-            3
-          ],
-          "uv": [
-            0,
-            149,
-            73,
-            149,
-            0,
-            0,
-            73,
-            0
-          ],
-          "nuv": [
-            0,
-            0,
-            1,
-            0,
-            0,
-            1,
-            1,
-            1
-          ],
-          "minPos": [
-            -36.5,
-            -74.5,
-            0
-          ],
-          "maxPos": [
-            36.5,
-            74.5,
-            0
-          ]
-        },
-        "isUuid": true,
-        "imageUuidOrDatabaseUri": "d28d5b72-a621-4899-a00c-5eea43317e6c@6c48a",
-        "atlasUuid": ""
-      },
-      "ver": "1.0.12",
-      "imported": true,
-      "files": [
-        ".json"
-      ],
-      "subMetas": {}
-    }
-  },
-  "userData": {
-    "type": "sprite-frame",
-    "hasAlpha": true,
-    "fixAlphaTransparencyArtifacts": false,
-    "redirect": "d28d5b72-a621-4899-a00c-5eea43317e6c@6c48a"
-  }
-}

BIN
assets/bundle/gui/eliminate/texture/button/sound_open.png


BIN
assets/bundle/gui/eliminate/texture/refresh.png


+ 28 - 28
assets/bundle/gui/eliminate/texture/button/sound_open.png.meta

@@ -2,7 +2,7 @@
   "ver": "1.0.27",
   "importer": "image",
   "imported": true,
-  "uuid": "3a988786-a2ad-4ef8-b9e0-8a2f09d562f7",
+  "uuid": "2be55bc1-f4ed-47e4-9480-277f23f93d0e",
   "files": [
     ".json",
     ".png"
@@ -10,14 +10,14 @@
   "subMetas": {
     "6c48a": {
       "importer": "texture",
-      "uuid": "3a988786-a2ad-4ef8-b9e0-8a2f09d562f7@6c48a",
-      "displayName": "sound_open",
+      "uuid": "2be55bc1-f4ed-47e4-9480-277f23f93d0e@6c48a",
+      "displayName": "refresh",
       "id": "6c48a",
       "name": "texture",
       "userData": {
         "wrapModeS": "clamp-to-edge",
         "wrapModeT": "clamp-to-edge",
-        "imageUuidOrDatabaseUri": "3a988786-a2ad-4ef8-b9e0-8a2f09d562f7",
+        "imageUuidOrDatabaseUri": "2be55bc1-f4ed-47e4-9480-277f23f93d0e",
         "isUuid": true,
         "visible": false,
         "minfilter": "linear",
@@ -34,8 +34,8 @@
     },
     "f9941": {
       "importer": "sprite-frame",
-      "uuid": "3a988786-a2ad-4ef8-b9e0-8a2f09d562f7@f9941",
-      "displayName": "sound_open",
+      "uuid": "2be55bc1-f4ed-47e4-9480-277f23f93d0e@f9941",
+      "displayName": "refresh",
       "id": "f9941",
       "name": "spriteFrame",
       "userData": {
@@ -46,10 +46,10 @@
         "offsetY": 0,
         "trimX": 0,
         "trimY": 0,
-        "width": 73,
-        "height": 146,
-        "rawWidth": 73,
-        "rawHeight": 146,
+        "width": 90,
+        "height": 79,
+        "rawWidth": 90,
+        "rawHeight": 79,
         "borderTop": 0,
         "borderBottom": 0,
         "borderLeft": 0,
@@ -61,17 +61,17 @@
         "meshType": 0,
         "vertices": {
           "rawPosition": [
-            -36.5,
-            -73,
+            -45,
+            -39.5,
             0,
-            36.5,
-            -73,
+            45,
+            -39.5,
             0,
-            -36.5,
-            73,
+            -45,
+            39.5,
             0,
-            36.5,
-            73,
+            45,
+            39.5,
             0
           ],
           "indexes": [
@@ -84,12 +84,12 @@
           ],
           "uv": [
             0,
-            146,
-            73,
-            146,
+            79,
+            90,
+            79,
             0,
             0,
-            73,
+            90,
             0
           ],
           "nuv": [
@@ -103,18 +103,18 @@
             1
           ],
           "minPos": [
-            -36.5,
-            -73,
+            -45,
+            -39.5,
             0
           ],
           "maxPos": [
-            36.5,
-            73,
+            45,
+            39.5,
             0
           ]
         },
         "isUuid": true,
-        "imageUuidOrDatabaseUri": "3a988786-a2ad-4ef8-b9e0-8a2f09d562f7@6c48a",
+        "imageUuidOrDatabaseUri": "2be55bc1-f4ed-47e4-9480-277f23f93d0e@6c48a",
         "atlasUuid": ""
       },
       "ver": "1.0.12",
@@ -129,6 +129,6 @@
     "type": "sprite-frame",
     "hasAlpha": true,
     "fixAlphaTransparencyArtifacts": false,
-    "redirect": "3a988786-a2ad-4ef8-b9e0-8a2f09d562f7@6c48a"
+    "redirect": "2be55bc1-f4ed-47e4-9480-277f23f93d0e@6c48a"
   }
 }

+ 23 - 15
assets/script/game/eliminate/view/EliminateViewComp.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-11 18:05:45
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-03-14 18:27:33
+ * @LastEditTime: 2025-03-17 14:06:35
  * @Description: 
  */
 import { _decorator, Color, EventTouch, instantiate, JsonAsset, Node, Prefab, Sprite, UITransform, Vec3, Widget, tween } from "cc";
@@ -124,6 +124,12 @@ export class EliminateViewComp extends CCComp {
     itemNode: Node | null = null;           //底部三个item块区域
     moveNode: Node | null = null;           //移动层Node
     rotateNode: Node | null = null;         //旋转Node
+    hammerNode: Node | null = null;         //锤子节点
+
+    //锤子功能
+    hammerMode = false;  // 是否在锤子模式
+    hammerRange = 2;     // 锤子影响范围(以点击位置为中心的方形区域边长)
+    hammerPreviewNodes: Node[] = [];  // 预览区域的节点列表
 
 
 
@@ -162,6 +168,7 @@ export class EliminateViewComp extends CCComp {
         this.itemNode = this.node.getChildByPath("Scene/itemNode");
         this.moveNode = this.node.getChildByPath("Scene/MoveNode");
         this.rotateNode = this.node.getChildByPath("Scene/rotateNode");
+        this.hammerNode = this.node.getChildByPath("Scene/hammerNode")
     }
 
 
@@ -180,7 +187,7 @@ export class EliminateViewComp extends CCComp {
         this.brickNum = GameConfig.BlockNum;
         this.rotateFlag = false;
         this.rotateBrickData = null;
-        this.setGameStatus(GameStatus.None);
+        this.setGameStatus(GameStatus.Start);
 
     }
 
@@ -260,7 +267,6 @@ export class EliminateViewComp extends CCComp {
             oops.res.load(json_name, JsonAsset, (err: Error | null, res: any) => {
                 if (res) {
                     this.gameConfig = res.json;
-                    console.log("???????????????????", this.gameConfig);
                     resolve();
                 } else {
                     console.log("JSON数据加载失,请检查文件");
@@ -753,7 +759,7 @@ export class EliminateViewComp extends CCComp {
             }
             // 方块到格子
             else if (this.editingData.brickData && this.editingData.gridList.length > 0) {
-                // console.log("")
+                console.log("移动到格子了")
                 // 修改格子
                 this.editingData.gridList.forEach((gridData) => {
                     gridData.status = GridStatus.Used
@@ -783,6 +789,7 @@ export class EliminateViewComp extends CCComp {
             }
             // 方块回到待选区
             else {
+                console.log("返回带待选区域")
                 const brickData = this.editingData.brickData
                 this.bricksList.push(brickData)
                 // this.audioManager.playMoveFail()
@@ -809,6 +816,7 @@ export class EliminateViewComp extends CCComp {
                 this.editingData.brickData.rotateFlag &&
                 event.getUILocation().subtract(this.touchStartLocation).length() < this.rotateFaultTolerant
             ) {
+                console.log("进这里啦?????????????????????")
                 this.rotateFlag = true
                 this.rotateBrickData = this.editingData.brickData;
                 if (this.rotateBrickData.brickNode) {
@@ -822,13 +830,14 @@ export class EliminateViewComp extends CCComp {
                 }
             }
             // 格子颜色恢复
-            this.gridColorRecovery()
+            this.gridColorRecovery();
         })
     }
 
 
     // 提示
     prompt(tipFlag = true) {
+        console.log("点击了提示按钮")
         return new Promise((resolve, reject) => {
             const gridPromptList: GridData[] = []
             let moveFlag = false
@@ -1093,7 +1102,7 @@ export class EliminateViewComp extends CCComp {
     }
 
 
-    // 消除
+    // 消除,这里增加飞的动画
     gridEliminate() {
         return new Promise((resolve, reject) => {
             const d = this.gridEliminateCheck(this.gridList)
@@ -1237,7 +1246,7 @@ export class EliminateViewComp extends CCComp {
 
 
     // //刷新按钮
-    onRefreshBtnClick() {
+    btn_refresh() {
         if (
             this.game_status !== GameStatus.Start
         ) return
@@ -1261,7 +1270,7 @@ export class EliminateViewComp extends CCComp {
     }
 
     //提示按钮
-    onPromptBtnClick() {
+    btn_hint() {
         if (
             this.game_status !== GameStatus.Start
         ) return
@@ -1277,11 +1286,6 @@ export class EliminateViewComp extends CCComp {
         })
     }
 
-    //重新开始
-    onAgainBtnClick() {
-        if (this.game_status === GameStatus.None) return
-        this.initGameData();
-    }
 
     //继续按钮
     onContinueBtnClick() {
@@ -1518,8 +1522,12 @@ export class EliminateViewComp extends CCComp {
     }
 
 
-
-
+    //重新开始-这样正常要接广告
+    private btn_reopen() {
+        console.log("重新开始");
+        if (this.game_status === GameStatus.None) return
+        this.initGameData()
+    }
 
     // ... 添加自动模式的开关方法
     onAutoButtonClick() {

+ 1 - 2
assets/script/game/eliminate/view/GameOverView.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-14 17:27:03
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-03-14 17:50:43
+ * @LastEditTime: 2025-03-17 10:48:11
  * @Description: 游戏结束页面
  */
 import { _decorator } from 'cc';
@@ -39,5 +39,4 @@ export class GameOverView extends GameComponent {
 
 
     }
-
 }