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

@@ -4834,7 +4834,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 67.5, "x": 67.5,
"y": -90, "y": -96.599,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -5033,7 +5033,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 129, "width": 135,
"height": 40 "height": 40
}, },
"_anchorPoint": { "_anchorPoint": {
@@ -5181,10 +5181,10 @@
}, },
"_alignFlags": 44, "_alignFlags": 44,
"_target": null, "_target": null,
"_left": 3, "_left": 0,
"_right": 3, "_right": 0,
"_top": 0, "_top": 0,
"_bottom": -35, "_bottom": -41.599000000000004,
"_horizontalCenter": 0, "_horizontalCenter": 0,
"_verticalCenter": 0, "_verticalCenter": 0,
"_isAbsLeft": true, "_isAbsLeft": true,
@@ -5259,7 +5259,9 @@
"icon_node": { "icon_node": {
"__id__": 10 "__id__": 10
}, },
"sell_node": null, "sell_node": {
"__id__": 209
},
"NF_node": { "NF_node": {
"__id__": 117 "__id__": 117
}, },

View File

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

View File

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