diff --git a/assets/script/game/map/MissionCardComp.ts b/assets/script/game/map/MissionCardComp.ts index 264f4dc8..000bb5fb 100644 --- a/assets/script/game/map/MissionCardComp.ts +++ b/assets/script/game/map/MissionCardComp.ts @@ -901,9 +901,26 @@ export class MissionCardComp extends CCComp { return; } - // 计算目标 node_index: lane_index=0 对应 1排(1-3), lane_index=1 对应 2排(4-6) - // lane=0 上路, lane=1 中路, lane=2 下路 - const expectedNodeIndex = model.lane_index * 3 + model.lane + 1; + // MoveComp.ts 里的 assignment: + // lanePriority = [1, 0, 2]; // slotIndex 0->中路(1), 1->上路(0), 2->下路(2) + // laneIdx = lanePriority[slotIndex % 3]; + // col = Math.floor(slotIndex / 3); + // model.lane = laneIdx; + // model.lane_index = col; + // + // 节点顺序预期: + // node_index=1 对应 1排上路 (lane=0, lane_index=0) + // node_index=2 对应 1排中路 (lane=1, lane_index=0) + // node_index=3 对应 1排下路 (lane=2, lane_index=0) + // node_index=4 对应 2排上路 (lane=0, lane_index=1) + // node_index=5 对应 2排中路 (lane=1, lane_index=1) + // node_index=6 对应 2排下路 (lane=2, lane_index=1) + // 因为 1排中路 在视觉上是最前面的,实际按路排(上/中/下): + const laneOrder = model.lane === 0 ? 0 : (model.lane === 1 ? 1 : 2); + const expectedNodeIndex = model.lane_index * 3 + laneOrder + 1; + + mLogger.log(this.debugMode, "MissionCardComp", `ensureHeroInfoPanel calculation: lane=${model.lane}, lane_index=${model.lane_index} -> expectedNodeIndex=${expectedNodeIndex}`); + const comp = this.cachedHInfoComps.get(expectedNodeIndex); if (!comp) { diff --git a/assets/script/game/map/MissionHeroComp.ts b/assets/script/game/map/MissionHeroComp.ts index 2a3af48d..229ecd5c 100644 --- a/assets/script/game/map/MissionHeroComp.ts +++ b/assets/script/game/map/MissionHeroComp.ts @@ -197,8 +197,8 @@ export class MissionHeroCompComp extends CCComp { // 优先中路(1) -> 上路(0) -> 下路(2) const priority = [1, 0, 2]; - for (const lane of priority) { - for (let indexInLane = 0; indexInLane < MissionHeroCompComp.HERO_LANE_CAP; indexInLane++) { + for (let indexInLane = 0; indexInLane < MissionHeroCompComp.HERO_LANE_CAP; indexInLane++) { + for (const lane of priority) { if (!occupied[lane][indexInLane]) { return { lane, indexInLane }; }