fix: 修复任务卡牌池等级显示错误并调整角色控制器UI布局
- 修复 MissionCardComp 中等级节点匹配逻辑,避免因节点命名不一致导致的显示错误 - 调整 role_controller.prefab 中多个UI元素的位置、尺寸和间距,优化布局
This commit is contained in:
@@ -433,17 +433,37 @@ export class MissionCardComp extends CCComp {
|
||||
if (nobg) {
|
||||
nobg.active = !this.canUpPool();
|
||||
}
|
||||
const label = this.cards_up.getChildByName("coin").getChildByName("num").getComponent(Label);
|
||||
if (!label) return;
|
||||
const coinNode = this.cards_up.getChildByName("coin");
|
||||
const label = coinNode?.getChildByName("num")?.getComponent(Label);
|
||||
if (this.poolLv >= CARD_POOL_MAX_LEVEL) {
|
||||
label.string = `0`;
|
||||
if (label) {
|
||||
label.string = `0`;
|
||||
}
|
||||
} else {
|
||||
label.string = `${this.getUpgradeCost(this.poolLv)}`;
|
||||
if (label) {
|
||||
label.string = `${this.getUpgradeCost(this.poolLv)}`;
|
||||
}
|
||||
}
|
||||
if (this.pool_lv_node) {
|
||||
for (let i = 1; i <= CARD_POOL_MAX_LEVEL; i++) {
|
||||
const n = this.pool_lv_node.getChildByName(`lv${i}`);
|
||||
if (n) n.active = i === this.poolLv;
|
||||
let hasMatchedNode = false;
|
||||
const children = this.pool_lv_node.children;
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
const node = children[i];
|
||||
const lvText = node.name.match(/\d+/)?.[0];
|
||||
const lv = lvText ? Number(lvText) : (i + 1);
|
||||
const active = lv === this.poolLv;
|
||||
node.active = active;
|
||||
if (active) {
|
||||
hasMatchedNode = true;
|
||||
}
|
||||
}
|
||||
if (!hasMatchedNode) {
|
||||
for (let i = 1; i <= CARD_POOL_MAX_LEVEL; i++) {
|
||||
const n = this.pool_lv_node.getChildByName(`lv${i}`);
|
||||
if (n) {
|
||||
n.active = i === this.poolLv;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mLogger.log(this.debugMode, "MissionCardComp", "pool lv ui update", {
|
||||
|
||||
Reference in New Issue
Block a user