feat(技能): 将技能卡释放逻辑移至独立组件并添加UI显示

- 新增 MissSkillsComp 组件,用于管理场景中释放的技能卡
- 将技能卡释放监听从 MissionHeroComp 移至 MissSkillsComp
- 新增 SkillBoxComp 组件,负责单个技能卡的表现和触发逻辑
- 在 role_controller.prefab 中添加 miss_skill_node 节点引用
- 技能卡现在会在场景中显示图标和剩余回合信息
- 支持即时技能和持续多回合技能的不同触发机制
This commit is contained in:
walkpan
2026-04-06 19:18:44 +08:00
parent cc51d1fb5e
commit fa629d71d9
5 changed files with 169 additions and 28 deletions

View File

@@ -49,34 +49,16 @@ export class MissionHeroCompComp extends CCComp {
this.on(GameEvent.MissionEnd,this.clear_heros,this)
/** 全局消息监听 */
oops.message.on(GameEvent.CallHero,this.call_hero,this)
oops.message.on(GameEvent.UseSkillCard,this.onUseSkillCard,this)
}
onDestroy(){
/** 清理监听,避免节点销毁后仍响应消息 */
oops.message.off(GameEvent.CallHero,this.call_hero,this)
oops.message.off(GameEvent.UseSkillCard,this.onUseSkillCard,this)
oops.message.off(GameEvent.FightReady,this.fight_ready,this)
oops.message.off(GameEvent.Zhaohuan,this.zhao_huan,this)
oops.message.off(GameEvent.MissionEnd,this.clear_heros,this)
}
/** 响应卡牌释放技能 */
private onUseSkillCard(event: string, args: any) {
const payload = args ?? event;
const uuid = Number(payload?.uuid ?? 0);
const card_lv = Math.max(1, Math.floor(Number(payload?.card_lv ?? 1)));
if (!uuid) return;
// 分发给 SCastSystem 处理(使用特定的坐标 x=-340, y=30
oops.message.dispatchEvent(GameEvent.TriggerSkill, {
s_uuid: uuid,
isCardSkill: true,
card_lv: card_lv,
targetPos: v3(-340, 30, 0)
});
}
start() {
// this.test_call()
}