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

@@ -84,18 +84,45 @@ export class HeroViewComp extends CCComp {
// let anm = this.node.getChildByName("anm")
// anm.setScale(anm.scale.x*0.8,anm.scale.y*0.8);
// 绑定点击事件,点击打开英雄信息面板弹窗
this.node.on(NodeEventType.TOUCH_END, this.onHeroClicked, 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);
}
private onHeroClicked() {
/** 长按时长(秒) */
private static readonly LONG_PRESS_TIME: number = 0.5;
/** 信息框是否已弹出(区分长按完成与短按取消) */
private info_shown: boolean = false;
/** 按下:启动长按计时(仅英雄阵营响应) */
private onInfoTouchStart() {
if (!this.model) return;
if (this.model.fac !== FacSet.HERO) return;
oops.audio.playEffect("music/button");
this.info_shown = false;
this.scheduleOnce(this.showInfo, HeroViewComp.LONG_PRESS_TIME);
}
/** 放开/取消:已弹出则关闭信息框,未弹出则取消长按计时 */
private onInfoTouchEnd() {
this.unschedule(this.showInfo);
if (this.info_shown) {
this.info_shown = false;
// oops.gui 移除信息框
oops.gui.remove(UIID.HInfo);
}
}
/** 长按到点:弹出英雄信息面板(实体数据模式,随战场属性实时刷新) */
private showInfo() {
if (!this.model) return;
if (this.model.fac !== FacSet.HERO) return;
const eid = this.ent?.eid;
if (!eid) return;
this.info_shown = true;
oops.audio.playEffect("music/button");
// oops.gui 打开 HInfo 英雄信息面板
oops.gui.remove(UIID.HInfo);
oops.gui.open(UIID.HInfo, { eid: eid });
}
@@ -679,8 +706,10 @@ export class HeroViewComp extends CCComp {
this.damageQueue.length = 0;
this.isProcessingDamage = false;
// 解绑点击事件
this.node.off(NodeEventType.TOUCH_END, this.onHeroClicked, this);
// 解绑长按事件
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);
// 节点生命周期由 Monster 对象池管理,此处不再销毁
// if (this.node && this.node.isValid) {