feat(MissionCardComp): add detailed debug logging for card operations
新增多处调试日志,用于追踪任务卡片组件的卡片构建、缓存、分发和面板显示流程,方便排查卡片相关的运行时问题。
This commit is contained in:
@@ -319,6 +319,10 @@ export class MissionCardComp extends CCComp {
|
||||
this.node.active = true;
|
||||
}
|
||||
const cards = this.buildDrawCards();
|
||||
mLogger.log(this.debugMode, "MissionCardComp", "onMissionStart buildDrawCards", {
|
||||
cardsLength: cards.length,
|
||||
cards: cards.map(c => ({ uuid: c.uuid, type: c.type, name: c.name }))
|
||||
});
|
||||
this.dispatchCardsToSlots(cards);
|
||||
|
||||
// 重置购买记录并填充装备商店
|
||||
@@ -1188,7 +1192,23 @@ export class MissionCardComp extends CCComp {
|
||||
this.cards_node.addChild(node);
|
||||
const comp = node.getComponent(CardComp) || node.addComponent(CardComp);
|
||||
this.cardComps.push(comp);
|
||||
mLogger.log(this.debugMode, "MissionCardComp", "cacheCardComps instantiate", {
|
||||
index: i,
|
||||
nodeName: node.name,
|
||||
nodeActive: node.active,
|
||||
nodeWorldPos: node.worldPosition,
|
||||
parentName: this.cards_node.name,
|
||||
parentActive: this.cards_node.active,
|
||||
parentWorldPos: this.cards_node.worldPosition,
|
||||
cardPrefabValid: this.cardPrefab.isValid
|
||||
});
|
||||
}
|
||||
} else {
|
||||
mLogger.log(this.debugMode, "MissionCardComp", "cacheCardComps failed", {
|
||||
cardPrefabValid: this.cardPrefab?.isValid,
|
||||
cards_nodeValid: this.cards_node?.isValid,
|
||||
cards_nodeActive: this.cards_node?.active
|
||||
});
|
||||
}
|
||||
|
||||
const skillNodes = [this.skill_card1, this.skill_card2, this.skill_card3];
|
||||
@@ -1269,9 +1289,28 @@ export class MissionCardComp extends CCComp {
|
||||
if (this.cardPanNode && this.cardPanNode.isValid) {
|
||||
this.cardPanNode.active = true;
|
||||
this.cardPanNode.setPosition(0, this.cardPanelShowY, 0);
|
||||
mLogger.log(this.debugMode, "MissionCardComp", "enterPreparePhase cardPanNode", {
|
||||
active: this.cardPanNode.active,
|
||||
position: this.cardPanNode.position,
|
||||
worldPos: this.cardPanNode.worldPosition,
|
||||
parentName: this.cardPanNode.parent?.name,
|
||||
parentActive: this.cardPanNode.parent?.active,
|
||||
parentWorldPos: this.cardPanNode.parent?.worldPosition,
|
||||
cards_nodeActive: this.cards_node?.active,
|
||||
cards_nodeWorldPos: this.cards_node?.worldPosition,
|
||||
cards_nodeChildren: this.cards_node?.children.length
|
||||
});
|
||||
}
|
||||
// 滑动到英雄面板
|
||||
this.slideToPanel(0);
|
||||
|
||||
mLogger.log(this.debugMode, "MissionCardComp", "enterPreparePhase herosPanNode", {
|
||||
herosPanNodeActive: this.herosPanNode?.active,
|
||||
herosPanNodePos: this.herosPanNode?.position,
|
||||
herosPanNodeWorldPos: this.herosPanNode?.worldPosition,
|
||||
currentPanelIndex: this.currentPanelIndex,
|
||||
panelSlideWidth: this.panelSlideWidth
|
||||
});
|
||||
}
|
||||
|
||||
private enterBattlePhase() {
|
||||
@@ -1491,10 +1530,17 @@ export class MissionCardComp extends CCComp {
|
||||
for (let i = 0; i < this.cardComps.length; i++) {
|
||||
if (this.cardComps[i]) {
|
||||
const accepted = this.cardComps[i].applyDrawCard(cards[i] ?? null);
|
||||
const node = this.cardComps[i].node;
|
||||
mLogger.log(this.debugMode, "MissionCardComp", "dispatch card", {
|
||||
index: i,
|
||||
card: cards[i]?.uuid ?? 0,
|
||||
accepted
|
||||
accepted,
|
||||
nodeActive: node?.active,
|
||||
nodeWorldPos: node?.worldPosition,
|
||||
nodeScale: node?.scale,
|
||||
parentName: node?.parent?.name,
|
||||
parentActive: node?.parent?.active,
|
||||
parentWorldPos: node?.parent?.worldPosition
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user