feat: 新增卡牌长按预览功能与英雄信息等级展示
1. 为所有卡牌组件添加长按0.5秒弹出详情面板功能,支持点击/取消取消计时 2. 为英雄配置添加分级能力说明数组,信息面板支持逐行展示各等级效果 3. 重构英雄信息面板UI布局与渲染逻辑,优化动画加载方式 4. 更新卡牌预制体尺寸与样式,适配新的交互与展示需求
This commit is contained in:
@@ -19,10 +19,12 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { CardConfig, CardTriggerType, CKind } from "../common/config/CardSet";
|
||||
import { EquipPoolList } from "../common/config/EquipSet";
|
||||
import { SkillCardList } from "../common/config/SCardSet";
|
||||
import { FieldSkillSet, SkillSet } from "../common/config/SkillSet";
|
||||
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 { MissionEconomy } from "./MissionEconomy";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
@@ -89,6 +91,10 @@ export class ItemListComp 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);
|
||||
}
|
||||
|
||||
@@ -99,6 +105,13 @@ export class ItemListComp 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);
|
||||
}
|
||||
|
||||
// ======================== 数据初始化 ========================
|
||||
@@ -344,6 +357,65 @@ export class ItemListComp 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, ItemListComp.LONG_PRESS_TIME);
|
||||
}
|
||||
|
||||
/** 卡面放开/取消:已弹出则关闭信息框,未弹出则取消长按计时 */
|
||||
private onInfoTouchEnd() {
|
||||
this.unschedule(this.showInfo);
|
||||
if (this.info_shown) {
|
||||
this.info_shown = false;
|
||||
// oops.gui 移除信息框
|
||||
oops.gui.remove(UIID.HInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 长按到点:按卡牌类型弹出对应信息框。
|
||||
* - 装备卡(trigger_type=Field)→ 装备预览(isEquipCard)
|
||||
* - 商品/药品及其他 → 技能卡预览(uuid 反查 SkillCardList)
|
||||
*/
|
||||
private showInfo() {
|
||||
if (!this.cardData) return;
|
||||
this.info_shown = true;
|
||||
|
||||
const isEquip = this.cardData.trigger_type === CardTriggerType.Field;
|
||||
if (isEquip) {
|
||||
// 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
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 技能/商品卡:反查 SkillCardList 拿到卡池 uuid(查不到时降级为本卡 uuid)
|
||||
const config = SkillCardList.find(c => c.uuid === this.cardData!.uuid || c.skill === this.cardData!.uuid);
|
||||
const cardUuid = config ? config.uuid : this.cardData.uuid;
|
||||
oops.gui.remove(UIID.HInfo);
|
||||
oops.gui.open(UIID.HInfo, {
|
||||
heroUuid: cardUuid,
|
||||
heroLv: this.cardData.card_lv ?? 1,
|
||||
poolLv: config?.pool_lv ?? 1,
|
||||
isSkillCard: true
|
||||
});
|
||||
}
|
||||
|
||||
// ======================== 购买逻辑 ========================
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user