feat: 实现技能卡牌系统并添加相关配置
- 在 GameSet 中新增技能卡牌释放起始坐标常量 - 卡牌使用组件增加技能卡释放事件分发 - 任务英雄组件监听技能卡事件并转发给技能施放系统 - 卡牌组件支持技能卡牌的显示和等级星级 - 卡牌配置中添加技能卡牌池和对应的配置信息 - 技能施放系统扩展以支持卡牌技能的直接触发
This commit is contained in:
@@ -2,7 +2,7 @@ import { mLogger } from "../common/Logger";
|
||||
import { _decorator, Animation, AnimationClip, EventTouch, Label, Node, NodeEventType, Sprite, SpriteAtlas, Tween, tween, UIOpacity, Vec3, resources, Light } 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 { CardConfig, CardType, SpecialRefreshCardList, SpecialUpgradeCardList, CKind } from "../common/config/CardSet";
|
||||
import { CardConfig, CardType, SpecialRefreshCardList, SpecialUpgradeCardList, CKind, SkillCardList } from "../common/config/CardSet";
|
||||
import { CardUseComp } from "./CardUseComp";
|
||||
import { HeroInfo } from "../common/config/heroSet";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
@@ -412,6 +412,15 @@ export class CardComp extends CCComp {
|
||||
this.oinfo_node.active = false;
|
||||
this.info_node.getChildByName("ap").getChildByName("val").getComponent(Label).string = `${(hero?.ap ?? 0) * heroLv}`;
|
||||
this.info_node.getChildByName("hp").getChildByName("val").getComponent(Label).string = `${(hero?.hp ?? 0) * heroLv}`;
|
||||
}else if(this.card_type===CardType.Skill){
|
||||
const skill = SkillSet[this.card_uuid];
|
||||
const skillCard = SkillCardList[this.card_uuid];
|
||||
const card_lv = Math.max(1, Math.floor(this.cardData.card_lv ?? 1));
|
||||
const spSuffix = card_lv >= 2 ? "★".repeat(card_lv - 1) : "";
|
||||
this.setLabel(this.name_node, `${spSuffix}${skillCard?.name || skill?.name || ""}${spSuffix}`);
|
||||
this.info_node.active = false;
|
||||
this.oinfo_node.active = true;
|
||||
this.oinfo_node.getChildByName("info").getComponent(Label).string = `${skillCard?.info || skill?.info || ""}`;
|
||||
}else{
|
||||
const specialCard = this.card_type === CardType.SpecialUpgrade
|
||||
? SpecialUpgradeCardList[this.card_uuid]
|
||||
|
||||
@@ -51,6 +51,7 @@ export class CardUseComp extends CCComp {
|
||||
oops.message.dispatchEvent(GameEvent.CallHero, used);
|
||||
return "hero";
|
||||
case CardType.Skill:
|
||||
oops.message.dispatchEvent(GameEvent.UseSkillCard, used);
|
||||
return "skill";
|
||||
case CardType.SpecialUpgrade:
|
||||
case CardType.SpecialRefresh:
|
||||
|
||||
@@ -49,16 +49,34 @@ 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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user