From c2f4437405195dcc184099e5caf36eaab8a0263d Mon Sep 17 00:00:00 2001 From: "COMPUTER\\EDY" <249929363@qq.com> Date: Wed, 15 Apr 2026 19:59:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BF=AE=E5=A4=8DBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Script/Block.ts | 55 ++- assets/Script/Map.ts | 47 +- assets/Script/SceneManager.ts | 14 +- assets/custom/Json/level1481.json | 500 ++++++++++++++++++++ assets/custom/Json/level1481.json.meta | 6 + assets/resources/prefab/block/block0.prefab | 3 - 6 files changed, 584 insertions(+), 41 deletions(-) create mode 100644 assets/custom/Json/level1481.json create mode 100644 assets/custom/Json/level1481.json.meta diff --git a/assets/Script/Block.ts b/assets/Script/Block.ts index 76d8982..b148e1e 100644 --- a/assets/Script/Block.ts +++ b/assets/Script/Block.ts @@ -773,13 +773,6 @@ export default class Block extends cc.Component { if (this.type == BlockType.叠加块上) { if (this.block_Info.colorChange != undefined && this.block_Info.colorChange != null) { if (change == true) { - // this.node.getChildByName("change_color").active = true; - // if (this.block_Info.node) { - // if (this.block_Info.node.getComponent("Block").block_Info.floor != undefined && this.block_Info.node.getComponent("Block").block_Info.floor != null) { - // this.node.getChildByName("change_color").active = false; - // } - // } - let tempColor = this.color; this.color = this.block_Info.node.getComponent("Block").color; this.block_Info.node.getComponent("Block").color = tempColor; @@ -837,18 +830,23 @@ export default class Block extends cc.Component { // 注意:只有类型为变色块或配置中有colorArray的方块才会变色 // ============================================ changeBlockColor() { - if (this.type == BlockType.变色块 || (this.block_Info.colorArray != undefined && this.block_Info.colorArray != null)) { - if (this.colorArray && this.colorArray.length > 0) { - // 取出第一项 - const firstItem = this.colorArray.shift(); - // 将第一项添加到数组末尾 - this.colorArray.push(firstItem); + if (this.node.getChildByName("change_color").active == true) { + if (this.type == BlockType.变色块 || (this.block_Info.colorArray != undefined && this.block_Info.colorArray != null)) { + console.log("变色块变颜色了", this.type); + if (this.colorArray && this.colorArray.length > 0) { + // 取出第一项 + const firstItem = this.colorArray.shift(); + // 将第一项添加到数组末尾 + this.colorArray.push(firstItem); + this.initColor(true); + } + } + else { + console.log("只是重新刷一遍颜色"); this.initColor(true); } } - else { - this.initColor(true); - } + } // ============================================ @@ -2355,7 +2353,6 @@ export default class Block extends cc.Component { // 7. 创建新的hit节点(用于显示高亮效果) // ============================================ restoreNomal(posX, posY, type) { - this.type = 0; this.node.getChildByName("change_color").active = false; this.block_Info.node = null; @@ -2507,12 +2504,29 @@ export default class Block extends cc.Component { this.block_Info.node.getChildByName("icon").opacity = 255; this.block_Info.node.active = true; if (this.block_Info.colorChange != undefined && this.block_Info.colorChange != null) { - this.block_Info.node.getChildByName("change_color").active = true; + setTimeout(() => { + if (this.block_Info.node) + this.block_Info.node.getChildByName("change_color").active = true; + }, 100); } } else if (this.type == BlockType.叠加块上) { if (this.block_Info.colorChange != undefined && this.block_Info.colorChange != null) { - this.node.getChildByName("change_color").active = true; + setTimeout(() => { + if (this.node) + this.node.getChildByName("change_color").active = true; + }, 100); + + } + } + else if (this.type == BlockType.变色块) { + if (this.block_Info.colorArray != undefined && this.block_Info.colorArray != null) { + if (this.block_Info.colorArray.length > 0) { + setTimeout(() => { + if (this.node) + this.node.getChildByName("change_color").active = true; + }, 100); + } } } } @@ -3382,7 +3396,8 @@ export default class Block extends cc.Component { // - 如果是叠加块下,隐藏主方块图标 // ============================================ setFloor() { - // console.log("设置地板块", this.type); + console.log("设置地板块", this.type); + this.node.getChildByName("change_color").active = false; this.node.getChildByName("icon").active = false; for (let i = 0; i < this.allBlocks.length; i++) { diff --git a/assets/Script/Map.ts b/assets/Script/Map.ts index 7e40e0c..2f9f0cd 100644 --- a/assets/Script/Map.ts +++ b/assets/Script/Map.ts @@ -143,6 +143,7 @@ export default class MapConroler extends cc.Component { noBlockClickDuration: number = 0; // 未点击方块的持续时间 mapBlockArray: any; //地图的所有格子状态存储 pause: boolean = false;//暂停状态 + shopPause: boolean = false;//商店暂停状态 hammer: boolean = false;//锤子状态 ishammer: boolean = false;//魔法棒与锤子区分 ismagic: boolean = false;//魔法棒状态 @@ -628,6 +629,7 @@ export default class MapConroler extends cc.Component { let risefall = cc.fx.GameConfig.LEVEL_INFO[0].risefall; this.pause = false; + this.shopPause = false;//商店暂停状态 this.hammer = false; this.ishammer = false; this.ismagic = false; @@ -3126,14 +3128,20 @@ export default class MapConroler extends cc.Component { //判断游戏成功下一关 nextLevel(num: number) { if (num == 1) { - this.pause = false; this.openIce(); + console.log("解冻:", this.shopPause); + if (this.node.parent.parent.parent.getChildByName("Pause").active == false && !this.shopPause) { + this.pause = false; + } } else { if (this.iceTrue() == true) { this.pause = true; } else { - this.pause = false; this.openIce(); + console.log("解冻2:", this.shopPause); + if (this.node.parent.parent.parent.getChildByName("Pause").active == false && !this.shopPause) { + this.pause = false; + } } } @@ -3849,8 +3857,12 @@ export default class MapConroler extends cc.Component { this.icetimeNode[2].active = false; this.gameOver = false; this.gameWin = false; - this.pause = false; - this.stopBoom(); + + if (this.node.parent.parent.parent.getChildByName("Pause").active == false) { + this.pause = false; + this.stopBoom(); + } + if (data.type == "time") { this.timeNumber = 21; this.add_Time += 20; @@ -3915,7 +3927,9 @@ export default class MapConroler extends cc.Component { MiniGameSdk.API.showToast("继续游戏"); this.gameOver = false; this.gameWin = false; - this.pause = false; + if (this.node.parent.parent.parent.getChildByName("Pause").active == false) { + this.pause = false; + } this.timeNumber = 21; this.add_Time += 20; NumberToImage.getTimeMargi3(20, 45, "company_", this.timeLabel) @@ -4158,7 +4172,7 @@ export default class MapConroler extends cc.Component { else if (blockOld != this.blockNum && type != "boom" && type != "time") { console.log("____________判死之后使用道具了,且没有胜利,重新做判输"); this.gameOver = false; - if (this.iceTrue() == false) { + if (this.iceTrue() == false && this.node.parent.parent.parent.getChildByName("Pause").active == false && !this.shopPause) { this.pause = false; if (this.gameStart == true) this.startBoom(); } @@ -4608,7 +4622,7 @@ export default class MapConroler extends cc.Component { this.icetimeNode[0].active = true; this.icetimeNode[1].active = false; this.icetimeNode[2].active = false; - if (this.iceTrue() == false) { + if (this.iceTrue() == false && this.node.parent.parent.parent.getChildByName("Pause").active == false && !this.shopPause) { this.pause = false; if (this.gameStart == true) this.startBoom(); } @@ -4647,7 +4661,7 @@ export default class MapConroler extends cc.Component { MapConroler._instance.SceneManager.openRewardWindow(data, () => { var pause2 = this.iceTrue(); - if (pause2 == false) { + if (pause2 == false && this.node.parent.parent.parent.getChildByName("Pause").active == false && !this.shopPause) { this.pause = false; if (this.gameStart == true) this.startBoom(); } @@ -4676,7 +4690,7 @@ export default class MapConroler extends cc.Component { MapConroler._instance.SceneManager.openRewardWindow(data, () => { var pause2 = this.iceTrue(); - if (pause2 == false) { + if (pause2 == false && this.node.parent.parent.parent.getChildByName("Pause").active == false && !this.shopPause) { this.pause = false; if (this.gameStart == true) this.startBoom(); } @@ -4704,7 +4718,7 @@ export default class MapConroler extends cc.Component { MapConroler._instance.SceneManager.openRewardWindow(data, () => { var pause2 = this.iceTrue(); - if (pause2 == false) { + if (pause2 == false && this.node.parent.parent.parent.getChildByName("Pause").active == false && !this.shopPause) { this.pause = false; if (this.gameStart == true) this.startBoom(); } @@ -4788,11 +4802,15 @@ export default class MapConroler extends cc.Component { let hammerBtn = this.node.parent.getChildByName("Bottom").getChildByName("destroyBtn"); this.hammerMask.active = false; - this.node.parent.getChildByName("Mask").active = false; + this.node.parent.parent.getChildByName("Mask").active = false; this.hammer = false; this.ishammer = false; - this.pause = false; - if (this.gameStart == true) this.startBoom(); + + if (this.node.parent.parent.parent.getChildByName("Pause").active == false && !this.shopPause) { + this.pause = false; + if (this.gameStart == true) this.startBoom(); + } + // 如果是使用连胜免费锤子,则不隐藏按钮并恢复其状态 if (this.hammerSpecial) { @@ -5521,12 +5539,13 @@ export default class MapConroler extends cc.Component { // ============================================ usePause() { if (this.pause) { - if (this.iceTrue() == false) { + if (this.iceTrue() == false && this.node.parent.parent.parent.getChildByName("Pause").active == false && !this.shopPause) { this.pause = false; if (this.gameStart == true) this.startBoom(); } } else { + debugger; this.pause = true; this.stopBoom(); } diff --git a/assets/Script/SceneManager.ts b/assets/Script/SceneManager.ts index dad57e0..61d1c0c 100644 --- a/assets/Script/SceneManager.ts +++ b/assets/Script/SceneManager.ts @@ -377,10 +377,13 @@ export default class SceneManager extends cc.Component { if (MapConroler && MapConroler._instance) { + console.log("_____________执行暂停"); MapConroler._instance.pause = true; MapConroler._instance.stopBoom(); } - + } + else { + console.log("_____________暂停执行失败"); } } @@ -388,8 +391,9 @@ export default class SceneManager extends cc.Component { if (this.shopNode) { this.shopNode.active = false; if (MapConroler && MapConroler._instance) { + MapConroler._instance.shopPause = false; var pause = MapConroler._instance.iceTrue(); - if (pause == false) { + if (pause == false && this.node.getChildByName("Pause").active == false) { if (MapConroler && MapConroler._instance) MapConroler._instance.pause = false; if (MapConroler._instance.gameStart == true) MapConroler._instance.startBoom(); } @@ -403,7 +407,7 @@ export default class SceneManager extends cc.Component { this.node.getChildByName("Pause").active = false; if (MapConroler && MapConroler._instance) { var pause = MapConroler._instance.iceTrue(); - if (pause == false) { + if (pause == false && this.node.getChildByName("Pause").active == false && !MapConroler._instance.shopPause) { if (MapConroler && MapConroler._instance) MapConroler._instance.pause = false; if (MapConroler._instance.gameStart == true) MapConroler._instance.startBoom(); } @@ -492,6 +496,7 @@ export default class SceneManager extends cc.Component { cc.fx.GameTool.shushu_Track("interface_exposure", dataInfo); cc.fx.GameConfig.GM_INFO.shopDouble = res.data.shopDouble; if (MapConroler && MapConroler._instance) { + MapConroler._instance.shopPause = true; MapConroler._instance.pause = true; MapConroler._instance.stopBoom(); } @@ -506,6 +511,7 @@ export default class SceneManager extends cc.Component { this.shopNode.active = true; this.shopNode.getComponent("shop").init(res.data.shopDouble); } + // console.log("shopNode parent:", this.shopNode.parent); } }); @@ -562,7 +568,7 @@ export default class SceneManager extends cc.Component { else { if (MapConroler && MapConroler._instance) { var pause = MapConroler._instance.iceTrue(); - if (pause == false) { + if (pause == false && this.node.getChildByName("Pause").active == false && !MapConroler._instance.shopPause) { if (MapConroler && MapConroler._instance) MapConroler._instance.pause = false; if (MapConroler._instance.gameStart == true) MapConroler._instance.startBoom(); } diff --git a/assets/custom/Json/level1481.json b/assets/custom/Json/level1481.json new file mode 100644 index 0000000..c1ccf0d --- /dev/null +++ b/assets/custom/Json/level1481.json @@ -0,0 +1,500 @@ +{ + "LEVEL_INFO": [ + { + "risefall": [], + "id": "1481", + "map": [ + 9, + 12 + ], + "time": 105, + "gap": [] + } + ], + "BLOCK_INFO": [ + [ + { + "block": 1, + "color": 5, + "type": 0, + "position": { + "x": 300, + "y": 480, + "z": 0 + }, + "id": 210 + }, + { + "block": 2, + "color": 7, + "type": 0, + "position": { + "x": 420, + "y": 360, + "z": 0 + }, + "id": 220 + }, + { + "block": 0, + "color": 7, + "type": 0, + "position": { + "x": -300, + "y": 240, + "z": 0 + }, + "id": 230 + }, + { + "block": 6, + "color": 7, + "type": 0, + "position": { + "x": 420, + "y": -120, + "z": 0 + }, + "id": 240 + }, + { + "block": 2, + "color": 10, + "type": 0, + "position": { + "x": 300, + "y": -360, + "z": 0 + }, + "id": 250 + }, + { + "block": 2, + "color": 4, + "type": 0, + "position": { + "x": -180, + "y": -480, + "z": 0 + }, + "id": 260 + }, + { + "block": 3, + "color": 5, + "type": 0, + "position": { + "x": 420, + "y": -600, + "z": 0 + }, + "lock": true, + "id": 270 + }, + { + "block": 2, + "color": 7, + "type": 8, + "position": { + "x": 60, + "y": 120, + "z": 0 + }, + "id": 280 + }, + { + "block": 0, + "color": 5, + "type": 16, + "position": { + "x": -300, + "y": -480, + "z": 0 + }, + "questionTime": 3, + "id": 290 + }, + { + "block": 0, + "color": 1, + "type": 16, + "position": { + "x": -60, + "y": -600, + "z": 0 + }, + "questionTime": 3, + "id": 300 + }, + { + "block": 0, + "color": 6, + "type": 16, + "position": { + "x": 420, + "y": 240, + "z": 0 + }, + "questionTime": 4, + "id": 310 + }, + { + "block": 14, + "color": 7, + "type": 16, + "position": { + "x": 60, + "y": -480, + "z": 0 + }, + "questionTime": 5, + "vertical": true, + "id": 320 + }, + { + "block": 0, + "color": 2, + "type": 16, + "position": { + "x": -60, + "y": -240, + "z": 0 + }, + "questionTime": 5, + "id": 330 + }, + { + "block": 0, + "color": 3, + "type": 16, + "position": { + "x": -300, + "y": 120, + "z": 0 + }, + "questionTime": 5, + "id": 340 + }, + { + "block": 0, + "color": 5, + "type": 16, + "position": { + "x": 180, + "y": 120, + "z": 0 + }, + "questionTime": 6, + "id": 350 + }, + { + "block": 19, + "color": 4, + "type": 0, + "position": { + "x": 420, + "y": -480, + "z": 0 + }, + "floor": 1, + "floorTime": 8, + "floorMove": true, + "id": 360 + }, + { + "block": 0, + "color": 5, + "type": 16, + "position": { + "x": 180, + "y": 360, + "z": 0 + }, + "questionTime": 8, + "id": 370 + }, + { + "block": 2, + "color": 9, + "type": 16, + "position": { + "x": -300, + "y": 360, + "z": 0 + }, + "questionTime": 7, + "id": 380 + }, + { + "block": 1, + "color": 8, + "type": 0, + "position": { + "x": -180, + "y": -600, + "z": 0 + }, + "floor": 2, + "floorTime": 9, + "floorMove": true, + "id": 390 + }, + { + "block": 20, + "color": 9, + "type": 16, + "position": { + "x": -180, + "y": -240, + "z": 0 + }, + "questionTime": 9, + "id": 400 + }, + { + "block": 3, + "color": 8, + "type": 0, + "position": { + "x": 60, + "y": 480, + "z": 0 + }, + "floor": 3, + "floorTime": 10, + "floorMove": true, + "lock": true, + "id": 410 + }, + { + "block": 3, + "color": 3, + "type": 0, + "position": { + "x": 60, + "y": 360, + "z": 0 + }, + "floor": 4, + "floorTime": 10, + "floorMove": true, + "lock": true, + "id": 420 + }, + { + "block": 2, + "color": 9, + "type": 16, + "position": { + "x": 300, + "y": 240, + "z": 0 + }, + "questionTime": 12, + "id": 430 + }, + { + "block": 0, + "color": 1, + "type": 0, + "position": { + "x": -180, + "y": 0, + "z": 0 + }, + "floor": 5, + "floorTime": 3, + "floorMove": false, + "floorColor": 8, + "id": 440 + }, + { + "block": 0, + "color": 8, + "type": 0, + "position": { + "x": -180, + "y": -120, + "z": 0 + }, + "floor": 5, + "floorTime": 3, + "floorMove": false, + "floorColor": 8, + "id": 450 + }, + { + "block": 0, + "color": 6, + "type": 0, + "position": { + "x": 300, + "y": 0, + "z": 0 + }, + "floor": 5, + "floorTime": 3, + "floorMove": false, + "floorColor": 8, + "id": 460 + }, + { + "block": 0, + "color": 2, + "type": 0, + "position": { + "x": 300, + "y": -120, + "z": 0 + }, + "floor": 5, + "floorTime": 3, + "floorMove": false, + "floorColor": 8, + "id": 470 + }, + { + "block": 13, + "color": 7, + "type": 0, + "position": { + "x": 180, + "y": -120, + "z": 0 + }, + "floor": 5, + "floorTime": 3, + "floorMove": false, + "floorColor": 8, + "id": 480 + }, + { + "block": 1, + "color": 11, + "type": 0, + "position": { + "x": 180, + "y": 0, + "z": 0 + }, + "floor": 5, + "floorTime": 3, + "floorMove": false, + "floorColor": 8, + "id": 490 + } + ] + ], + "WALL_INFO": [ + [ + { + "id": 1482, + "num": 0, + "color": 6, + "special": 0, + "length": 1 + }, + { + "id": 1483, + "num": 4, + "color": 5, + "special": 0, + "length": 2 + }, + { + "id": 1484, + "num": 5, + "color": 5, + "special": 0, + "length": 0 + }, + { + "id": 1485, + "num": 8, + "color": 2, + "special": 0, + "length": 1 + }, + { + "id": 1486, + "num": 13, + "color": 4, + "special": 0, + "length": 2 + }, + { + "id": 1487, + "num": 15, + "color": 4, + "special": 0, + "length": 0 + }, + { + "id": 1488, + "num": 19, + "color": 10, + "special": 0, + "length": 2 + }, + { + "id": 1489, + "num": 21, + "color": 10, + "special": 0, + "length": 0 + }, + { + "id": 1490, + "num": 32, + "color": 8, + "special": 0, + "length": 1 + }, + { + "id": 1491, + "num": 28, + "color": 3, + "special": 0, + "length": 2 + }, + { + "id": 1492, + "num": 29, + "color": 3, + "special": 0, + "length": 0 + }, + { + "id": 1493, + "num": 24, + "color": 1, + "special": 0, + "length": 1 + }, + { + "id": 1494, + "num": 14, + "color": 9, + "special": 10, + "length": 3, + "revolvingColor": 7 + }, + { + "id": 1495, + "num": 16, + "color": 9, + "special": 10, + "length": 0, + "revolvingColor": 7 + }, + { + "id": 1496, + "num": 18, + "color": 9, + "special": 10, + "length": 0, + "revolvingColor": 7 + } + ] + ] +} \ No newline at end of file diff --git a/assets/custom/Json/level1481.json.meta b/assets/custom/Json/level1481.json.meta new file mode 100644 index 0000000..efb22a2 --- /dev/null +++ b/assets/custom/Json/level1481.json.meta @@ -0,0 +1,6 @@ +{ + "ver": "1.0.2", + "uuid": "2db0f9bb-0c5f-4396-b8e8-8442225c0aa3", + "importer": "json", + "subMetas": {} +} \ No newline at end of file diff --git a/assets/resources/prefab/block/block0.prefab b/assets/resources/prefab/block/block0.prefab index ae63bbd..634a6a0 100644 --- a/assets/resources/prefab/block/block0.prefab +++ b/assets/resources/prefab/block/block0.prefab @@ -1484,9 +1484,6 @@ "magic_SkeletonData": { "__uuid__": "d0f588ae-3378-45a1-b3eb-9fab8e7bd03b" }, - "simple_SpriteFrame": { - "__uuid__": "9c34b08e-57a6-4f76-8a74-8095c9efa25a" - }, "_id": "" }, {