From 8f65282af771359081412732625c04b40fe5228f Mon Sep 17 00:00:00 2001 From: panw Date: Wed, 13 May 2026 17:21:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(map):=20=E4=BF=AE=E5=A4=8D=E8=8B=B1?= =?UTF-8?q?=E9=9B=84=E4=BD=8D=E7=BD=AE=E5=8F=98=E6=9B=B4=E6=97=B6=E7=9A=84?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E7=BB=91=E5=AE=9A=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根据英雄的lane和lane_index重新计算期望的节点索引,当实际节点不匹配时将英雄卡片转移到正确的节点上,隐藏旧节点并激活新节点绑定最新数据 --- assets/script/game/map/MissionCardComp.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/assets/script/game/map/MissionCardComp.ts b/assets/script/game/map/MissionCardComp.ts index 000bb5fb..78dc79b9 100644 --- a/assets/script/game/map/MissionCardComp.ts +++ b/assets/script/game/map/MissionCardComp.ts @@ -965,6 +965,27 @@ export class MissionCardComp extends CCComp { removeKeys.push(eid); return; } + + // 检查英雄是否改变了位置 (lane 或 lane_index 发生了变化) + const laneOrder = item.model.lane === 0 ? 0 : (item.model.lane === 1 ? 1 : 2); + const expectedNodeIndex = item.model.lane_index * 3 + laneOrder + 1; + + if (item.comp.node_index !== expectedNodeIndex) { + // 如果位置变了,需要转移到新的节点上 + const newComp = this.cachedHInfoComps.get(expectedNodeIndex); + if (newComp) { + // 隐藏旧节点 + item.node.active = false; + + // 转移到新节点 + item.comp = newComp; + item.node = newComp.node; + item.node.active = true; + item.comp.bindData(eid, item.model); + item.comp.setBattlePhase(this.isBattlePhase); + } + } + this.updateHeroInfoPanel(item); }); for (let i = 0; i < removeKeys.length; i++) {