feat: 新增卡牌长按预览功能与英雄信息等级展示

1.  为所有卡牌组件添加长按0.5秒弹出详情面板功能,支持点击/取消取消计时
2.  为英雄配置添加分级能力说明数组,信息面板支持逐行展示各等级效果
3.  重构英雄信息面板UI布局与渲染逻辑,优化动画加载方式
4.  更新卡牌预制体尺寸与样式,适配新的交互与展示需求
This commit is contained in:
panFD
2026-07-27 00:31:29 +08:00
parent cb2bc37a68
commit 93b2a4a155
9 changed files with 3852 additions and 4452 deletions

View File

@@ -24,6 +24,7 @@ import { HeroInfo } from "../common/config/heroSet";
import { oops } from "db://oops-framework/core/Oops";
import { GameEvent } from "../common/config/GameEvent";
import { smc } from "../common/SingletonModuleComp";
import { UIID } from "../common/config/GameUIConfig";
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
import { FieldSkillType } from "../common/config/SkillSet";
import { FieldSkillHelper } from "../hero/FieldSkillHelper";
@@ -112,6 +113,11 @@ export class CHeroComp extends CCComp {
this.buy_node?.on(NodeEventType.TOUCH_END, this.onBuyClick, this);
this.buy_node?.on(NodeEventType.TOUCH_CANCEL, this.onBuyTouchCancel, this);
// 卡面长按弹信息框:按下启动计时,放开/取消时关闭
this.node.on(NodeEventType.TOUCH_START, this.onInfoTouchStart, this);
this.node.on(NodeEventType.TOUCH_END, this.onInfoTouchEnd, this);
this.node.on(NodeEventType.TOUCH_CANCEL, this.onInfoTouchEnd, this);
// 缓存透明度组件(用于淡入淡出动画)
this.opacityComp = this.node.getComponent(UIOpacity) || this.node.addComponent(UIOpacity);
@@ -129,6 +135,13 @@ export class CHeroComp extends CCComp {
this.buy_node.off(NodeEventType.TOUCH_END, this.onBuyClick, this);
this.buy_node.off(NodeEventType.TOUCH_CANCEL, this.onBuyTouchCancel, this);
}
if (this.node && this.node.isValid) {
this.node.off(NodeEventType.TOUCH_START, this.onInfoTouchStart, this);
this.node.off(NodeEventType.TOUCH_END, this.onInfoTouchEnd, this);
this.node.off(NodeEventType.TOUCH_CANCEL, this.onInfoTouchEnd, this);
}
// 清理长按计时器,防止销毁后回调访问失效节点
this.unschedule(this.showInfo);
}
// ======================== 数据初始化 ========================
@@ -459,6 +472,51 @@ export class CHeroComp extends CCComp {
}
}
// ======================== 长按信息框 ========================
/** 长按时长(秒) */
private static readonly LONG_PRESS_TIME: number = 0.5;
/** 信息框是否已弹出(区分长按完成与短按取消) */
private info_shown: boolean = false;
/** 卡面按下:启动长按计时 */
private onInfoTouchStart() {
if (!this.cardData) return;
this.info_shown = false;
this.scheduleOnce(this.showInfo, CHeroComp.LONG_PRESS_TIME);
}
/** 卡面放开/取消:已弹出则关闭信息框,未弹出则取消长按计时 */
private onInfoTouchEnd() {
this.unschedule(this.showInfo);
if (this.info_shown) {
this.info_shown = false;
// oops.gui 移除信息框
oops.gui.remove(UIID.HInfo);
}
}
/**
* 长按到点:弹出英雄信息框。
* 升级卡SpecialUpgrade + target_hero_eid通过 eid 反查场上实体得到 hero_uuid
* 与 updateUI 的渲染逻辑保持一致。
*/
private showInfo() {
if (!this.cardData) return;
this.info_shown = true;
const isUpgradeCard = this.cardData.type === CardType.SpecialUpgrade && !!this.cardData.target_hero_eid;
const heroUuid = isUpgradeCard
? (this.queryHeroUuidByEid(this.cardData.target_hero_eid as number) ?? this.cardData.uuid)
: this.cardData.uuid;
const heroLv = Math.max(1, this.cardData.hero_lv ?? 1);
const poolLv = Math.max(1, this.cardData.base_pool_lv ?? this.cardData.pool_lv ?? 1);
// oops.gui 打开 HInfo 英雄卡预览
oops.gui.remove(UIID.HInfo);
oops.gui.open(UIID.HInfo, { heroUuid, heroLv, poolLv });
}
// ======================== 购买逻辑 ========================
/**