feat(game): 重构卡牌技能关联逻辑,调整游戏UI布局

为CardConfig新增skill字段,支持卡牌独立关联技能UUID
重构SCardComp与SkillBoxComp的技能获取逻辑,修复技能图标与配置读取问题,修正组件参数注释
调整GameSet中的游戏地平线坐标,优化多个场景与UI预制体的布局位置
移除部分预制体中的冗余配置项,清理无效代码
This commit is contained in:
panFD
2026-06-04 23:12:57 +08:00
parent c1f1aea387
commit 500ba03eb9
10 changed files with 1608 additions and 1431 deletions

View File

@@ -58,6 +58,7 @@ export interface CardConfig {
base_pool_lv?: number
// 技能卡扩展属性
skill?: number // 关联的技能 UUID
name?: string // 卡牌名称
info?: string // 卡牌描述信息
is_inst?: boolean // 是否即时起效
@@ -131,27 +132,27 @@ HeroList.forEach(uuid => {
// 添加非英雄卡牌 (技能、功能卡)
CardPoolList.push(
// 技能卡牌 (以增益/辅助为主,因为在备战期没有敌人)
{ uuid: 6304, type: CardType.Skill, cost: 0, weight: 20, pool_lv: 1, wave: 1, kind: CKind.Skill, card_lv: 1, name: t("skill_name_6304"), info: t("skill_info_6304"), is_inst: true, t_times: 1, t_inv: 0, keep_waves: 15 },
{ uuid: 6305, type: CardType.Skill, cost: 0, weight: 20, pool_lv: 1, wave: 1, kind: CKind.Skill, card_lv: 1, name: t("skill_name_6305"), info: t("skill_info_6305"), is_inst: true, t_times: 1, t_inv: 0, keep_waves: 15 },
{ uuid: 8304, skill: 6304, type: CardType.Skill, cost: 0, weight: 20, pool_lv: 1, wave: 1, kind: CKind.Skill, card_lv: 1, name: t("skill_name_6304"), info: t("skill_info_6304"), is_inst: true, t_times: 1, t_inv: 0, keep_waves: 15 },
{ uuid: 8305, skill: 6305, type: CardType.Skill, cost: 0, weight: 20, pool_lv: 1, wave: 1, kind: CKind.Skill, card_lv: 1, name: t("skill_name_6305"), info: t("skill_info_6305"), is_inst: true, t_times: 1, t_inv: 0, keep_waves: 15 },
// 自定义 overrides 示例卡牌
{
uuid: 6401, type: CardType.Skill, cost: 0, weight: 10, pool_lv: 1, wave: 1, kind: CKind.Skill, card_lv: 1,
uuid: 8401, skill: 6401, type: CardType.Skill, cost: 0, weight: 10, pool_lv: 1, wave: 1, kind: CKind.Skill, card_lv: 1,
name: "超强攻击强化", info: "使场上英雄增加50点攻击力",
is_inst: true, t_times: 1, t_inv: 0, keep_waves: 15, overrides: { ap: 50 }
},
{
uuid: 6101, type: CardType.Skill, cost: 0, weight: 10, pool_lv: 1, wave: 1, kind: CKind.Skill, card_lv: 1,
uuid: 8101, skill: 6101, type: CardType.Skill, cost: 0, weight: 10, pool_lv: 1, wave: 1, kind: CKind.Skill, card_lv: 1,
name: "持续天降火球", info: "战斗中每隔3秒释放一个火球造成300%伤害持续2波次",
is_inst: false, t_times: 999, t_inv: 3, keep_waves: 2, overrides: { TGroup: TGroup.Enemy, ap: 300, hit_count: 2 }
},
// 驻场技能示例卡牌
{
uuid: 6501, type: CardType.Skill, cost: 0, weight: 10, pool_lv: 1, wave: 1, kind: CKind.Skill, card_lv: 1,
uuid: 8501, skill: 6501, type: CardType.Skill, cost: 0, weight: 10, pool_lv: 1, wave: 1, kind: CKind.Skill, card_lv: 1,
name: "全体攻击光环", info: "全体英雄攻击力增加20%,只要此卡在场就生效",
is_inst: false, t_times: 999, t_inv: 0, keep_waves: -1, field: [7008] // 对应 FieldSkillSet[7008] HeroAtk +20%
},
{
uuid: 6502, type: CardType.Skill, cost: 0, weight: 10, pool_lv: 1, wave: 1, kind: CKind.Skill, card_lv: 1,
uuid: 8502, skill: 6502, type: CardType.Skill, cost: 0, weight: 10, pool_lv: 1, wave: 1, kind: CKind.Skill, card_lv: 1,
name: "全体生命光环", info: "全体英雄最大生命增加10%,只要此卡在场就生效",
is_inst: false, t_times: 999, t_inv: 0, keep_waves: -1, field: [7016] // 对应 FieldSkillSet[7016] HeroHp +10%
}

View File

@@ -13,7 +13,7 @@ export enum BoxSet {
LETF_END = -360,
RIGHT_END = 360,
//游戏地平线
GAME_LINE = 100,
GAME_LINE = -100,
}
export enum FacSet {

View File

@@ -63,16 +63,16 @@ export class MissSkillsComp extends CCComp {
* 第 2 行 y=320x = -320, -240, -160, -80, 0
*/
private slots: SkillBoxSlot[] = [
{ x: -320, y: 340, used: false, node: null },
{ x: -240, y: 340, used: false, node: null },
{ x: -160, y: 340, used: false, node: null },
{ x: -80, y: 340, used: false, node: null },
{ x: 0, y: 340, used: false, node: null },
{ x: -320, y: 420, used: false, node: null },
{ x: -240, y: 420, used: false, node: null },
{ x: -160, y: 420, used: false, node: null },
{ x: -80, y: 420, used: false, node: null },
{ x: 0, y: 420, used: false, node: null },
{ x: -320, y: 200, used: false, node: null },
{ x: -240, y: 200, used: false, node: null },
{ x: -160, y: 200, used: false, node: null },
{ x: -80, y: 200, used: false, node: null },
{ x: 0, y: 200, used: false, node: null },
{ x: -320, y: 300, used: false, node: null },
{ x: -240, y: 300, used: false, node: null },
{ x: -160, y: 300, used: false, node: null },
{ x: -80, y: 300, used: false, node: null },
{ x: 0, y: 300, used: false, node: null },
];
/** 注册事件监听 */

View File

@@ -251,7 +251,8 @@ export class SCardComp extends CCComp {
});
});
const skill = SkillSet[this.card_uuid];
const s_uuid = this.cardData.skill ?? this.card_uuid;
const skill = SkillSet[s_uuid];
const skillCard = CardPoolList.find(c => c.uuid === 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) : "";
@@ -271,7 +272,7 @@ export class SCardComp extends CCComp {
if (iconNode) {
iconNode.setScale(new Vec3(1, 1, 1));
this.clearIconAnimation(iconNode);
const iconId = skill?.icon || `${this.card_uuid}`;
const iconId = skill?.icon || `${s_uuid}`;
this.updateIcon(iconNode, iconId);
}
}

View File

@@ -118,22 +118,24 @@ export class SkillBoxComp extends CCComp {
* 2. 更新 UI 显示(图标 + 次数)。
* 3. 即时技能立即触发一次;若次数已满则延迟销毁。
*
* @param uuid 技能 UUID
* @param uuid 卡牌 UUID
* @param card_lv 技能卡等级
*/
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) {
this.s_uuid = config.skill ?? uuid; // 获取实际的技能 UUID
this.is_instant = config.is_inst ?? true;
this.trigger_times = config.t_times ?? 1;
this.trigger_interval = config.t_inv ?? 0;
this.keep_waves = config.keep_waves ?? 0;
this.overrides = config.overrides;
this.field = config.field || [];
} else {
this.s_uuid = uuid;
}
this.current_trigger_times = 0;