feat(map): add click preview for skill box on battlefield

1. 为战场技能槽节点添加点击事件,点击时打开技能详情弹窗
2. 重构HInfoComp弹窗以支持技能卡预览模式
3. 新增技能卡专属的图标加载和界面渲染逻辑
This commit is contained in:
pan
2026-06-09 10:28:43 +08:00
parent f62b5ecc2b
commit 46cadb3bc2
2 changed files with 113 additions and 36 deletions

View File

@@ -26,7 +26,7 @@
* - smc.mission —— 游戏运行状态
*/
import { mLogger } from "../common/Logger";
import { _decorator, Node, Prefab, Sprite, Label, Vec3, resources, SpriteAtlas, tween, v3, Tween } from "cc";
import { _decorator, Node, Prefab, Sprite, Label, Vec3, resources, SpriteAtlas, tween, v3, Tween, NodeEventType } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { CardPoolList } from "../common/config/CardSet";
@@ -34,6 +34,7 @@ import { SkillSet, SkillOverrides } 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";
const { ccclass, property } = _decorator;
/**
@@ -97,6 +98,7 @@ export class SkillBoxComp extends CCComp {
oops.message.on(GameEvent.MissionEnd, this.onMissionEnd, this);
this.node.on(GameEvent.NewWave, this.onNewWave, this);
oops.message.on(GameEvent.NewWave, this.onNewWaveGlobal, this);
this.node.on(NodeEventType.TOUCH_END, this.onNodeClicked, this);
}
/** 销毁时移除所有事件监听并通知槽位管理器回收 */
@@ -106,12 +108,23 @@ export class SkillBoxComp extends CCComp {
oops.message.off(GameEvent.MissionEnd, this.onMissionEnd, this);
if (this.node && this.node.isValid) {
this.node.off(GameEvent.NewWave, this.onNewWave, this);
this.node.off(NodeEventType.TOUCH_END, this.onNodeClicked, this);
}
oops.message.off(GameEvent.NewWave, this.onNewWaveGlobal, this);
// 通知 MissSkillsComp 回收该节点占用的槽位
oops.message.dispatchEvent(GameEvent.RemoveSkillBox, this.node);
}
private onNodeClicked() {
if (!this.initialized) return;
// 点击时弹出 HInfoComp传入卡牌 UUID 和等级以启用预览模式
const config = CardPoolList.find(c => c.uuid === this.s_uuid || c.skill === this.s_uuid);
const cardUuid = config ? config.uuid : this.s_uuid;
oops.gui.remove(UIID.HInfo);
oops.gui.open(UIID.HInfo, { heroUuid: cardUuid, heroLv: this.card_lv, poolLv: config?.pool_lv ?? 1, isSkillCard: true });
}
/**
* 初始化技能卡效果:
* 1. 从 CardPoolList 查询技能卡的触发配置。