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++) {