From e0ea3acb362da836692c0a89d3bede901819447b Mon Sep 17 00:00:00 2001 From: "COMPUTER\\EDY" <249929363@qq.com> Date: Thu, 9 Oct 2025 16:26:01 +0800 Subject: [PATCH] =?UTF-8?q?465=E5=85=B3=E6=9B=B4=E6=96=B0=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=EF=BC=8C=E5=A2=9E=E5=8A=A0=E9=92=A5=E5=8C=99=E9=94=81?= =?UTF-8?q?=E5=92=8C=E9=92=A5=E5=8C=99=E9=97=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Script/Block.ts | 15 +- assets/Script/Map.ts | 56 ++-- assets/Script/Wall.ts | 29 +- assets/Script/module/Tool/GameTool.ts | 4 +- assets/Script/prop/Lock.ts | 12 +- assets/custom/Json/level465.json | 15 +- assets/custom/Json/level476.json | 410 ++++++++++++++++++++++++++ assets/custom/Json/level476.json.meta | 6 + 8 files changed, 513 insertions(+), 34 deletions(-) create mode 100644 assets/custom/Json/level476.json create mode 100644 assets/custom/Json/level476.json.meta diff --git a/assets/Script/Block.ts b/assets/Script/Block.ts index ac7edf6..3d040e6 100644 --- a/assets/Script/Block.ts +++ b/assets/Script/Block.ts @@ -330,14 +330,14 @@ export default class Block extends cc.Component { let lock = cc.instantiate(MapConroler._instance.Block_Prop[this.type]); lock.parent = this.node; lock.setPosition(posConfig.pos1.x, posConfig.pos1.y); - lock.getComponent("Lock").init(this.block_Info.lockTime); + lock.getComponent("Lock").init(this.block_Info.lockTime, "block"); break; case BlockType.第二上锁块: let lock2 = cc.instantiate(MapConroler._instance.Block_Prop[3]); lock2.parent = this.node; lock2.color = cc.color(255, 125, 0); lock2.setPosition(posConfig.pos1.x, posConfig.pos1.y); - lock2.getComponent("Lock").init(this.block_Info.lockTime); + lock2.getComponent("Lock").init(this.block_Info.lockTime2, "block"); break; case BlockType.冻结块: let freeze = cc.instantiate(MapConroler._instance.Block_Prop[this.type]); @@ -710,11 +710,18 @@ export default class Block extends cc.Component { this.isTouch = false; MapConroler._instance.hammerMask.active = false; MapConroler._instance.node.parent.getChildByName("Bottom").getChildByName("destroyBtn").getComponent("btnControl").setTouch(true); - MapConroler._instance.costHammer(); + console.log("222使用特殊锤子", MapConroler._instance.hammerSpecial); + if (MapConroler._instance.hammerSpecial == true) { + MapConroler._instance.hammerSpecial = false; + } + else { + console.log("222使用普通锤子"); + MapConroler._instance.costHammer(); + } MapConroler._instance.usePause(); return false; } - if (this.type != BlockType.上锁块 && this.type != BlockType.冻结块) { + if (this.type != BlockType.上锁块 && this.type != BlockType.冻结块 && this.type != BlockType.第二上锁块) { MapConroler._instance.startUpdate(); if (this.type == BlockType.钥匙块) cc.fx.AudioManager._instance.playEffect("lockBlock1", null); diff --git a/assets/Script/Map.ts b/assets/Script/Map.ts index 42c1ec4..4da55b3 100644 --- a/assets/Script/Map.ts +++ b/assets/Script/Map.ts @@ -118,6 +118,7 @@ export default class MapConroler extends cc.Component { wallArray: any; // openWall: any; //开关墙数组 freezeWall: any; //冻结墙数组 + lockWall: any; //锁墙数组 riseFallBlcok: any; //升降地块数组 scheduleCallback: any;//倒计时用 homeCanTouch: boolean = true;//按钮可用状态 @@ -155,6 +156,7 @@ export default class MapConroler extends cc.Component { revolvingWallArray: any; //旋转门数组 hitSoundCount: number; hitSoundTime: number; + hammerSpecial: boolean = false; // mapInfo: number[][] = []; onLoad() { @@ -196,6 +198,7 @@ export default class MapConroler extends cc.Component { this.arr = []; // 初始化结算界面动画数组 this.isreview = false; this.is_frenzy = false; + this.hammerSpecial = false; this.revolving_state = 0; this.hitSoundCount = 0; this.hitSoundTime = 0; @@ -439,6 +442,7 @@ export default class MapConroler extends cc.Component { this.openWall = []; this.wallArray = []; this.freezeWall = []; + this.lockWall = []; this.riseFallBlcok = []; this.mapBlockArray = []; this.freezeArray = []; @@ -526,14 +530,6 @@ export default class MapConroler extends cc.Component { } - //创建方块 - // ... 已有代码 ... - - //创建方块 - // ... 已有代码 ... - - - blockInit() { let blockArray = cc.fx.GameConfig.BLOCK_INFO[0]; @@ -872,7 +868,8 @@ export default class MapConroler extends cc.Component { this.openWall.push(wall); else if (wall.getChildByName("wall").getComponent("Wall").special == 3) this.freezeWall.push(wall); - + else if (wall.getChildByName("wall").getComponent("Wall").special == 6) + this.lockWall.push(wall); break; case "left": node.opacity = 250; @@ -889,6 +886,8 @@ export default class MapConroler extends cc.Component { this.openWall.push(wall); else if (wall.getChildByName("wall").getComponent("Wall").special == 3) this.freezeWall.push(wall); + else if (wall.getChildByName("wall").getComponent("Wall").special == 6) + this.lockWall.push(wall); break; case "up": node.opacity = 250; @@ -907,6 +906,8 @@ export default class MapConroler extends cc.Component { this.openWall.push(wall); else if (wall.getChildByName("wall").getComponent("Wall").special == 3) this.freezeWall.push(wall); + else if (wall.getChildByName("wall").getComponent("Wall").special == 6) + this.lockWall.push(wall); break; case "down": node.opacity = 250; @@ -924,6 +925,8 @@ export default class MapConroler extends cc.Component { this.openWall.push(wall); else if (wall.getChildByName("wall").getComponent("Wall").special == 3) this.freezeWall.push(wall); + else if (wall.getChildByName("wall").getComponent("Wall").special == 6) + this.lockWall.push(wall); break; case "rightup": case "upright": node.opacity = 249; @@ -1507,6 +1510,16 @@ export default class MapConroler extends cc.Component { } } + changeLock() { + if (this.lockWall.length != 0) { + for (let i = 0; i < this.lockWall.length; i++) { + if (this.lockWall[i].getChildByName("lock")) { + this.lockWall[i].getChildByName("lock").getComponent("Lock").reduce(); + } + } + } + } + //检测是否可以通过门 passWall(jg, wallArray, node) { for (let i = 0; i < wallArray.length; i++) { @@ -1525,6 +1538,10 @@ export default class MapConroler extends cc.Component { jg = false; return jg; } + if (wallArray[i].getComponent("Wall").special == 6) { + jg = false; + return jg; + } //console.log(wallArray[i].getChildByName("wall").getComponent("Wall").color,node.getComponent("Block").color) if (wallArray[i].getComponent("Wall").color != node.getComponent("Block").color) { jg = false; @@ -1648,7 +1665,7 @@ export default class MapConroler extends cc.Component { } } if (direction == "down") { - console.log(x, (y - 1), this.mapBlocksWall[x][y - 1].getComponent("MapBlock").block_Id); + if (this.mapBlocksWall[x][y - 1].getComponent("MapBlock").block_Id != "" && this.mapBlocksWall[x][y - 1].getComponent("MapBlock").block_Id != "Wall" && this.mapBlocksWall[x][y - 1].getComponent("MapBlock").block_Id != id) { // console.log("下侧有物体1") @@ -1763,16 +1780,7 @@ export default class MapConroler extends cc.Component { } //门钥匙块,消除门的 else if (node.getComponent("Block").type == 14) { - // let lockBlock2 = this.node.children.filter(child => { - // if (child.getComponent("Block")) { - // if (child.getComponent("Block").type == 13) - // return child - // } - // }); - // if (lockBlock2.length > 0) - // for (let i = 0; i < lockBlock2.length; i++) { - // lockBlock2[i].getChildByName("lock").getComponent("Lock").reduce(); - // } + this.changeLock(); } @@ -2749,6 +2757,7 @@ export default class MapConroler extends cc.Component { id: "2002", num: -1 } + console.log("____________消耗锤子cost"); cc.fx.GameTool.shushu_Track("resource_cost", data); } @@ -3897,6 +3906,9 @@ export default class MapConroler extends cc.Component { } if (!this.hammer) { + this.hammerSpecial = true; + console.log("1111使用特殊锤子", this.hammerSpecial); + const timestamp = Date.now(); this.hammerMask.active = true; this.hammer = true; @@ -3910,8 +3922,8 @@ export default class MapConroler extends cc.Component { //连击播放声音 playHitSound() { this.hitSoundCount++; - if (this.hitSoundCount >= 5) { - this.hitSoundCount = 5; + if (this.hitSoundCount > 5) { + this.hitSoundCount = 1; } cc.fx.AudioManager._instance.playEffect("hit" + (this.hitSoundCount), null); this.hitSoundTime = Date.now(); // 记录当前播放时间 diff --git a/assets/Script/Wall.ts b/assets/Script/Wall.ts index 9b18ce3..ea5fc70 100644 --- a/assets/Script/Wall.ts +++ b/assets/Script/Wall.ts @@ -131,6 +131,7 @@ export default class Wall extends cc.Component { init(wall_Info, posX: number, posY: number, direction: any) { this.wall_Info = this.jsonDeepClone(wall_Info); + // this.open = true; if (wall_Info == null) { this.posX = posX; @@ -213,6 +214,7 @@ export default class Wall extends cc.Component { //创建特殊类型门 initType() { + switch (this.special) { case WallSpecial.星星门: let star = cc.instantiate(MapConroler._instance.Block_Prop[this.special]); @@ -261,7 +263,32 @@ export default class Wall extends cc.Component { // this.revolvingNode.children[0].scaleX = -this.revolvingNode.children[0].scaleX; // } } + break; + case WallSpecial.上锁门: + let lock = cc.instantiate(MapConroler._instance.Block_Prop[3]); + lock.parent = this.node.parent; + if (this.wall_Info.length == 0) { + lock.opacity = 0; + } + lock.scaleX = lock.scaleY = 0.65; + if (this.direction == "up") { + lock.setPosition((this.wall_Info.length - 1) * 60 - 10, 38); + if (this.wall_Info.length == 1) lock.x += 5; + } + else if (this.direction == "down") { + lock.setPosition((this.wall_Info.length - 1) * 60 - 10, -38); + if (this.wall_Info.length == 1) lock.x += 5; + } + if (this.direction == "right") { + lock.setPosition(30, (this.wall_Info.length - 1) * 60); + if (this.wall_Info.length == 1) lock.y += 10; + } + else if (this.direction == "left") { + lock.setPosition(-46, (this.wall_Info.length - 1) * 60); + if (this.wall_Info.length == 1) lock.y += 10; + } + lock.getComponent("Lock").init(this.wall_Info.lockTime, "wall"); break; } } @@ -332,7 +359,7 @@ export default class Wall extends cc.Component { if (this.freezeNode.active == true) return; } - if (this.special == 4 || this.special == 5) { + if (this.special == 4 || this.special == 5 || this.special == 6) { return; } diff --git a/assets/Script/module/Tool/GameTool.ts b/assets/Script/module/Tool/GameTool.ts index ea7289f..8258f20 100644 --- a/assets/Script/module/Tool/GameTool.ts +++ b/assets/Script/module/Tool/GameTool.ts @@ -398,8 +398,8 @@ var GameTool = { //关卡上限 maxLevel() { let jg = false; - if (cc.fx.GameConfig.GM_INFO.level > 439) { - cc.fx.GameConfig.GM_INFO.level = 440; + if (cc.fx.GameConfig.GM_INFO.level > 474) { + cc.fx.GameConfig.GM_INFO.level = 475; jg = true; } return jg; diff --git a/assets/Script/prop/Lock.ts b/assets/Script/prop/Lock.ts index 35a821e..ea02a31 100644 --- a/assets/Script/prop/Lock.ts +++ b/assets/Script/prop/Lock.ts @@ -16,7 +16,7 @@ const { ccclass, property } = cc._decorator; export default class Lock extends cc.Component { static _instance: any; time: number = 0; - + type: string = "block" // mapInfo: number[][] = []; onLoad() { @@ -26,8 +26,9 @@ export default class Lock extends cc.Component { start() { } - init(time) { + init(time, type) { if (time) this.time = time; + if (type) this.type = type; this.node.getChildByName("time").active = true; NumberToImage.numberToImageNodes(this.time, 20, 8, "lock_", this.node.getChildByName("time"), false); @@ -37,7 +38,12 @@ export default class Lock extends cc.Component { this.time -= 1; NumberToImage.numberToImageNodes(this.time, 20, 8, "lock_", this.node.getChildByName("time"), false); if (this.time <= 0) { - if (this.node.parent) this.node.parent.getComponent("Block").type = 0; + if (this.type == "block") { + if (this.node.parent) this.node.parent.getComponent("Block").type = 0; + } + else if (this.type == "wall") { + if (this.node.parent) this.node.parent.getChildByName("wall").getComponent("Wall").special = 0; + } this.node.destroy(); this.node.removeFromParent(); } diff --git a/assets/custom/Json/level465.json b/assets/custom/Json/level465.json index a759c7c..25df22c 100644 --- a/assets/custom/Json/level465.json +++ b/assets/custom/Json/level465.json @@ -224,11 +224,22 @@ }, { "block": 1, - "color": 2, + "color": 1, "type": 0, "position": { "x": 300, - "y": 360, + "y": 0, + "z": 0 + }, + "id": 340 + }, + { + "block": 0, + "color": 1, + "type": 0, + "position": { + "x": 360, + "y": 120, "z": 0 }, "id": 350 diff --git a/assets/custom/Json/level476.json b/assets/custom/Json/level476.json new file mode 100644 index 0000000..af040a4 --- /dev/null +++ b/assets/custom/Json/level476.json @@ -0,0 +1,410 @@ +{ + "LEVEL_INFO": [ + { + "risefall": [], + "id": "1", + "map": [ + 8, + 10 + ], + "time": 500, + "gap": [ + { + "x": 1, + "y": 8, + "z": 0 + }, + { + "x": 1, + "y": 7, + "z": 0 + }, + { + "x": 2, + "y": 7, + "z": 0 + }, + { + "x": 2, + "y": 8, + "z": 0 + }, + { + "x": 6, + "y": 8, + "z": 0 + }, + { + "x": 5, + "y": 8, + "z": 0 + }, + { + "x": 5, + "y": 7, + "z": 0 + }, + { + "x": 6, + "y": 7, + "z": 0 + }, + { + "x": 1, + "y": 1, + "z": 0 + }, + { + "x": 6, + "y": 1, + "z": 0 + } + ] + } + ], + "BLOCK_INFO": [ + [ + { + "block": 23, + "color": 1, + "type": 0, + "position": { + "x": -240, + "y": -240, + "z": 0 + }, + "id": 210 + }, + { + "block": 23, + "color": 1, + "type": 0, + "position": { + "x": 360, + "y": -240, + "z": 0 + }, + "id": 220 + }, + { + "block": 2, + "color": 6, + "type": 8, + "position": { + "x": 0, + "y": 240, + "z": 0 + }, + "id": 230 + }, + { + "block": 2, + "color": 8, + "type": 8, + "position": { + "x": 120, + "y": 240, + "z": 0 + }, + "id": 240 + }, + { + "block": 1, + "color": 8, + "type": 0, + "position": { + "x": -120, + "y": 120, + "z": 0 + }, + "id": 250 + }, + { + "block": 1, + "color": 6, + "type": 0, + "position": { + "x": 360, + "y": 120, + "z": 0 + }, + "id": 260 + }, + { + "block": 22, + "color": 5, + "type": 0, + "position": { + "x": 120, + "y": 0, + "z": 0 + }, + "id": 270 + }, + { + "block": 0, + "color": 1, + "type": 6, + "position": { + "x": -240, + "y": 0, + "z": 0 + }, + "boomTime": 25, + "id": 280 + }, + { + "block": 0, + "color": 7, + "type": 0, + "position": { + "x": 360, + "y": 0, + "z": 0 + }, + "id": 290 + }, + { + "block": 1, + "color": 7, + "type": 0, + "position": { + "x": 360, + "y": -120, + "z": 0 + }, + "id": 300 + }, + { + "block": 0, + "color": 7, + "type": 0, + "position": { + "x": 0, + "y": -240, + "z": 0 + }, + "id": 310 + }, + { + "block": 0, + "color": 1, + "type": 0, + "position": { + "x": 360, + "y": -360, + "z": 0 + }, + "id": 320 + }, + { + "block": 0, + "color": 10, + "type": 0, + "position": { + "x": 120, + "y": -240, + "z": 0 + }, + "id": 330 + }, + { + "block": 0, + "color": 3, + "type": 0, + "position": { + "x": -240, + "y": -360, + "z": 0 + }, + "id": 340 + }, + { + "block": 5, + "color": 2, + "type": 0, + "position": { + "x": 120, + "y": -480, + "z": 0 + }, + "id": 350 + }, + { + "block": 0, + "color": 5, + "type": 9, + "position": { + "x": -120, + "y": -360, + "z": 0 + }, + "adhesiveTime": 2, + "id": 360 + }, + { + "block": 0, + "color": 3, + "type": 9, + "position": { + "x": -120, + "y": -480, + "z": 0 + }, + "adhesiveTime": 1, + "id": 370 + }, + { + "block": 0, + "color": 3, + "type": 9, + "position": { + "x": 240, + "y": -360, + "z": 0 + }, + "adhesiveTime": 2, + "id": 380 + }, + { + "block": 0, + "color": 10, + "type": 9, + "position": { + "x": 240, + "y": -480, + "z": 0 + }, + "adhesiveTime": 1, + "id": 390 + }, + { + "block": 1, + "color": 10, + "type": 0, + "position": { + "x": -120, + "y": -120, + "z": 0 + }, + "floor": 1, + "floorTime": 11, + "id": 400 + }, + { + "block": 0, + "color": 5, + "type": 0, + "position": { + "x": 0, + "y": -120, + "z": 0 + }, + "floor": 1, + "floorTime": 11, + "id": 410 + }, + { + "block": 0, + "color": 8, + "type": 0, + "position": { + "x": -120, + "y": -240, + "z": 0 + }, + "floor": 1, + "floorTime": 11, + "id": 420 + } + ] + ], + "WALL_INFO": [ + [ + { + "id": 2, + "num": 2, + "color": 7, + "special": 0, + "length": 1 + }, + { + "id": 3, + "num": 3, + "color": 2, + "special": 4, + "length": 2 + }, + { + "id": 4, + "num": 4, + "color": 2, + "special": 4, + "length": 0 + }, + { + "id": 5, + "num": 13, + "color": 1, + "special": 0, + "length": 1 + }, + { + "id": 6, + "num": 15, + "color": 3, + "special": 0, + "length": 1 + }, + { + "id": 7, + "num": 26, + "color": 5, + "special": 0, + "length": 2 + }, + { + "id": 8, + "num": 27, + "color": 5, + "special": 0, + "length": 0 + }, + { + "id": 9, + "num": 25, + "color": 10, + "special": 0, + "length": 1 + }, + { + "id": 10, + "num": 14, + "color": 8, + "special": 4, + "length": 2 + }, + { + "id": 11, + "num": 16, + "color": 8, + "special": 4, + "length": 0 + }, + { + "id": 12, + "num": 8, + "color": 6, + "special": 0, + "length": 2 + }, + { + "id": 13, + "num": 12, + "color": 6, + "special": 0, + "length": 0 + } + ] + ] +} \ No newline at end of file diff --git a/assets/custom/Json/level476.json.meta b/assets/custom/Json/level476.json.meta new file mode 100644 index 0000000..7130b52 --- /dev/null +++ b/assets/custom/Json/level476.json.meta @@ -0,0 +1,6 @@ +{ + "ver": "1.0.2", + "uuid": "5088eeda-df98-400d-b59f-1efe17017a93", + "importer": "json", + "subMetas": {} +} \ No newline at end of file