feat(game): 重构卡牌技能关联逻辑,调整游戏UI布局
为CardConfig新增skill字段,支持卡牌独立关联技能UUID 重构SCardComp与SkillBoxComp的技能获取逻辑,修复技能图标与配置读取问题,修正组件参数注释 调整GameSet中的游戏地平线坐标,优化多个场景与UI预制体的布局位置 移除部分预制体中的冗余配置项,清理无效代码
This commit is contained in:
@@ -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