From 16cc50cfdf446b29f6d5b06d37ae77928a74b292 Mon Sep 17 00:00:00 2001 From: pan Date: Tue, 28 Jul 2026 16:06:28 +0800 Subject: [PATCH] =?UTF-8?q?feat(heroBox):=20=E6=B7=BB=E5=8A=A0=E8=8B=B1?= =?UTF-8?q?=E9=9B=84=E4=BF=A1=E6=81=AF=E6=AC=A1=E7=BA=A7=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E6=8A=98=E5=8F=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 移除了三个精灵组件的固定贴图,改为空引用 2. 新增更多属性折叠按钮和5个次级属性栏节点 3. 实现点击按钮切换次级属性栏显示/隐藏的逻辑 4. 调整了英雄盒子预制体的布局和文本内容 5. 修复了布局对齐参数和预制体关联信息 --- assets/resources/gui/element/herobox.prefab | 157 +++++++++++--------- assets/resources/gui/element/sbox.prefab | 15 +- assets/script/game/map/HeroBoxComp.ts | 53 ++++++- 3 files changed, 140 insertions(+), 85 deletions(-) diff --git a/assets/resources/gui/element/herobox.prefab b/assets/resources/gui/element/herobox.prefab index b46230bd..4057b764 100644 --- a/assets/resources/gui/element/herobox.prefab +++ b/assets/resources/gui/element/herobox.prefab @@ -3103,7 +3103,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": -105, - "y": 81.1400000000001, + "y": 86.63, "z": 0 }, "_lrot": { @@ -3184,7 +3184,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 105, - "y": 346, + "y": 345, "z": 0 }, "_lrot": { @@ -3247,7 +3247,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": 84, + "y": 85, "z": 0 }, "_lrot": { @@ -4246,7 +4246,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": 53, + "y": 54, "z": 0 }, "_lrot": { @@ -4862,7 +4862,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": 32, + "y": 33, "z": 0 }, "_lrot": { @@ -5478,7 +5478,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": 11, + "y": 12, "z": 0 }, "_lrot": { @@ -5527,7 +5527,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -73.416259765625, + "x": -74.6650390625, "y": 0, "z": 0 }, @@ -5568,7 +5568,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 53.16748046875, + "width": 50.669921875, "height": 24.16 }, "_anchorPoint": { @@ -5604,7 +5604,7 @@ "b": 255, "a": 255 }, - "_string": "暴击率:", + "_string": "爆 伤:", "_horizontalAlign": 1, "_verticalAlign": 1, "_actualFontSize": 15, @@ -5686,7 +5686,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -28.821533203125, + "x": -31.319091796875, "y": 0, "z": 0 }, @@ -5845,7 +5845,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -10.810546875, + "x": -13.30810546875, "y": 0, "z": 0 }, @@ -6094,7 +6094,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": -10, + "y": -9, "z": 0 }, "_lrot": { @@ -6710,7 +6710,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": -31, + "y": -30, "z": 0 }, "_lrot": { @@ -7326,7 +7326,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": -52, + "y": -51, "z": 0 }, "_lrot": { @@ -7910,7 +7910,7 @@ }, { "__type__": "cc.Node", - "_name": "wfuny", + "_name": "pru", "_objFlags": 0, "__editorExtras__": {}, "_parent": { @@ -7942,7 +7942,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": -73, + "y": -72, "z": 0 }, "_lrot": { @@ -8044,7 +8044,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "eefkW38wZO7KqxsKDiiGaQ" + "fileId": "33Kvd7OkJNtr1odgQG4JYo" }, { "__type__": "cc.Label", @@ -8068,7 +8068,7 @@ "b": 255, "a": 255 }, - "_string": "击退率:", + "_string": "穿透率:", "_horizontalAlign": 1, "_verticalAlign": 1, "_actualFontSize": 15, @@ -8112,7 +8112,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "f7X8Lj/XlDtL8S8fmsEk3p" + "fileId": "0besXTXnZEcJCsiQaj7jaG" }, { "__type__": "cc.PrefabInfo", @@ -8122,7 +8122,7 @@ "asset": { "__id__": 0 }, - "fileId": "c8V9s+isxOWZw4MnKaGPZl", + "fileId": "0aagOhsKFIq6EuhAzbFG14", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -8203,7 +8203,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "76IPaTY2pOVImlwbHS5DyJ" + "fileId": "04MFO0UMFAio1gGI8O9qRh" }, { "__type__": "cc.Label", @@ -8271,7 +8271,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "e7FA7sHe5KDbu749C2cU0K" + "fileId": "10G0BZr+hMza5rUA8Qgtmq" }, { "__type__": "cc.PrefabInfo", @@ -8281,7 +8281,7 @@ "asset": { "__id__": 0 }, - "fileId": "98BCi8iSxPJYC3DhF/tRSN", + "fileId": "4aIbR+NmRGF4zGPJh2+vk7", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -8362,7 +8362,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "2434J6PINKG7Zviwuxv89Y" + "fileId": "82XUe6xt9EPL5mIs2xsPaZ" }, { "__type__": "cc.Label", @@ -8430,7 +8430,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "b9mL4efaxLl5I+vtLgT9dn" + "fileId": "6fs9DH/oZCt54tRMCeYWUH" }, { "__type__": "cc.PrefabInfo", @@ -8440,7 +8440,7 @@ "asset": { "__id__": 0 }, - "fileId": "41poaGoDBPMpPk5Dv+nT2N", + "fileId": "2aXTNNC9pDiKnJAg+vsyPw", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -8471,7 +8471,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "62BDC1a49NG6iLViqQ9mEs" + "fileId": "96oz7gpphNh4wXy5DqxIaN" }, { "__type__": "cc.Layout", @@ -8509,7 +8509,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "88NW6oyDpIm7NuXT5WZirE" + "fileId": "68RaQ5uBZGPJH7YKxtneTz" }, { "__type__": "cc.PrefabInfo", @@ -8519,14 +8519,14 @@ "asset": { "__id__": 0 }, - "fileId": "3cW8usDWVKQoW+i5kiq8zv", + "fileId": "36efkC0/lBnYK1sqHJ8koP", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { "__type__": "cc.Node", - "_name": "pru", + "_name": "wfuny", "_objFlags": 0, "__editorExtras__": {}, "_parent": { @@ -8558,7 +8558,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": -94, + "y": -93, "z": 0 }, "_lrot": { @@ -8660,7 +8660,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "33Kvd7OkJNtr1odgQG4JYo" + "fileId": "eefkW38wZO7KqxsKDiiGaQ" }, { "__type__": "cc.Label", @@ -8684,7 +8684,7 @@ "b": 255, "a": 255 }, - "_string": "击退率:", + "_string": "风怒率:", "_horizontalAlign": 1, "_verticalAlign": 1, "_actualFontSize": 15, @@ -8728,7 +8728,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "0besXTXnZEcJCsiQaj7jaG" + "fileId": "f7X8Lj/XlDtL8S8fmsEk3p" }, { "__type__": "cc.PrefabInfo", @@ -8738,7 +8738,7 @@ "asset": { "__id__": 0 }, - "fileId": "0aagOhsKFIq6EuhAzbFG14", + "fileId": "c8V9s+isxOWZw4MnKaGPZl", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -8819,7 +8819,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "04MFO0UMFAio1gGI8O9qRh" + "fileId": "76IPaTY2pOVImlwbHS5DyJ" }, { "__type__": "cc.Label", @@ -8887,7 +8887,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "10G0BZr+hMza5rUA8Qgtmq" + "fileId": "e7FA7sHe5KDbu749C2cU0K" }, { "__type__": "cc.PrefabInfo", @@ -8897,7 +8897,7 @@ "asset": { "__id__": 0 }, - "fileId": "4aIbR+NmRGF4zGPJh2+vk7", + "fileId": "98BCi8iSxPJYC3DhF/tRSN", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -8978,7 +8978,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "82XUe6xt9EPL5mIs2xsPaZ" + "fileId": "2434J6PINKG7Zviwuxv89Y" }, { "__type__": "cc.Label", @@ -9046,7 +9046,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "6fs9DH/oZCt54tRMCeYWUH" + "fileId": "b9mL4efaxLl5I+vtLgT9dn" }, { "__type__": "cc.PrefabInfo", @@ -9056,7 +9056,7 @@ "asset": { "__id__": 0 }, - "fileId": "2aXTNNC9pDiKnJAg+vsyPw", + "fileId": "41poaGoDBPMpPk5Dv+nT2N", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -9087,7 +9087,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "96oz7gpphNh4wXy5DqxIaN" + "fileId": "62BDC1a49NG6iLViqQ9mEs" }, { "__type__": "cc.Layout", @@ -9125,7 +9125,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "68RaQ5uBZGPJH7YKxtneTz" + "fileId": "88NW6oyDpIm7NuXT5WZirE" }, { "__type__": "cc.PrefabInfo", @@ -9135,7 +9135,7 @@ "asset": { "__id__": 0 }, - "fileId": "36efkC0/lBnYK1sqHJ8koP", + "fileId": "3cW8usDWVKQoW+i5kiq8zv", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -9155,7 +9155,7 @@ "_contentSize": { "__type__": "cc.Size", "width": 210, - "height": 208 + "height": 210 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -9180,12 +9180,12 @@ "__prefab": { "__id__": 408 }, - "_alignFlags": 41, + "_alignFlags": 40, "_target": null, "_left": 0, "_right": 0, - "_top": 0, - "_bottom": 0, + "_top": -190, + "_bottom": 882, "_horizontalCenter": 0, "_verticalCenter": 0, "_isAbsLeft": true, @@ -9195,7 +9195,7 @@ "_isAbsHorizontalCenter": true, "_isAbsVerticalCenter": true, "_originalWidth": 100, - "_originalHeight": 0, + "_originalHeight": 208, "_alignMode": 2, "_lockFlags": 0, "_id": "" @@ -9216,7 +9216,7 @@ "__prefab": { "__id__": 410 }, - "_resizeMode": 1, + "_resizeMode": 0, "_layoutType": 2, "_cellSize": { "__type__": "cc.Size", @@ -9235,7 +9235,7 @@ "_constraint": 0, "_constraintNum": 2, "_affectedByScale": false, - "_isAlign": false, + "_isAlign": true, "_id": "" }, { @@ -9251,6 +9251,8 @@ "__id__": 0 }, "fileId": "0d18lKYtxLpKiCZ/jOdIIS", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -9284,7 +9286,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 105, - "y": 222, + "y": 220, "z": 0 }, "_lrot": { @@ -10352,11 +10354,11 @@ "__prefab": { "__id__": 460 }, - "_alignFlags": 41, + "_alignFlags": 40, "_target": null, "_left": 0, "_right": 0, - "_top": 208, + "_top": -172, "_bottom": 0, "_horizontalCenter": 0, "_verticalCenter": 0, @@ -10423,6 +10425,8 @@ "__id__": 0 }, "fileId": "acSAy0hgpMUY4Um7mbnFM2", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -10469,7 +10473,7 @@ "_target": null, "_left": 10, "_right": 10, - "_top": 108.85999999999996, + "_top": 103.37000000000002, "_bottom": -1.4450000000000038, "_horizontalCenter": 0, "_verticalCenter": 0, @@ -10519,7 +10523,7 @@ "_horizontalDirection": 0, "_constraint": 0, "_constraintNum": 2, - "_affectedByScale": false, + "_affectedByScale": true, "_isAlign": false, "_id": "" }, @@ -10653,10 +10657,10 @@ "__id__": 349 }, "wfuny_all_label": { - "__id__": 367 + "__id__": 391 }, "wfuny_plus_label": { - "__id__": 373 + "__id__": 397 }, "stun_all_label": { "__id__": 295 @@ -10677,10 +10681,10 @@ "__id__": 301 }, "puncture_all_label": { - "__id__": 391 + "__id__": 367 }, "puncture_plus_label": { - "__id__": 397 + "__id__": 373 }, "crit_dmg_all_label": { "__id__": 271 @@ -10688,6 +10692,24 @@ "crit_dmg_plus_label": { "__id__": 277 }, + "more_btn": { + "__id__": 169 + }, + "stun_row": { + "__id__": 285 + }, + "freeze_row": { + "__id__": 309 + }, + "knockback_row": { + "__id__": 333 + }, + "puncture_row": { + "__id__": 357 + }, + "wfuny_row": { + "__id__": 381 + }, "_id": "" }, { @@ -11052,10 +11074,7 @@ "b": 255, "a": 255 }, - "_spriteFrame": { - "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@fcdc9", - "__expectedType__": "cc.SpriteFrame" - }, + "_spriteFrame": null, "_type": 1, "_fillType": 0, "_sizeMode": 0, @@ -11191,10 +11210,7 @@ "b": 255, "a": 255 }, - "_spriteFrame": { - "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@fcdc9", - "__expectedType__": "cc.SpriteFrame" - }, + "_spriteFrame": null, "_type": 1, "_fillType": 0, "_sizeMode": 0, @@ -11330,10 +11346,7 @@ "b": 255, "a": 255 }, - "_spriteFrame": { - "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@fcdc9", - "__expectedType__": "cc.SpriteFrame" - }, + "_spriteFrame": null, "_type": 1, "_fillType": 0, "_sizeMode": 0, diff --git a/assets/resources/gui/element/sbox.prefab b/assets/resources/gui/element/sbox.prefab index b9934f4b..988aa316 100644 --- a/assets/resources/gui/element/sbox.prefab +++ b/assets/resources/gui/element/sbox.prefab @@ -3082,10 +3082,7 @@ "b": 255, "a": 255 }, - "_spriteFrame": { - "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@fcdc9", - "__expectedType__": "cc.SpriteFrame" - }, + "_spriteFrame": null, "_type": 1, "_fillType": 0, "_sizeMode": 0, @@ -3221,10 +3218,7 @@ "b": 255, "a": 255 }, - "_spriteFrame": { - "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@fcdc9", - "__expectedType__": "cc.SpriteFrame" - }, + "_spriteFrame": null, "_type": 1, "_fillType": 0, "_sizeMode": 0, @@ -3360,10 +3354,7 @@ "b": 255, "a": 255 }, - "_spriteFrame": { - "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@fcdc9", - "__expectedType__": "cc.SpriteFrame" - }, + "_spriteFrame": null, "_type": 1, "_fillType": 0, "_sizeMode": 0, diff --git a/assets/script/game/map/HeroBoxComp.ts b/assets/script/game/map/HeroBoxComp.ts index fa07fab4..8f0c9155 100644 --- a/assets/script/game/map/HeroBoxComp.ts +++ b/assets/script/game/map/HeroBoxComp.ts @@ -12,9 +12,10 @@ * - HeroInfo(heroSet)—— 英雄静态配置 */ import { mLogger } from "../common/Logger"; -import { _decorator, Node, Sprite, Label, resources, AnimationClip, SpriteFrame } from "cc"; +import { _decorator, Node, Sprite, Label, resources, AnimationClip, SpriteFrame, NodeEventType } 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"; import { HeroInfo } from "../common/config/heroSet"; import { HeroAttrsComp } from "../hero/HeroAttrsComp"; import { getLvColor } from "../common/config/GameSet"; @@ -109,6 +110,30 @@ export class HeroBoxComp extends CCComp { @property(Label) private crit_dmg_plus_label: Label = null; + // ======================== 更多属性折叠栏 ======================== + + /** 更多按钮(点击展开/收起次级属性栏) */ + @property(Node) + private more_btn: Node = null; + /** 击晕信息栏(默认隐藏) */ + @property(Node) + private stun_row: Node = null; + /** 冰冻信息栏(默认隐藏) */ + @property(Node) + private freeze_row: Node = null; + /** 击退信息栏(默认隐藏) */ + @property(Node) + private knockback_row: Node = null; + /** 穿透信息栏(默认隐藏) */ + @property(Node) + private puncture_row: Node = null; + /** 风怒信息栏(默认隐藏) */ + @property(Node) + private wfuny_row: Node = null; + + /** 次级属性栏是否展开 */ + private moreExpanded: boolean = false; + // ======================== 运行时状态 ======================== /** 绑定的英雄实体 ID(0 表示空槽位) */ @@ -123,6 +148,32 @@ export class HeroBoxComp extends CCComp { // ======================== 生命周期 ======================== onLoad() { + // 次级属性栏默认收起 + this.setMoreRowsVisible(false); + this.more_btn?.on(NodeEventType.TOUCH_END, this.onMoreBtnClick, this); + } + + onDestroy() { + if (this.more_btn && this.more_btn.isValid) { + this.more_btn.off(NodeEventType.TOUCH_END, this.onMoreBtnClick, this); + } + } + + /** 更多按钮点击:切换次级属性栏显示/隐藏 */ + private onMoreBtnClick() { + oops.audio.playEffect("music/button"); + this.moreExpanded = !this.moreExpanded; + this.setMoreRowsVisible(this.moreExpanded); + } + + /** 设置 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) { + if (row && row.isValid) { + row.active = visible; + } + } } /** ECS 组件移除时销毁节点 */