fix(map): 修复任务卡片池等级UI显示逻辑
1. 移除了旧的卡池升级按钮UI注释代码 2. 新增卡池等级升级倒计时显示逻辑 3. 修复updateCoinAndCostUI调用updatePoolLvUI的逻辑 4. 从MissionComp获取卡池升级所需波次配置
This commit is contained in:
@@ -49,6 +49,7 @@ import { FacSet, FightSet } from "../common/config/GameSet";
|
||||
import { MoveComp } from "../hero/MoveComp";
|
||||
import { MissionHeroComp } from "./MissionHeroComp";
|
||||
import { MissionEconomy } from "./MissionEconomy";
|
||||
import { MissionComp } from "./MissionComp";
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
@@ -1022,23 +1023,6 @@ export class MissionCardComp extends CCComp {
|
||||
}
|
||||
/** 更新升级按钮上的等级文案,反馈当前卡池层级 */
|
||||
private updatePoolLvUI() {
|
||||
// if (this.cards_up) {
|
||||
// const nobg = this.cards_up.getChildByName("nobg");
|
||||
// if (nobg) {
|
||||
// nobg.active = !this.canUpPool();
|
||||
// }
|
||||
// const coinNode = this.cards_up.getChildByName("coin");
|
||||
// const label = coinNode?.getChildByName("num")?.getComponent(Label);
|
||||
// if (this.poolLv >= CARD_POOL_MAX_LEVEL) {
|
||||
// if (label) {
|
||||
// label.string = `0`;
|
||||
// }
|
||||
// } else {
|
||||
// if (label) {
|
||||
// label.string = `${this.getUpgradeCost(this.poolLv)}`;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if (this.pool_lv_node) {
|
||||
this.pool_lv_node.active = true;
|
||||
const lv = Math.max(CARD_POOL_INIT_LEVEL, Math.min(CARD_POOL_MAX_LEVEL, Math.floor(this.poolLv)));
|
||||
@@ -1049,12 +1033,39 @@ export class MissionCardComp extends CCComp {
|
||||
label.string = `lv.${lv}`;
|
||||
}
|
||||
}
|
||||
// const widget = this.pool_lv_node.getComponent(Widget);
|
||||
// if (widget) widget.updateAlignment();
|
||||
// this.pool_lv_node.children.forEach(child => {
|
||||
// const childWidget = child.getComponent(Widget);
|
||||
// if (childWidget) childWidget.updateAlignment();
|
||||
// });
|
||||
|
||||
const nextNode = this.pool_lv_node.getChildByName("next");
|
||||
if (nextNode) {
|
||||
const nextLabel = nextNode.getComponent(Label);
|
||||
if (nextLabel) {
|
||||
if (this.poolLv >= CARD_POOL_MAX_LEVEL) {
|
||||
nextLabel.string = `已满级`;
|
||||
} else {
|
||||
let upgradeWaves: number[] = [5, 10];
|
||||
ecs.query(ecs.allOf(MissionComp)).forEach((entity) => {
|
||||
const mission = entity.get(MissionComp);
|
||||
if (mission && mission.cardPoolUpgradeWaves) {
|
||||
upgradeWaves = mission.cardPoolUpgradeWaves;
|
||||
}
|
||||
});
|
||||
const currentWave = this.getCurrentWave();
|
||||
let nextWave = -1;
|
||||
for (let i = 0; i < upgradeWaves.length; i++) {
|
||||
if (upgradeWaves[i] > currentWave) {
|
||||
nextWave = upgradeWaves[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (nextWave !== -1) {
|
||||
const remain = nextWave - currentWave;
|
||||
nextLabel.string = `${remain} 回合后升级`;
|
||||
} else {
|
||||
nextLabel.string = `已满级`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const peak = 1.2
|
||||
this.playHeroNumNodePop(this.pool_lv_node, peak);
|
||||
}
|
||||
@@ -1091,7 +1102,7 @@ export class MissionCardComp extends CCComp {
|
||||
}
|
||||
|
||||
private updateCoinAndCostUI() {
|
||||
// this.updatePoolLvUI();
|
||||
this.updatePoolLvUI();
|
||||
this.updateDrawCostUI();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user