feat: 添加英雄信息弹窗显示功能

- 在卡牌点击时打开英雄技能信息弹窗
- 为英雄头像信息组件添加点击打开弹窗功能
- 重构信息弹窗组件,支持动态显示英雄技能信息
- 调整弹窗UI布局和尺寸以适应不同数量的技能显示
This commit is contained in:
walkpan
2026-03-27 19:24:29 +08:00
parent 2d6f46dc42
commit b88d3c214a
4 changed files with 161 additions and 59 deletions

View File

@@ -9,6 +9,7 @@ import { SkillSet } from "../common/config/SkillSet";
import { GameEvent } from "../common/config/GameEvent";
import { oops } from "db://oops-framework/core/Oops";
import { smc } from "../common/SingletonModuleComp";
import { UIID } from "../common/config/GameUIConfig";
@@ -317,6 +318,7 @@ export class CardComp extends CCComp {
this.useCard();
return;
}
this.openHeroInfoIBox();
this.playReboundAnim();
}
@@ -467,6 +469,19 @@ export class CardComp extends CCComp {
return `${uuid}`;
}
private openHeroInfoIBox() {
if (!this.cardData) return;
if (this.cardData.type !== CardType.Hero) return;
const hero = HeroInfo[this.cardData.uuid];
if (!hero) return;
const heroLv = Math.max(1, Math.floor(this.cardData.hero_lv ?? hero.lv ?? 1));
oops.gui.remove(UIID.IBox);
oops.gui.open(UIID.IBox, {
heroUuid: this.cardData.uuid,
heroLv
});
}
private updateHeroAnimation(node: Node, uuid: number, token: number) {
const sprite = node?.getComponent(Sprite) || node?.getComponentInChildren(Sprite);
if (sprite) sprite.spriteFrame = null;