From 371178fce33e925e7935624c54513cae1da9bf5c Mon Sep 17 00:00:00 2001 From: pan Date: Tue, 28 Jul 2026 16:07:03 +0800 Subject: [PATCH] =?UTF-8?q?fix(heroBox):=20=E4=BF=AE=E5=A4=8D=E8=8B=B1?= =?UTF-8?q?=E9=9B=84=E9=9D=A2=E6=9D=BF=E5=B1=9E=E6=80=A7=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=94=99=E4=BD=8D=E4=B8=8E=E5=B1=95=E5=BC=80=E6=94=B6=E8=B5=B7?= =?UTF-8?q?=E9=AB=98=E5=BA=A6=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 修正了暴击率/击晕率的文本和节点名称混淆问题 2. 添加属性栏容器节点,实现展开收起时动态调整高度 3. 修复预制体中属性行的绑定关系错乱问题 --- assets/resources/gui/element/herobox.prefab | 121 ++++++++++---------- assets/script/game/map/HeroBoxComp.ts | 17 ++- 2 files changed, 76 insertions(+), 62 deletions(-) diff --git a/assets/resources/gui/element/herobox.prefab b/assets/resources/gui/element/herobox.prefab index 4057b764..7d768bc3 100644 --- a/assets/resources/gui/element/herobox.prefab +++ b/assets/resources/gui/element/herobox.prefab @@ -4830,7 +4830,7 @@ }, { "__type__": "cc.Node", - "_name": "crt", + "_name": "stun", "_objFlags": 0, "__editorExtras__": {}, "_parent": { @@ -4964,7 +4964,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "23OgUQSWJOq5zQxc6J1hU3" + "fileId": "a7bBKKejlHJJdonzsgqf2e" }, { "__type__": "cc.Label", @@ -4988,7 +4988,7 @@ "b": 255, "a": 255 }, - "_string": "暴击率:", + "_string": "击晕率:", "_horizontalAlign": 1, "_verticalAlign": 1, "_actualFontSize": 15, @@ -5032,7 +5032,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "ebOqqsA9VFtIYd8DIOSGQK" + "fileId": "28oScCAg1AdaVKL9nzk69N" }, { "__type__": "cc.PrefabInfo", @@ -5042,7 +5042,7 @@ "asset": { "__id__": 0 }, - "fileId": "84/ESDOKlOIptfoG9+jEsU", + "fileId": "91qTH/ditJ37Qw/bZi2AQb", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -5123,7 +5123,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "d149Ex+CFGlog98SAja2LG" + "fileId": "92OiU2/sVAXq3ByK0YL/n5" }, { "__type__": "cc.Label", @@ -5191,7 +5191,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "97lsHbUclAeZk57lP7GxA8" + "fileId": "2aawePuyRBy72HsAg3axB0" }, { "__type__": "cc.PrefabInfo", @@ -5201,7 +5201,7 @@ "asset": { "__id__": 0 }, - "fileId": "edCkK8XTJI4I1IWajtvDei", + "fileId": "fb5IOgBC9FUJ7gxhgxpf05", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -5282,7 +5282,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "dbFHhUQmROZY5gpSX1TeXb" + "fileId": "5a092DU4NApp5gR/JgBvvi" }, { "__type__": "cc.Label", @@ -5350,7 +5350,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "8eRw0o/MxHHJpJ2tA/8tYq" + "fileId": "14XBomUS1OoI9TNcMQmd5p" }, { "__type__": "cc.PrefabInfo", @@ -5360,7 +5360,7 @@ "asset": { "__id__": 0 }, - "fileId": "49nPTFFIhGpJEwyKXU4EmE", + "fileId": "04DQ6+ffNNtr7YSS9DPGSi", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -5391,7 +5391,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "20S7/ZZwRNyJJKXWwgJBCD" + "fileId": "52J+nl6NhEwISdQOF5m4j+" }, { "__type__": "cc.Layout", @@ -5429,7 +5429,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "39C6+AYDlBXrHXTet1pNqB" + "fileId": "52OWhUvItF8a/zbawuo9VE" }, { "__type__": "cc.PrefabInfo", @@ -5439,14 +5439,14 @@ "asset": { "__id__": 0 }, - "fileId": "3d4GQZURdM5r23jdOMVjD5", + "fileId": "eeQCVMj0JGZJiignND/ULN", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { "__type__": "cc.Node", - "_name": "crt-d", + "_name": "crt", "_objFlags": 0, "__editorExtras__": {}, "_parent": { @@ -5527,7 +5527,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -74.6650390625, + "x": -73.416259765625, "y": 0, "z": 0 }, @@ -5568,7 +5568,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 50.669921875, + "width": 53.16748046875, "height": 24.16 }, "_anchorPoint": { @@ -5580,7 +5580,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "6e5f243lFFf5HyeB8yNU4Y" + "fileId": "23OgUQSWJOq5zQxc6J1hU3" }, { "__type__": "cc.Label", @@ -5604,7 +5604,7 @@ "b": 255, "a": 255 }, - "_string": "爆 伤:", + "_string": "暴击率:", "_horizontalAlign": 1, "_verticalAlign": 1, "_actualFontSize": 15, @@ -5648,7 +5648,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "9cEMtGZ0dLg4ltNa/hkbV2" + "fileId": "ebOqqsA9VFtIYd8DIOSGQK" }, { "__type__": "cc.PrefabInfo", @@ -5658,7 +5658,7 @@ "asset": { "__id__": 0 }, - "fileId": "bdHkHm8QNNyIz63Nd5IHuM", + "fileId": "84/ESDOKlOIptfoG9+jEsU", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -5686,7 +5686,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -31.319091796875, + "x": -28.821533203125, "y": 0, "z": 0 }, @@ -5739,7 +5739,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "16XeGbcjxGKZCd5wxqhL7L" + "fileId": "d149Ex+CFGlog98SAja2LG" }, { "__type__": "cc.Label", @@ -5807,7 +5807,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "5a76E1xxdP24y3u2L+z37Q" + "fileId": "97lsHbUclAeZk57lP7GxA8" }, { "__type__": "cc.PrefabInfo", @@ -5817,7 +5817,7 @@ "asset": { "__id__": 0 }, - "fileId": "a7YrwGQaVCsapklkIRHfh+", + "fileId": "edCkK8XTJI4I1IWajtvDei", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -5845,7 +5845,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -13.30810546875, + "x": -10.810546875, "y": 0, "z": 0 }, @@ -5898,7 +5898,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "39sdIey3JAUKlFfDH4LXKi" + "fileId": "dbFHhUQmROZY5gpSX1TeXb" }, { "__type__": "cc.Label", @@ -5966,7 +5966,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "060L3HbmlJDJTO3SC/TjLs" + "fileId": "8eRw0o/MxHHJpJ2tA/8tYq" }, { "__type__": "cc.PrefabInfo", @@ -5976,7 +5976,7 @@ "asset": { "__id__": 0 }, - "fileId": "104sbIq11NG7vPH7SZOKi3", + "fileId": "49nPTFFIhGpJEwyKXU4EmE", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -6007,7 +6007,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "24oS/ToblMI68ZJ9tLiDnH" + "fileId": "20S7/ZZwRNyJJKXWwgJBCD" }, { "__type__": "cc.Layout", @@ -6045,7 +6045,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "d4f1mJ/CtO35PHKKIV1h7/" + "fileId": "39C6+AYDlBXrHXTet1pNqB" }, { "__type__": "cc.PrefabInfo", @@ -6055,14 +6055,14 @@ "asset": { "__id__": 0 }, - "fileId": "bcbF+3UzZP9JVCuP62yFKE", + "fileId": "3d4GQZURdM5r23jdOMVjD5", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { "__type__": "cc.Node", - "_name": "stun", + "_name": "crt-d", "_objFlags": 0, "__editorExtras__": {}, "_parent": { @@ -6143,7 +6143,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -73.416259765625, + "x": -74.6650390625, "y": 0, "z": 0 }, @@ -6184,7 +6184,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 53.16748046875, + "width": 50.669921875, "height": 24.16 }, "_anchorPoint": { @@ -6196,7 +6196,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "a7bBKKejlHJJdonzsgqf2e" + "fileId": "6e5f243lFFf5HyeB8yNU4Y" }, { "__type__": "cc.Label", @@ -6220,7 +6220,7 @@ "b": 255, "a": 255 }, - "_string": "击晕率:", + "_string": "爆 伤:", "_horizontalAlign": 1, "_verticalAlign": 1, "_actualFontSize": 15, @@ -6264,7 +6264,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "28oScCAg1AdaVKL9nzk69N" + "fileId": "9cEMtGZ0dLg4ltNa/hkbV2" }, { "__type__": "cc.PrefabInfo", @@ -6274,7 +6274,7 @@ "asset": { "__id__": 0 }, - "fileId": "91qTH/ditJ37Qw/bZi2AQb", + "fileId": "bdHkHm8QNNyIz63Nd5IHuM", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -6302,7 +6302,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -28.821533203125, + "x": -31.319091796875, "y": 0, "z": 0 }, @@ -6355,7 +6355,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "92OiU2/sVAXq3ByK0YL/n5" + "fileId": "16XeGbcjxGKZCd5wxqhL7L" }, { "__type__": "cc.Label", @@ -6423,7 +6423,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "2aawePuyRBy72HsAg3axB0" + "fileId": "5a76E1xxdP24y3u2L+z37Q" }, { "__type__": "cc.PrefabInfo", @@ -6433,7 +6433,7 @@ "asset": { "__id__": 0 }, - "fileId": "fb5IOgBC9FUJ7gxhgxpf05", + "fileId": "a7YrwGQaVCsapklkIRHfh+", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -6461,7 +6461,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -10.810546875, + "x": -13.30810546875, "y": 0, "z": 0 }, @@ -6514,7 +6514,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "5a092DU4NApp5gR/JgBvvi" + "fileId": "39sdIey3JAUKlFfDH4LXKi" }, { "__type__": "cc.Label", @@ -6582,7 +6582,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "14XBomUS1OoI9TNcMQmd5p" + "fileId": "060L3HbmlJDJTO3SC/TjLs" }, { "__type__": "cc.PrefabInfo", @@ -6592,7 +6592,7 @@ "asset": { "__id__": 0 }, - "fileId": "04DQ6+ffNNtr7YSS9DPGSi", + "fileId": "104sbIq11NG7vPH7SZOKi3", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -6623,7 +6623,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "52J+nl6NhEwISdQOF5m4j+" + "fileId": "24oS/ToblMI68ZJ9tLiDnH" }, { "__type__": "cc.Layout", @@ -6661,7 +6661,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "52OWhUvItF8a/zbawuo9VE" + "fileId": "d4f1mJ/CtO35PHKKIV1h7/" }, { "__type__": "cc.PrefabInfo", @@ -6671,7 +6671,7 @@ "asset": { "__id__": 0 }, - "fileId": "eeQCVMj0JGZJiignND/ULN", + "fileId": "bcbF+3UzZP9JVCuP62yFKE", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -10645,10 +10645,10 @@ "__id__": 157 }, "crt_all_label": { - "__id__": 247 + "__id__": 271 }, "crt_plus_label": { - "__id__": 253 + "__id__": 277 }, "knockback_all_label": { "__id__": 343 @@ -10663,10 +10663,10 @@ "__id__": 397 }, "stun_all_label": { - "__id__": 295 + "__id__": 247 }, "stun_plus_label": { - "__id__": 301 + "__id__": 253 }, "speed_all_label": { "__id__": 223 @@ -10678,7 +10678,7 @@ "__id__": 319 }, "freeze_plus_label": { - "__id__": 301 + "__id__": 253 }, "puncture_all_label": { "__id__": 367 @@ -10687,17 +10687,18 @@ "__id__": 373 }, "crit_dmg_all_label": { - "__id__": 271 + "__id__": 295 }, "crit_dmg_plus_label": { - "__id__": 277 + "__id__": 301 + }, + "attr_box": { + "__id__": 168 }, "more_btn": { "__id__": 169 }, - "stun_row": { - "__id__": 285 - }, + "stun_row": null, "freeze_row": { "__id__": 309 }, diff --git a/assets/script/game/map/HeroBoxComp.ts b/assets/script/game/map/HeroBoxComp.ts index 8f0c9155..c575c5a1 100644 --- a/assets/script/game/map/HeroBoxComp.ts +++ b/assets/script/game/map/HeroBoxComp.ts @@ -12,7 +12,7 @@ * - HeroInfo(heroSet)—— 英雄静态配置 */ import { mLogger } from "../common/Logger"; -import { _decorator, Node, Sprite, Label, resources, AnimationClip, SpriteFrame, NodeEventType } from "cc"; +import { _decorator, Node, Sprite, Label, resources, AnimationClip, SpriteFrame, NodeEventType, UITransform } 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 { oops } from "db://oops-framework/core/Oops"; @@ -112,6 +112,9 @@ export class HeroBoxComp extends CCComp { // ======================== 更多属性折叠栏 ======================== + /** 属性栏容器(展开/收起时动态调整高度) */ + @property(Node) + private attr_box: Node = null; /** 更多按钮(点击展开/收起次级属性栏) */ @property(Node) private more_btn: Node = null; @@ -133,6 +136,10 @@ export class HeroBoxComp extends CCComp { /** 次级属性栏是否展开 */ private moreExpanded: boolean = false; + /** 属性栏收起高度 */ + private static readonly ATTR_BOX_HEIGHT_COLLAPSED = 125; + /** 属性栏展开高度 */ + private static readonly ATTR_BOX_HEIGHT_EXPANDED = 210; // ======================== 运行时状态 ======================== @@ -166,7 +173,7 @@ export class HeroBoxComp extends CCComp { this.setMoreRowsVisible(this.moreExpanded); } - /** 设置 5 个次级属性栏(击晕/冰冻/击退/穿透/风怒)的可见性 */ + /** 设置 5 个次级属性栏(击晕/冰冻/击退/穿透/风怒)的可见性,并同步调整属性栏高度 */ private setMoreRowsVisible(visible: boolean) { const rows = [this.stun_row, this.freeze_row, this.knockback_row, this.puncture_row, this.wfuny_row]; for (const row of rows) { @@ -174,6 +181,12 @@ export class HeroBoxComp extends CCComp { row.active = visible; } } + // 展开/收起时切换属性栏高度(125 ↔ 210) + if (this.attr_box && this.attr_box.isValid) { + const transform = this.attr_box.getComponent(UITransform) || this.attr_box.addComponent(UITransform); + const height = visible ? HeroBoxComp.ATTR_BOX_HEIGHT_EXPANDED : HeroBoxComp.ATTR_BOX_HEIGHT_COLLAPSED; + transform.setContentSize(transform.width, height); + } } /** ECS 组件移除时销毁节点 */