From 7993945c7e6c5f7b1712c77648c9779622d70c31 Mon Sep 17 00:00:00 2001 From: "COMPUTER\\EDY" <249929363@qq.com> Date: Fri, 16 Jan 2026 11:11:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Script/Block.ts | 48 +++++++++++++++++++++--------- assets/Script/JiaZai.ts | 7 ++++- assets/Script/Map.ts | 18 ++++++++--- assets/career/script/CareerItem.ts | 12 +------- assets/career/script/CareerList.ts | 24 ++++++++------- assets/custom/Json/level957.json | 4 +-- 6 files changed, 71 insertions(+), 42 deletions(-) diff --git a/assets/Script/Block.ts b/assets/Script/Block.ts index 66d4cdb..3a778a5 100644 --- a/assets/Script/Block.ts +++ b/assets/Script/Block.ts @@ -936,8 +936,12 @@ export default class Block extends cc.Component { if (this.teamBlocks[i].uuid != this.node.uuid) { this.teamBlocks[i].zIndex = 200; for (let j = 1; j < this.teamBlocks[i].children.length; j++) { - if (this.teamBlocks[i].children[j].name != "moveFloor") - this.teamBlocks[i].children[j].active = false; + if (this.teamBlocks[i].children[j].name != "moveFloor") { + if (this.teamBlocks[i].children[j]) { + this.teamBlocks[i].children[j].active = false; + } + } + } } } @@ -997,7 +1001,9 @@ export default class Block extends cc.Component { this.teamBlocks[i].getComponent("Block").blockFall(localTemp2, false); for (let j = 1; j < this.teamBlocks[i].children.length; j++) { if (this.teamBlocks[i].children[j].name != "moveFloor" && this.teamBlocks[i].children[j].name != "hit") - this.teamBlocks[i].children[j].active = true; + if (this.teamBlocks[i].children[j]) { + this.teamBlocks[i].children[j].active = true; + } } } } @@ -1424,8 +1430,9 @@ export default class Block extends cc.Component { } if (type) { for (let i = 0; i < this.node.children.length; i++) { - if (this.node.children[i].name == "left" || this.node.children[i].name == "right" || this.node.children[i].name == "top" || this.node.children[i].name == "down") + if (this.node.children[i].name == "left" || this.node.children[i].name == "right" || this.node.children[i].name == "top" || this.node.children[i].name == "down") { this.node.children[i].active = true; + } } } this.node.on(cc.Node.EventType.TOUCH_START, this.touchStart, this); @@ -1470,10 +1477,14 @@ export default class Block extends cc.Component { if (this.block_Info.floor == null && this.block_Info.floorTime == null) return; this.block_Info.floor = null; this.block_Info.floorTime = null; - - for (let i = 0; i < this.node.children.length; i++) { - if (this.node.children[i].name == "floor" || this.node.children[i].name == "moveFloor") { - this.node.children[i].active = false; + this.moveFloorPd = null; + for (let i = this.node.children.length - 1; i >= 0; i--) { + if (this.node.children[i]) { + if (this.node.children[i].name == "floor" || this.node.children[i].name == "moveFloor") { + this.node.children[i].active = false; + // this.node.children[i].removeFromParent(); + // this.node.children[i].destroy(); + } } } if (this.adhesiveNode.length > 0) { @@ -1481,20 +1492,28 @@ export default class Block extends cc.Component { this.adhesiveNode[i].opacity = 255; } } - + console.log("_____________删开始"); if (this.teamBlocks.length > 1) { for (let j = 0; j < this.teamBlocks.length; j++) { for (let k = 0; k < this.teamBlocks[j].children.length; k++) { - if (this.teamBlocks[j].children[k].getComponent("lq_collide") != undefined) { - if (this.teamBlocks[j].children[k].getComponent("lq_collide").data_string == "-2") { - this.teamBlocks[j].children[k].active = false; + if (this.teamBlocks[j].children[k].active) { + if (this.teamBlocks[j].children[k].getComponent("lq_collide") != undefined) { + // if (this.teamBlocks[j].children[k].getComponent("lq_collide").data_string == "-2") { + // this.teamBlocks[j].children[k].active = false; + // // this.teamBlocks[j].children[k].destroy(); + // } + // else if (this.teamBlocks[j].children[k].getComponent("lq_collide").data_string == "-1") { + // this.teamBlocks[j].children[k].active = true; + // } } } + } } } + debugger; this.teamBlocks = []; - + console.log("_____________删除完毕2"); this.node.getChildByName("icon").active = true; if (this.type == BlockType.冻结块) { if (this.node.getChildByName("freeze")) { @@ -1777,7 +1796,7 @@ export default class Block extends cc.Component { const newY = this.node.y + delta.y; const distance = Math.sqrt(Math.pow(newX - this.node.x, 2) + Math.pow(newY - this.node.y, 2)); let mag = Math.round(delta.mag()); - + console.log("移动距离", this.moveX, this.moveY); // 脱离接触恢复可移动状态 if (this.moveY === 1) { if (this.touchPointY <= this.node.y + this.node.height / 2) { @@ -2144,6 +2163,7 @@ export default class Block extends cc.Component { } setTeamBlocks(teamBlocks) { + // console.log("自己的類型::", this.block_Info.block, teamBlocks); this.teamBlocks = teamBlocks; } diff --git a/assets/Script/JiaZai.ts b/assets/Script/JiaZai.ts index 0052742..1e73f29 100644 --- a/assets/Script/JiaZai.ts +++ b/assets/Script/JiaZai.ts @@ -3059,6 +3059,8 @@ export default class JiaZai extends cc.Component { } openPosition() { + if (this.RankNode == null || this.RankNode == undefined) + return; let scrollVIew = this.RankNode.getChildByName("ScrollView"); let top = this.node.getChildByName("Load").getChildByName("Top"); // 获取CareerList组件实例 @@ -3109,6 +3111,8 @@ export default class JiaZai extends cc.Component { //授权位置信息 runAuthorize() { + if (this.RankNode == null || this.RankNode == undefined) + return; let scrollVIew = this.RankNode.getChildByName("ScrollView"); let top = this.node.getChildByName("Load").getChildByName("Top"); // 获取CareerList组件实例 @@ -3171,7 +3175,8 @@ export default class JiaZai extends cc.Component { let top = this.node.getChildByName("Load").getChildByName("Top"); top.getChildByName("posBtn").active = true; top.getChildByName("topBtn").active = false; - + if (this.RankNode == null || this.RankNode == undefined) + return; let scrollVIew = this.RankNode.getChildByName("ScrollView"); // 获取CareerList组件实例 let careerList = scrollVIew.getComponent("CareerList"); diff --git a/assets/Script/Map.ts b/assets/Script/Map.ts index 8d5b824..c836e30 100644 --- a/assets/Script/Map.ts +++ b/assets/Script/Map.ts @@ -687,7 +687,7 @@ export default class MapConroler extends cc.Component { let BLOCKS_PER_FRAME = 1; // 初始每帧创建的方块数量 const MAX_PER_FRAME = 10; // 每帧最大创建数量 const MIN_PER_FRAME = 1; // 每帧最小创建数量 - + let nianHe = false; const createBlocks = () => { const startTime = performance.now(); for (let i = 0; i < BLOCKS_PER_FRAME && index < blockArray.length; i++) { @@ -733,6 +733,7 @@ export default class MapConroler extends cc.Component { this.blockNum += 1; } } else if (blockInfo.type == 9) { + nianHe = true; if (blockInfo.adhesiveTime < 2) { index++; continue; @@ -783,7 +784,12 @@ export default class MapConroler extends cc.Component { }, 0); } else { if (this.floorMove == true) { - this.addMoveFloor(); + let delayTime = 0; + if (nianHe == true) + delayTime = 200; + setTimeout(() => { + this.addMoveFloor(); + }, delayTime); } } }; @@ -2106,8 +2112,12 @@ export default class MapConroler extends cc.Component { for (let i = 0; i < floorBlock.length; i++) { for (let j = 0; j < floorBlock[i].children.length; j++) { - if (floorBlock[i].children[j].name == "floor" || floorBlock[i].children[j].name == "moveFloor") { - floorBlock[i].children[j].getComponent("Floor").reduce(1); + if (floorBlock[i]) { + if (floorBlock[i].children[j]) { + if (floorBlock[i].children[j].name == "floor" || floorBlock[i].children[j].name == "moveFloor") { + floorBlock[i].children[j].getComponent("Floor").reduce(1); + } + } } } } diff --git a/assets/career/script/CareerItem.ts b/assets/career/script/CareerItem.ts index 68b2ad2..2773007 100644 --- a/assets/career/script/CareerItem.ts +++ b/assets/career/script/CareerItem.ts @@ -22,17 +22,7 @@ export default class CareerItem extends cc.Component { /**数据改变时调用 */ public dataChanged() { this.randerChildren = []; - // if (this.data == undefined) { - // this.node.active = false; - // return; - // } - // let useravatarIcon = this.data.useravatarIcon; - // useravatarIcon = "kuang_" + (parseInt(useravatarIcon) + 1); - // this.node.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = - // this.ui.getSpriteFrame(useravatarIcon); - // this.data.username = cc.fx.GameTool.subName(this.data.username, 7); - // let name = this.data.username; - // if (name == "user") name = "匿名玩家"; + for (let i = 4; i < 12; i++) { this.node.children[i].getChildByName("name").getComponent(cc.Label).string = ""; this.node.children[i].getChildByName("level").getComponent(cc.Label).string = ""; diff --git a/assets/career/script/CareerList.ts b/assets/career/script/CareerList.ts index e9c47a3..f199b34 100644 --- a/assets/career/script/CareerList.ts +++ b/assets/career/script/CareerList.ts @@ -296,11 +296,13 @@ export default class CareerList extends cc.Component { if (viewPos.y > bufferZone && item.y - offset - this.padding_buttom > -this.content.height - firstRenderOffsetY) { if (item.getComponent(CareerItem)) { let itemRender: CareerItem = item.getComponent(CareerItem); - let itemIndex = itemRender.itemIndex + items.length; - itemRender.itemIndex = itemIndex; - itemRender.data = this.itemDataList[itemIndex]; - itemRender.dataChanged(); - item.y = item.y - offset; + if (items != null && items != undefined) { + let itemIndex = itemRender.itemIndex + items.length; + itemRender.itemIndex = itemIndex; + itemRender.data = this.itemDataList[itemIndex]; + itemRender.dataChanged(); + item.y = item.y - offset; + } } } } @@ -311,11 +313,13 @@ export default class CareerList extends cc.Component { if (viewPos.y < -bufferZone && item.y + offset + this.padding_top < -firstRenderOffsetY) { if (item.getComponent(CareerItem)) { let itemRender: CareerItem = item.getComponent(CareerItem); - let itemIndex = itemRender.itemIndex - items.length; - itemRender.itemIndex = itemIndex; - itemRender.data = this.itemDataList[itemIndex]; - itemRender.dataChanged(); - item.y = item.y + offset; + if (items != null && items != undefined) { + let itemIndex = itemRender.itemIndex - items.length; + itemRender.itemIndex = itemIndex; + itemRender.data = this.itemDataList[itemIndex]; + itemRender.dataChanged(); + item.y = item.y + offset; + } } } } diff --git a/assets/custom/Json/level957.json b/assets/custom/Json/level957.json index 83bea7d..75d1ead 100644 --- a/assets/custom/Json/level957.json +++ b/assets/custom/Json/level957.json @@ -167,7 +167,7 @@ { "block": 1, "color": 3, - "type": 9, + "type": 0, "position": { "x": 120, "y": 240, @@ -182,7 +182,7 @@ { "block": 1, "color": 10, - "type": 9, + "type": 0, "position": { "x": 120, "y": 120,