fix(map): correct hero position calculation and loop order
修复了MissionHeroComp的遍历顺序,同时修正了MissionCardComp中的节点索引计算逻辑,匹配实际的视觉排布和MoveComp中的赋值规则,添加了调试日志方便排查位置问题。
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user