refactor: 重构技能弹窗系统,移除冗余技能池逻辑
1. 删除SkillBoxCardConfig相关类型、技能池配置和抽卡函数 2. 移除技能弹窗的刷新次数持久化逻辑与UI 3. 简化MissSkillsComp、SkillBoxComp的技能处理流程 4. 统一技能卡的添加和初始化逻辑,移除config专用初始化流程 5. 调整MissionCardComp的波次技能弹窗触发逻辑 6. 清理CardComp中冗余的技能描述缓存代码 7. 修正UIConfig中SkillBox预制体路径命名
This commit is contained in:
@@ -29,8 +29,8 @@ import { mLogger } from "../common/Logger";
|
||||
import { _decorator, Node, Prefab, Sprite, Label, Vec3, resources, SpriteAtlas } 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, SkillBoxCardConfig } from "../common/config/CardSet";
|
||||
import { SkillOverrides, SkillSet } from "../common/config/SkillSet";
|
||||
import { CardPoolList } from "../common/config/CardSet";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
@@ -68,8 +68,6 @@ export class SkillBoxComp extends CCComp {
|
||||
private trigger_times: number = 1;
|
||||
/** 触发间隔(秒,仅持续技能有效) */
|
||||
private trigger_interval: number = 0;
|
||||
/** 技能参数覆盖(来自 SkillBoxCardConfig.overrides,触发时随事件派发) */
|
||||
private skill_overrides: SkillOverrides | null = null;
|
||||
|
||||
// ======================== 运行时状态 ========================
|
||||
|
||||
@@ -125,7 +123,6 @@ export class SkillBoxComp extends CCComp {
|
||||
this.trigger_times = config.t_times ?? 1;
|
||||
this.trigger_interval = config.t_inv ?? 0;
|
||||
}
|
||||
this.skill_overrides = null;
|
||||
|
||||
this.current_trigger_times = 0;
|
||||
this.timer = 0;
|
||||
@@ -146,39 +143,6 @@ export class SkillBoxComp extends CCComp {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用 SkillBoxCardConfig 初始化(MSkillBoxComp 三选一弹窗场景)
|
||||
*
|
||||
* 与 init(uuid, card_lv) 的区别:
|
||||
* - 直接以 s_uuid 字段作为实际生效技能
|
||||
* - 触发参数(is_inst / t_times / t_inv)取自 SkillBoxCardConfig
|
||||
* - overrides 在 triggerSkill 时随事件一起派发,由技能执行系统按需应用
|
||||
*/
|
||||
initWithConfig(skillBoxCard: SkillBoxCardConfig) {
|
||||
this.s_uuid = skillBoxCard.s_uuid;
|
||||
this.card_lv = Math.max(1, Math.floor(skillBoxCard.card_lv ?? 1));
|
||||
this.is_instant = skillBoxCard.is_inst ?? true;
|
||||
this.trigger_times = skillBoxCard.t_num ?? skillBoxCard.t_times ?? 1;
|
||||
this.trigger_interval = skillBoxCard.t_inv ?? 0;
|
||||
this.skill_overrides = skillBoxCard.overrides ?? null;
|
||||
|
||||
this.current_trigger_times = 0;
|
||||
this.timer = 0;
|
||||
this.initialized = true;
|
||||
|
||||
this.updateUI();
|
||||
|
||||
if (this.is_instant) {
|
||||
this.triggerSkill();
|
||||
this.current_trigger_times++;
|
||||
if (this.current_trigger_times >= this.trigger_times) {
|
||||
this.scheduleOnce(() => {
|
||||
this.node.destroy();
|
||||
}, 1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新 UI:
|
||||
* - 图标:从 uicons 图集获取。
|
||||
@@ -293,13 +257,11 @@ export class SkillBoxComp extends CCComp {
|
||||
const parentPos = this.node.parent ? this.node.parent.position : new Vec3(0, 0, 0);
|
||||
targetPos.set(parentPos.x + localPos.x, parentPos.y + localPos.y, 0);
|
||||
|
||||
// 将 SkillBoxCardConfig 的 overrides 一起派发,技能执行系统可按需合并到基础 SkillSet 配置
|
||||
oops.message.dispatchEvent(GameEvent.TriggerSkill, {
|
||||
s_uuid: this.s_uuid,
|
||||
isCardSkill: true, // 标记为卡牌技能(区别于英雄自身技能)
|
||||
card_lv: this.card_lv,
|
||||
targetPos: targetPos,
|
||||
overrides: this.skill_overrides ?? undefined
|
||||
targetPos: targetPos
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user