refactor: 拆分技能卡配置到独立文件,优化抽卡逻辑
1. 新建SCardSet.ts单独管理技能卡池配置,将原CardSet.ts中的技能卡数据迁移 2. 重构多处业务代码,从SkillCardList而非CardPoolList获取技能卡配置 3. 简化技能卡抽卡逻辑,新增drawSkillCards工具函数统一处理抽卡 4. 修复TalentsComp中计算contentHeight的小语法问题 5. 新增技能卡商店显隐控制功能
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
* - 销毁时通过 GameEvent.RemoveSkillBox 通知 MissSkillsComp 回收槽位
|
||||
*
|
||||
* 依赖:
|
||||
* - CardPoolList / CardTriggerType(CardSet)—— 查询技能卡的触发配置
|
||||
* - SkillCardList(SCardSet)/ CardTriggerType(CardSet)—— 查询技能卡的触发配置
|
||||
* - SkillSet —— 技能静态配置(icon 字段)
|
||||
* - GameEvent —— 各类游戏事件
|
||||
* - smc.mission —— 游戏运行状态
|
||||
@@ -33,7 +33,8 @@ import { mLogger } from "../common/Logger";
|
||||
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, CardTriggerType } from "../common/config/CardSet";
|
||||
import { CardTriggerType } from "../common/config/CardSet";
|
||||
import { SkillCardList } from "../common/config/SCardSet";
|
||||
import { SkillSet, SkillOverrides, FieldSkillSet } from "../common/config/SkillSet";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
@@ -149,16 +150,16 @@ export class SkillBoxComp extends CCComp {
|
||||
if (!this.initialized) return;
|
||||
oops.audio.playEffect("music/button");
|
||||
// 点击时弹出 HInfoComp,传入卡牌 UUID 和等级以启用预览模式
|
||||
const config = CardPoolList.find(c => c.uuid === this.s_uuid || c.skill === this.s_uuid);
|
||||
const config = SkillCardList.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 查询技能卡的触发配置(含 trigger_type)。
|
||||
* 1. 从 SkillCardList 查询技能卡的触发配置(含 trigger_type)。
|
||||
* 2. 更新 UI 显示(图标 + 次数)。
|
||||
* 3. 按 trigger_type 注册对应事件监听并执行首次触发。
|
||||
*
|
||||
@@ -169,7 +170,7 @@ export class SkillBoxComp extends CCComp {
|
||||
this.card_lv = card_lv;
|
||||
|
||||
// 查询触发配置
|
||||
const config = CardPoolList.find(c => c.uuid === uuid);
|
||||
const config = SkillCardList.find(c => c.uuid === uuid);
|
||||
if (config) {
|
||||
this.s_uuid = config.skill ?? uuid; // 获取实际的技能 UUID
|
||||
this.is_instant = config.is_inst ?? true;
|
||||
|
||||
Reference in New Issue
Block a user