refactor(map): 移除四个卡牌组件的长按预览功能
移除了EquipListComp、SCardComp、CHeroComp、ItemListComp四个文件中的长按弹出信息框相关代码,包括事件监听、长按计时逻辑和信息框打开关闭代码,同时删除了未使用的UIID导入。
This commit is contained in:
@@ -21,7 +21,6 @@ import { FieldSkillSet } from "../common/config/SkillSet";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { getCardIconId, setSpriteFrame } from "../common/CardIconHelper";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
import { MissionEconomy } from "./MissionEconomy";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
@@ -92,10 +91,6 @@ export class EquipListComp extends CCComp {
|
||||
this.buy_node?.on(NodeEventType.TOUCH_START, this.onBuyTouchStart, this);
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -106,13 +101,6 @@ export class EquipListComp 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);
|
||||
}
|
||||
|
||||
// ======================== 数据初始化 ========================
|
||||
@@ -333,45 +321,6 @@ export class EquipListComp extends CCComp {
|
||||
.start();
|
||||
}
|
||||
|
||||
// ======================== 长按信息框 ========================
|
||||
|
||||
/** 长按时长(秒) */
|
||||
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, EquipListComp.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.cardData) return;
|
||||
this.info_shown = true;
|
||||
// oops.gui 打开 HInfo 装备卡预览(复用 EquipBoxComp 的打开参数)
|
||||
oops.gui.remove(UIID.HInfo);
|
||||
oops.gui.open(UIID.HInfo, {
|
||||
heroUuid: this.cardData.uuid,
|
||||
heroLv: this.cardData.card_lv ?? 1,
|
||||
poolLv: 1,
|
||||
isSkillCard: true,
|
||||
isEquipCard: true
|
||||
});
|
||||
}
|
||||
|
||||
// ======================== 购买逻辑 ========================
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user