From 120ea12a360c4470e7f0550336310f3068d20cc4 Mon Sep 17 00:00:00 2001 From: panFD Date: Sun, 30 Aug 2026 23:43:13 +0800 Subject: [PATCH] =?UTF-8?q?refactor(map):=20=E7=A7=BB=E9=99=A4=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E6=A1=86=E8=83=8C=E6=99=AF=E8=8A=82=E7=82=B9=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 删除SskillBoxComp中bg_node属性和updateBgNode方法 2. 精简prefab中冗余的节点配置 3. 修复CardLiteComp的canup渲染覆盖问题 --- assets/resources/gui/element/sibox.prefab | 15 +++++++----- assets/script/game/map/CardLiteComp.ts | 3 +++ assets/script/game/map/SSkillBoxComp.ts | 29 ----------------------- 3 files changed, 12 insertions(+), 35 deletions(-) diff --git a/assets/resources/gui/element/sibox.prefab b/assets/resources/gui/element/sibox.prefab index dcabc833..2c5f52fd 100644 --- a/assets/resources/gui/element/sibox.prefab +++ b/assets/resources/gui/element/sibox.prefab @@ -472,6 +472,8 @@ "__id__": 0 }, "fileId": "0609p02BxJi4U2Di/K3fcs", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -524,10 +526,7 @@ "b": 255, "a": 255 }, - "_spriteFrame": { - "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@58f49", - "__expectedType__": "cc.SpriteFrame" - }, + "_spriteFrame": null, "_type": 0, "_fillType": 0, "_sizeMode": 0, @@ -1221,7 +1220,7 @@ "__id__": 87 } ], - "_active": true, + "_active": false, "_components": [ { "__id__": 93 @@ -1673,6 +1672,8 @@ "__id__": 0 }, "fileId": "70kRUgd4JHx7ic4UPHFlN9", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -3377,9 +3378,11 @@ "__id__": 145 }, "icon_node": { + "__id__": 105 + }, + "bg_node": { "__id__": 2 }, - "bg_node": null, "lv_label": { "__id__": 124 }, diff --git a/assets/script/game/map/CardLiteComp.ts b/assets/script/game/map/CardLiteComp.ts index 727a0d0b..be81ae20 100644 --- a/assets/script/game/map/CardLiteComp.ts +++ b/assets/script/game/map/CardLiteComp.ts @@ -80,6 +80,8 @@ export class CardLiteComp extends CCComp { this.bindEvents(); this.opacityComp = this.node.getComponent(UIOpacity) || this.node.addComponent(UIOpacity); this.opacityComp.opacity = 255; + // onLoad 在 addChild 时才触发,晚于 setHeroByUuid;此处按已赋值的数据重新判定 canup,避免覆盖渲染结果 + this.refreshCanUp(); } onDestroy() { @@ -104,6 +106,7 @@ export class CardLiteComp extends CCComp { this.card_uuid = uuid; this.node.active = true; this.applyHeroUI(hero); + this.refreshCanUp(); mLogger.log(this.debugMode, "CardLiteComp", "setHeroByUuid", { uuid }); } diff --git a/assets/script/game/map/SSkillBoxComp.ts b/assets/script/game/map/SSkillBoxComp.ts index 9b41f48d..141e4aaf 100644 --- a/assets/script/game/map/SSkillBoxComp.ts +++ b/assets/script/game/map/SSkillBoxComp.ts @@ -26,10 +26,6 @@ export class SSkillBoxComp extends CCComp { @property({ type: Node }) private icon_node: Node = null; - /** 技能图标节点:下面有 green blue purple red yellow 5个不同颜色节点*/ - @property({ type: Node }) - private bg_node: Node = null; - /** 技能等级标签 */ @property(Label) private lv_label: Label = null; @@ -136,27 +132,6 @@ export class SSkillBoxComp extends CCComp { } } - /** - * 根据技能等级切换 bg_node 下的颜色子节点显示。 - * 等级与颜色对应关系: - * 技能卡档位:card_lv 1 (wave 1) → green,2 (wave 5) → blue,3 (wave 8) → purple - * 英雄技能等级:s_lv 1~5 → green / blue / purple / red / yellow - */ - private updateBgNode() { - if (!this.bg_node) return; - const lvToColor: Record = { - 1: "green", - 2: "blue", - 3: "purple", - 4: "red", - 5: "yellow", - }; - const targetColor = lvToColor[this.card_lv]; - this.bg_node.children.forEach(child => { - child.active = (child.name === targetColor); - }); - } - /** * 解析技能名称: * 1. 显式设置的卡牌名(最高优先级); @@ -228,15 +203,11 @@ export class SSkillBoxComp extends CCComp { /** * 更新 UI: - * - 背景:根据技能等级切换对应颜色子节点显示 * - 图标:从 uicons 图集获取 * - 名称标签:显示技能名称 * - 等级标签:显示技能等级(Lv.x 样式) */ updateUI() { - // 按技能等级切换背景颜色节点(与 getLvColor 等级配色一致) - this.updateBgNode(); - // 加载技能图标 if (this.icon_node) { // 优先使用卡牌自定义 icon;未定义则按图鉴模式 / 装备卡 trigger_type 自动取