feat(map): 新增固定波次技能三选一弹窗系统
1. 新增MSkillBoxComp弹窗组件,实现固定波次触发的技能卡选择功能 2. 新增SkillBoxCardConfig配置与SkillBoxPool技能池,支持按波次配置技能 3. 重构MissionCardComp,将技能卡抽取改为固定波次弹窗触发 4. 扩展SingletonModuleComp与MissionComp,添加技能刷新次数持久化逻辑 5. 优化MissSkillsComp,新增SkillBox专属技能加载流程 6. 修复SkillBoxComp,支持自定义技能参数覆盖 7. 调整UIConfig与CardSet配置,适配新的技能卡流程
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 } from "../common/config/CardSet";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
import { CardPoolList, SkillBoxCardConfig } from "../common/config/CardSet";
|
||||
import { SkillOverrides, SkillSet } from "../common/config/SkillSet";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
@@ -49,8 +49,8 @@ export class SkillBoxComp extends CCComp {
|
||||
private debugMode: boolean = true;
|
||||
|
||||
/** 技能图标节点 */
|
||||
@property({type: Node})
|
||||
private icon_node:Node= null;
|
||||
@property({ type: Node })
|
||||
private icon_node: Node = null;
|
||||
|
||||
/** 剩余次数标签 */
|
||||
@property(Label)
|
||||
@@ -68,6 +68,8 @@ export class SkillBoxComp extends CCComp {
|
||||
private trigger_times: number = 1;
|
||||
/** 触发间隔(秒,仅持续技能有效) */
|
||||
private trigger_interval: number = 0;
|
||||
/** 技能参数覆盖(来自 SkillBoxCardConfig.overrides,触发时随事件派发) */
|
||||
private skill_overrides: SkillOverrides | null = null;
|
||||
|
||||
// ======================== 运行时状态 ========================
|
||||
|
||||
@@ -115,7 +117,7 @@ export class SkillBoxComp extends CCComp {
|
||||
init(uuid: number, card_lv: number) {
|
||||
this.s_uuid = uuid;
|
||||
this.card_lv = card_lv;
|
||||
|
||||
|
||||
// 查询触发配置
|
||||
const config = CardPoolList.find(c => c.uuid === uuid);
|
||||
if (config) {
|
||||
@@ -123,6 +125,7 @@ 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;
|
||||
@@ -143,6 +146,39 @@ 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 图集获取。
|
||||
@@ -160,7 +196,7 @@ export class SkillBoxComp extends CCComp {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 更新剩余次数标签
|
||||
if (this.info_label) {
|
||||
if (!this.is_instant) {
|
||||
@@ -178,7 +214,7 @@ export class SkillBoxComp extends CCComp {
|
||||
private onFightStart() {
|
||||
if (!this.initialized) return;
|
||||
this.in_combat = true;
|
||||
|
||||
|
||||
if (!this.is_instant) {
|
||||
this.timer = 0; // 重置计时器
|
||||
}
|
||||
@@ -201,7 +237,7 @@ export class SkillBoxComp extends CCComp {
|
||||
private handleNewWave() {
|
||||
if (!this.initialized) return;
|
||||
this.in_combat = false;
|
||||
|
||||
|
||||
if (!this.is_instant) {
|
||||
if (this.current_trigger_times >= this.trigger_times) {
|
||||
this.node.destroy();
|
||||
@@ -233,7 +269,7 @@ export class SkillBoxComp extends CCComp {
|
||||
this.triggerSkill();
|
||||
this.current_trigger_times++;
|
||||
this.updateUI();
|
||||
|
||||
|
||||
// 次数用完 → 延迟销毁
|
||||
if (this.current_trigger_times >= this.trigger_times) {
|
||||
this.scheduleOnce(() => {
|
||||
@@ -256,12 +292,14 @@ export class SkillBoxComp extends CCComp {
|
||||
const localPos = this.node.position;
|
||||
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
|
||||
targetPos: targetPos,
|
||||
overrides: this.skill_overrides ?? undefined
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user