feat(卡牌): 调整战斗阶段卡牌逻辑与配置

- 战斗阶段不再隐藏卡牌面板,改为刷新为技能卡
- 移除特殊升级卡,统一刷新卡费用为1并调整权重
- 修复卡牌组件布局参数,确保战斗阶段显示正确
This commit is contained in:
panw
2026-04-21 14:34:30 +08:00
parent 6ff01c9bb2
commit 50ff3fd150
3 changed files with 30 additions and 20 deletions

View File

@@ -117,6 +117,9 @@ export class MissionCardComp extends CCComp {
// ======================== 运行时状态 ========================
/** 当前是否为战斗阶段 */
private isBattlePhase: boolean = false;
/** 预留图集缓存(后续接入按钮/卡面图标时复用) */
private uiconsAtlas: SpriteAtlas | null = null;
/** 四个槽位对应的 CardComp 控制器缓存(有序数组) */
@@ -191,6 +194,7 @@ export class MissionCardComp extends CCComp {
* 6. 执行首次抽卡并分发到 4 个槽位。
*/
onMissionStart() {
this.isBattlePhase = false;
this.enterPreparePhase();
this.poolLv = CARD_POOL_INIT_LEVEL;
const missionData = this.getMissionData();
@@ -297,9 +301,13 @@ export class MissionCardComp extends CCComp {
this.playCoinChangeAnim(v > 0);
}
/** 战斗开始:收起卡牌面板 */
/** 战斗开始:收起面板,而是刷新为战斗阶段卡牌 */
private onFightStart() {
this.isBattlePhase = true;
this.enterBattlePhase();
this.layoutCardSlots();
const cards = this.buildDrawCards();
this.dispatchCardsToSlots(cards);
}
/**
@@ -331,6 +339,7 @@ export class MissionCardComp extends CCComp {
/** 新一波:展开面板 → 刷新费用 UI → 重新抽卡分发 */
private onNewWave() {
this.isBattlePhase = false;
this.enterPreparePhase();
this.updateCoinAndCostUI();
this.layoutCardSlots();
@@ -605,22 +614,25 @@ export class MissionCardComp extends CCComp {
this.cards_node.active = true;
Tween.stopAllByTarget(this.cards_node);
this.cards_node.setScale(this.cardsShowScale);
tween(this.cards_node)
.to(this.cardsPanelMoveDuration, {
scale: this.cardsHideScale
})
.start();
// 取消战斗阶段隐藏面板的逻辑
}
/** 构建本次抽卡结果保证最终可分发4条数据 */
private buildDrawCards(): CardConfig[] {
const cards = getCardsByLv(this.poolLv);
let targetType: CardType | CardType[] | undefined = undefined;
if (this.isBattlePhase) {
targetType = CardType.Skill;
} else {
targetType = [CardType.Hero, CardType.SpecialRefresh];
}
const cards = getCardsByLv(this.poolLv, targetType);
/** 正常情况下直接取前4 */
if (cards.length >= 4) return cards.slice(0, 4);
/** 兜底当返回不足4张时循环补齐保证分发不缺位 */
const filled = [...cards];
while (filled.length < 4) {
const fallback = getCardsByLv(this.poolLv);
const fallback = getCardsByLv(this.poolLv, targetType);
if (fallback.length === 0) break;
filled.push(fallback[filled.length % fallback.length]);
}