feat(关卡): 添加英雄数量上限机制

- 在 MissionCardComp 中添加英雄数量显示与上限控制逻辑
- 当英雄数量达到上限时禁止使用英雄卡牌
- 英雄死亡时减少当前英雄计数并刷新显示
- 添加英雄数量变化的动画反馈效果
- 移除 SingletonModuleComp 中未使用的 unlockCoin 字段
This commit is contained in:
walkpan
2026-03-25 23:04:12 +08:00
parent 7db182d9fc
commit 8a151a3922
6 changed files with 140 additions and 4 deletions

View File

@@ -6,6 +6,8 @@ import { CardConfig, CardType, SpecialCardList } from "../common/config/CardSet"
import { CardUseComp } from "./CardUseComp";
import { HeroInfo } from "../common/config/heroSet";
import { SkillSet } from "../common/config/SkillSet";
import { GameEvent } from "../common/config/GameEvent";
import { oops } from "db://oops-framework/core/Oops";
@@ -159,6 +161,19 @@ export class CardComp extends CCComp {
useCard(): CardConfig | null {
if (!this.cardData || this.isUsing) return null;
if (this.cardData.type === CardType.Hero) {
const guard = {
cancel: false,
reason: "",
uuid: this.cardData.uuid,
hero_lv: this.cardData.hero_lv
};
oops.message.dispatchEvent(GameEvent.UseHeroCard, guard);
if (guard.cancel) {
this.playReboundAnim();
return null;
}
}
this.isUsing = true;
const used = this.cardData;
mLogger.log(this.debugMode, "CardComp", "use card", {