refactor(map): 移除四个卡牌组件的长按预览功能

移除了EquipListComp、SCardComp、CHeroComp、ItemListComp四个文件中的长按弹出信息框相关代码,包括事件监听、长按计时逻辑和信息框打开关闭代码,同时删除了未使用的UIID导入。
This commit is contained in:
pan
2026-07-31 10:06:40 +08:00
parent 8f3cd4777f
commit bdb4602fe6
4 changed files with 0 additions and 233 deletions

View File

@@ -24,7 +24,6 @@ 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";
@@ -121,11 +120,6 @@ 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);
@@ -143,13 +137,6 @@ 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);
}
// ======================== 数据初始化 ========================
@@ -546,51 +533,6 @@ 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_card_lv ?? this.cardData.card_lv ?? 1);
// oops.gui 打开 HInfo 英雄卡预览
oops.gui.remove(UIID.HInfo);
oops.gui.open(UIID.HInfo, { heroUuid, heroLv, poolLv });
}
// ======================== 购买逻辑 ========================
/**