feat(equip-system): 新增装备系统核心支持

1.  重构卡牌配置定义,明确Field类型为装备卡并支持单卡多词条
2.  添加装备卡判断和词条计数工具函数
3.  新增EquipListComp装备列表组件
4.  更新aui.plist和预制体UI资源适配新装备系统
5.  补充多词条装备示例配置
This commit is contained in:
panFD
2026-07-22 00:22:08 +08:00
parent db3b5f3649
commit 3e9b65e99d
12 changed files with 33183 additions and 10245 deletions

View File

@@ -0,0 +1,153 @@
/**
* @file EquipListComp.ts
* @description 单个技能卡效果控制组件UI 视图层 + 逻辑层)
*
* 职责:
* 1. 表示一张已使用的技能卡在战场上的 **可视化实体**。
* 2. 按 trigger_type 类型化分发触发逻辑(即时 / 定时 / 驻场 / 事件型)。
* 3. 显示技能图标和剩余触发次数。
* 4. 触发结束后自动销毁。
*
* 触发类型CardTriggerType
* - Instant (1)init 时立即触发一次(按 t_times 控制次数,跨波次 NewWave 时再次触发)
* - Interval (2):监听 FightStart → update 帧驱动按 t_inv 间隔重复触发(按 t_times 控制每波次数)
* - Field (3):被动生效,不主动施法(实际由 FieldSkillSet 处理)
* - FightStart (4):监听 FightStart 事件,按 trigger_limit 全局累计上限
* - FightEnd (5):监听 FightEnd 事件(每波结束派发),按 trigger_limit 全局累计上限
* - HeroDead (6):监听 HeroDead 事件(仅英雄阵营派发,怪物死亡不触发)
* - HeroCall (7):监听 MasterCalled主角/技能召唤)+ ReviveSuccess复活
*
* 关键设计:
* - 事件型4-7统一走 onEventTrigger 入口,仅作触发信号,不读取 payload
* - 触发上限Instant/Interval 按 t_times每波内事件型按 trigger_limit全局
* - 跨波次keep_waves 控制存活;事件型 trigger_count 不随波次重置
* - 销毁时通过 GameEvent.RemoveSkillBox 通知 MissSkillsComp 回收槽位
*
* 依赖:
* - CardPoolList / CardTriggerTypeCardSet—— 查询技能卡的触发配置
* - SkillSet —— 技能静态配置icon 字段)
* - GameEvent —— 各类游戏事件
* - smc.mission —— 游戏运行状态
*/
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 { SkillSet, SkillOverrides, FieldSkillSet } from "../common/config/SkillSet";
import { oops } from "db://oops-framework/core/Oops";
import { GameEvent } from "../common/config/GameEvent";
import { smc } from "../common/SingletonModuleComp";
import { UIID } from "../common/config/GameUIConfig";
const { ccclass, property } = _decorator;
/**
* EquipListComp —— 单个技能卡效果视图 + 逻辑组件
*
* 由 MissSkillsComp.addSkill() 实例化并初始化。
* 在战场上以图标 + 剩余次数的形式呈现。
*/
@ccclass('EquipListComp')
@ecs.register('EquipListComp', false)
export class EquipListComp extends CCComp {
/** 调试日志开关 */
private debugMode: boolean = true;
/** 装备图标节点 */
@property({ type: Node })
private icon_node: Node = null;
@property({ type: Node })
private bg_node: Node = null;
@property(Label)
private name_label: Label = null;
@property(Label)
private fied1: Label = null;
@property(Label)
private fied2: Label = null;
@property(Label)
private fied3: Label = null;
@property(Label)
private level_label: Label = null;
@property({ type: Node })
private buy_node: Node = null;
// ======================== 技能配置 ========================
/** 技能 UUID */
private s_uuid: number = 0;
/** 卡牌等级 */
private card_lv: number = 1;
/** 是否为即时技能true=使用后立即触发false=战斗中定时触发) */
private is_instant: boolean = true;
/** 总触发次数 */
private trigger_times: number = 1;
/** 触发间隔(秒,仅持续技能有效) */
private trigger_interval: number = 0;
/** 维持的波次数(-1表示直到战斗结束0表示不跨波次>0表示维持的具体波次数 */
private keep_waves: number = 0;
/** 技能覆写参数自定义伤害、Buff等 */
private overrides?: SkillOverrides;
/** 驻场技能 UUID 列表 */
public field: number[] = [];
/** 卡牌自定义图标ID优先级最高未定义则按 trigger_type 自动取) */
private card_icon?: string;
// ======================== 触发类型化扩展 ========================
/** 触发类型(默认即时,保持向后兼容) */
private trigger_type: CardTriggerType = CardTriggerType.Instant;
/** 事件型触发的全局次数上限Infinity 表示无上限) */
private trigger_limit: number = Infinity;
/** 事件型已触发次数 */
private trigger_count: number = 0;
// ======================== 运行时状态 ========================
/** 已触发次数 */
private current_trigger_times: number = 0;
/** 当前计时器(秒) */
private timer: number = 0;
/** 是否处于战斗中(仅战斗中持续技能才计时) */
private in_combat: boolean = false;
/** 是否已初始化 */
private initialized: boolean = false;
onLoad() {
}
onDestroy() {
}
init() {
}
private registerTrigger(): void {
}
updateUI() {
}
/** ECS 组件移除时销毁节点 */
reset() {
if (this.node && this.node.isValid) {
this.node.destroy();
}
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "f0155d5e-713e-4c0f-a5d3-9c69f75af91b",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -105,6 +105,20 @@ export class MissionCardComp extends CCComp {
/** 关闭英雄卡池按钮(仅负责收起 cards_node */
@property(Node)
closeHeros: Node = null!
/** 卡池升级按钮节点(已废弃,保留节点引用防止 editor 报错) */
/** 英雄卡牌池cards_node显示隐藏 */
@property(Node)
showEquips: Node = null!
/** 关闭英雄卡池按钮(仅负责收起 cards_node */
@property(Node)
closeEquips: Node = null!
/** 卡池升级按钮节点(已废弃,保留节点引用防止 editor 报错) */
/** 英雄卡牌池cards_node显示隐藏 */
@property(Node)
showShop: Node = null!
/** 关闭英雄卡池按钮(仅负责收起 cards_node */
@property(Node)
closeShop: Node = null!
/** 卡池升级按钮节点(已废弃,保留节点引用防止 editor 报错) */
@property(Node)
cards_up: Node = null!