refactor: 重构技能弹窗系统,移除冗余技能池逻辑
1. 删除SkillBoxCardConfig相关类型、技能池配置和抽卡函数 2. 移除技能弹窗的刷新次数持久化逻辑与UI 3. 简化MissSkillsComp、SkillBoxComp的技能处理流程 4. 统一技能卡的添加和初始化逻辑,移除config专用初始化流程 5. 调整MissionCardComp的波次技能弹窗触发逻辑 6. 清理CardComp中冗余的技能描述缓存代码 7. 修正UIConfig中SkillBox预制体路径命名
This commit is contained in:
@@ -37,7 +37,7 @@ import { _decorator, instantiate, Label, Node, NodeEventType, Prefab, SpriteAtla
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { CARD_POOL_INIT_LEVEL, CARD_POOL_MAX_LEVEL, CARD_POOL_UPGRADE_DISCOUNT_PER_WAVE, CardConfig, CardType, CardsUpSet, drawCardsByRule, getCardsByLv, SKILL_BOX_TRIGGER_WAVES, SpecialRefreshCardList, SpecialRefreshHeroType, SpecialUpgradeCardList } from "../common/config/CardSet";
|
||||
import { CARD_POOL_INIT_LEVEL, CARD_POOL_MAX_LEVEL, CARD_POOL_UPGRADE_DISCOUNT_PER_WAVE, CardConfig, CardType, CardsUpSet, drawCardsByRule, getCardsByLv, SpecialRefreshCardList, SpecialRefreshHeroType, SpecialUpgradeCardList } from "../common/config/CardSet";
|
||||
import { CardComp } from "./CardComp";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
||||
@@ -48,7 +48,6 @@ import { FacSet, FightSet } from "../common/config/GameSet";
|
||||
import { MoveComp } from "../hero/MoveComp";
|
||||
import { MissionHeroComp } from "./MissionHeroComp";
|
||||
import { MissionEconomy } from "./MissionEconomy";
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -324,35 +323,13 @@ export class MissionCardComp extends CCComp {
|
||||
}
|
||||
|
||||
/** 新一波:展开面板 → 刷新费用 UI → 重新抽卡分发 */
|
||||
private onNewWave(event?: string, args?: any) {
|
||||
private onNewWave() {
|
||||
this.isBattlePhase = false;
|
||||
this.enterPreparePhase();
|
||||
this.updateCoinAndCostUI();
|
||||
this.layoutCardSlots();
|
||||
const cards = this.buildDrawCards();
|
||||
this.dispatchCardsToSlots(cards);
|
||||
|
||||
// 固定波次(1/5/10/15/20)弹出技能三选一弹窗
|
||||
const wave = Number(args?.wave ?? 0);
|
||||
if (this.isSkillBoxTriggerWave(wave)) {
|
||||
this.openSkillBox(wave);
|
||||
}
|
||||
}
|
||||
|
||||
/** 判断 wave 是否属于技能弹窗触发波次 */
|
||||
private isSkillBoxTriggerWave(wave: number): boolean {
|
||||
if (!wave || wave <= 0) return false;
|
||||
return SKILL_BOX_TRIGGER_WAVES.includes(wave);
|
||||
}
|
||||
|
||||
/** 打开技能三选一弹窗(MSkillBoxComp) */
|
||||
private openSkillBox(wave: number) {
|
||||
if (smc.map?.MapView) {
|
||||
oops.gui.open(UIID.SkillBox, { wave, poolLv: this.poolLv });
|
||||
mLogger.log(this.debugMode, "MissionCardComp", "openSkillBox", { wave, poolLv: this.poolLv });
|
||||
} else {
|
||||
mLogger.warn(this.debugMode, "MissionCardComp", "openSkillBox skipped, smc.map.MapView not ready");
|
||||
}
|
||||
}
|
||||
|
||||
/** 解除按钮监听,避免节点销毁后回调泄漏 */
|
||||
@@ -626,17 +603,13 @@ export class MissionCardComp extends CCComp {
|
||||
this.cardsHideScale = new Vec3(0, 0, this.cardsBaseScale.z);
|
||||
}
|
||||
|
||||
/** 进入准备阶段:展开卡牌面板(立即恢复缩放,无动画)+ 显示抽卡按钮 */
|
||||
/** 进入准备阶段:展开卡牌面板(立即恢复缩放,无动画) */
|
||||
private enterPreparePhase() {
|
||||
if (!this.cards_node || !this.cards_node.isValid) return;
|
||||
this.initCardsPanelPos();
|
||||
this.cards_node.active = true;
|
||||
Tween.stopAllByTarget(this.cards_node);
|
||||
this.cards_node.setScale(this.cardsShowScale);
|
||||
// 准备阶段:显示抽卡按钮
|
||||
if (this.cards_chou && this.cards_chou.isValid) {
|
||||
this.cards_chou.active = true;
|
||||
}
|
||||
}
|
||||
|
||||
private enterBattlePhase() {
|
||||
@@ -652,16 +625,16 @@ export class MissionCardComp extends CCComp {
|
||||
// }
|
||||
// })
|
||||
// .start();
|
||||
// 战斗阶段:隐藏抽卡按钮
|
||||
if (this.cards_chou && this.cards_chou.isValid) {
|
||||
this.cards_chou.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
/** 构建本次抽卡结果,保证最终可分发3条数据 */
|
||||
private buildDrawCards(): CardConfig[] {
|
||||
// 技能卡已不再通过常规刷新分发,统一走 MSkillBoxComp 固定波次弹窗
|
||||
const targetType: CardType[] = [CardType.Hero, CardType.SpecialRefresh];
|
||||
let targetType: CardType | CardType[] | undefined = undefined;
|
||||
if (this.isBattlePhase) {
|
||||
targetType = CardType.Skill;
|
||||
} else {
|
||||
targetType = [CardType.Hero, CardType.SpecialRefresh];
|
||||
}
|
||||
const cards = getCardsByLv(this.poolLv, targetType);
|
||||
|
||||
/** 正常情况下直接取前3 */
|
||||
|
||||
Reference in New Issue
Block a user