feat(地图): 在战斗阶段隐藏英雄出售按钮

在战斗阶段自动隐藏英雄信息面板上的出售按钮,避免玩家在战斗过程中误操作出售英雄。通过新增的 setBattlePhase 方法控制按钮显隐,并在任务卡组件中根据战斗状态同步更新所有英雄信息面板。
This commit is contained in:
walkpan
2026-04-23 22:16:22 +08:00
parent bb6e63756c
commit d97e3d8cb9
3 changed files with 32 additions and 6 deletions

View File

@@ -92,6 +92,16 @@ export class HInfoComp extends CCComp {
this.refresh();
}
/**
* 设置当前是否处于战斗阶段,控制出售按钮显示/隐藏
* @param isBattlePhase 是否处于战斗阶段
*/
setBattlePhase(isBattlePhase: boolean) {
if (this.sell_node && this.sell_node.isValid) {
this.sell_node.active = !isBattlePhase;
}
}
/**
* 刷新显示:
* 1. 根据英雄等级切换高级 / 普通边框。

View File

@@ -613,6 +613,12 @@ export class MissionCardComp extends CCComp {
this.cards_node.active = true;
Tween.stopAllByTarget(this.cards_node);
this.cards_node.setScale(this.cardsShowScale);
this.heroInfoItems.forEach(item => {
if (item.comp && item.comp.isValid) {
item.comp.setBattlePhase(false);
}
});
}
private enterBattlePhase() {
@@ -627,6 +633,12 @@ export class MissionCardComp extends CCComp {
}
})
.start();
this.heroInfoItems.forEach(item => {
if (item.comp && item.comp.isValid) {
item.comp.setBattlePhase(true);
}
});
}
/** 构建本次抽卡结果保证最终可分发4条数据 */
@@ -847,6 +859,7 @@ export class MissionCardComp extends CCComp {
comp
};
comp.bindData(eid, model);
comp.setBattlePhase(this.isBattlePhase);
this.heroInfoItems.set(eid, item);
this.relayoutHeroInfoPanels();
this.updateHeroInfoPanel(item);
@@ -881,6 +894,7 @@ export class MissionCardComp extends CCComp {
comp: HInfoComp
}) {
item.comp.refresh();
item.comp.setBattlePhase(this.isBattlePhase);
}
private relayoutHeroInfoPanels() {