feat(game): 重构卡牌技能关联逻辑,调整游戏UI布局
为CardConfig新增skill字段,支持卡牌独立关联技能UUID 重构SCardComp与SkillBoxComp的技能获取逻辑,修复技能图标与配置读取问题,修正组件参数注释 调整GameSet中的游戏地平线坐标,优化多个场景与UI预制体的布局位置 移除部分预制体中的冗余配置项,清理无效代码
This commit is contained in:
@@ -404,7 +404,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"y": -200,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -21904,8 +21904,6 @@
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "c4IqMKgXNExa5w4EAciRxE",
|
||||
"instance": null,
|
||||
"targetOverrides": null,
|
||||
"nestedPrefabInstanceRoots": null
|
||||
},
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -70,7 +70,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": -170,
|
||||
"y": 390,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -164,7 +164,7 @@
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 700,
|
||||
"height": 250
|
||||
"height": 310
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -774,7 +774,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -240,
|
||||
"y": 0,
|
||||
"y": 21.879,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -6610,8 +6610,8 @@
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 260.962,
|
||||
"y": -78.959,
|
||||
"x": 259.779,
|
||||
"y": -113.255,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -7012,8 +7012,8 @@
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 120.608,
|
||||
"y": -78.959,
|
||||
"x": 119.425,
|
||||
"y": -113.255,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -7418,7 +7418,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 100,
|
||||
"y": 81.742,
|
||||
"y": 103.621,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -9897,7 +9897,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 100,
|
||||
"y": 0,
|
||||
"y": 0.887,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -9991,7 +9991,7 @@
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 900,
|
||||
"height": 210
|
||||
"height": 310
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -10275,7 +10275,7 @@
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 460,
|
||||
"height": 100
|
||||
"height": 150
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -10390,7 +10390,7 @@
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 700,
|
||||
"height": 240
|
||||
"height": 300
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -10436,9 +10436,6 @@
|
||||
"lv_node": {
|
||||
"__id__": 165
|
||||
},
|
||||
"pool_lvnode": {
|
||||
"__id__": 168
|
||||
},
|
||||
"ap_node": {
|
||||
"__id__": 391
|
||||
},
|
||||
@@ -10466,11 +10463,11 @@
|
||||
"__prefab": {
|
||||
"__id__": 493
|
||||
},
|
||||
"_alignFlags": 44,
|
||||
"_alignFlags": 41,
|
||||
"_target": null,
|
||||
"_left": 10,
|
||||
"_right": 10,
|
||||
"_top": 0,
|
||||
"_top": 100,
|
||||
"_bottom": 350,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
@@ -10481,7 +10478,7 @@
|
||||
"_isAbsHorizontalCenter": true,
|
||||
"_isAbsVerticalCenter": true,
|
||||
"_originalWidth": 110,
|
||||
"_originalHeight": 0,
|
||||
"_originalHeight": 240,
|
||||
"_alignMode": 2,
|
||||
"_lockFlags": 0,
|
||||
"_id": ""
|
||||
|
||||
@@ -14302,7 +14302,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 761.798,
|
||||
"y": 969.971,
|
||||
"y": 640,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -14903,11 +14903,11 @@
|
||||
"__prefab": {
|
||||
"__id__": 701
|
||||
},
|
||||
"_alignFlags": 1,
|
||||
"_alignFlags": 2,
|
||||
"_target": null,
|
||||
"_left": 0,
|
||||
"_right": 0,
|
||||
"_top": 250.0290000000001,
|
||||
"_top": 448.34799999999996,
|
||||
"_bottom": 0,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
|
||||
@@ -232,7 +232,7 @@
|
||||
"_top": 0,
|
||||
"_bottom": 0,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
"_verticalCenter": -200,
|
||||
"_isAbsLeft": true,
|
||||
"_isAbsRight": true,
|
||||
"_isAbsTop": true,
|
||||
@@ -276,7 +276,7 @@
|
||||
"value": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -185.574,
|
||||
"y": 640,
|
||||
"y": 440,
|
||||
"z": 0
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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%
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ export enum BoxSet {
|
||||
LETF_END = -360,
|
||||
RIGHT_END = 360,
|
||||
//游戏地平线
|
||||
GAME_LINE = 100,
|
||||
GAME_LINE = -100,
|
||||
}
|
||||
|
||||
export enum FacSet {
|
||||
|
||||
@@ -63,16 +63,16 @@ export class MissSkillsComp extends CCComp {
|
||||
* 第 2 行 y=320:x = -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 },
|
||||
];
|
||||
|
||||
/** 注册事件监听 */
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user