feat(heroBox): 添加英雄信息次级属性折叠功能

1. 移除了三个精灵组件的固定贴图,改为空引用
2. 新增更多属性折叠按钮和5个次级属性栏节点
3. 实现点击按钮切换次级属性栏显示/隐藏的逻辑
4. 调整了英雄盒子预制体的布局和文本内容
5. 修复了布局对齐参数和预制体关联信息
This commit is contained in:
pan
2026-07-28 16:06:28 +08:00
parent a9d891ab86
commit 16cc50cfdf
3 changed files with 140 additions and 85 deletions

View File

@@ -3103,7 +3103,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -105, "x": -105,
"y": 81.1400000000001, "y": 86.63,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -3184,7 +3184,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 105, "x": 105,
"y": 346, "y": 345,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -3247,7 +3247,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 84, "y": 85,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -4246,7 +4246,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 53, "y": 54,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -4862,7 +4862,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 32, "y": 33,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -5478,7 +5478,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 11, "y": 12,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -5527,7 +5527,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -73.416259765625, "x": -74.6650390625,
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
@@ -5568,7 +5568,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 53.16748046875, "width": 50.669921875,
"height": 24.16 "height": 24.16
}, },
"_anchorPoint": { "_anchorPoint": {
@@ -5604,7 +5604,7 @@
"b": 255, "b": 255,
"a": 255 "a": 255
}, },
"_string": "暴击率:", "_string": "爆 伤:",
"_horizontalAlign": 1, "_horizontalAlign": 1,
"_verticalAlign": 1, "_verticalAlign": 1,
"_actualFontSize": 15, "_actualFontSize": 15,
@@ -5686,7 +5686,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -28.821533203125, "x": -31.319091796875,
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
@@ -5845,7 +5845,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -10.810546875, "x": -13.30810546875,
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
@@ -6094,7 +6094,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": -10, "y": -9,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -6710,7 +6710,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": -31, "y": -30,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -7326,7 +7326,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": -52, "y": -51,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -7910,7 +7910,7 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "wfuny", "_name": "pru",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
@@ -7942,7 +7942,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": -73, "y": -72,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -8044,7 +8044,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "eefkW38wZO7KqxsKDiiGaQ" "fileId": "33Kvd7OkJNtr1odgQG4JYo"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
@@ -8068,7 +8068,7 @@
"b": 255, "b": 255,
"a": 255 "a": 255
}, },
"_string": "击退率:", "_string": "穿透率:",
"_horizontalAlign": 1, "_horizontalAlign": 1,
"_verticalAlign": 1, "_verticalAlign": 1,
"_actualFontSize": 15, "_actualFontSize": 15,
@@ -8112,7 +8112,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "f7X8Lj/XlDtL8S8fmsEk3p" "fileId": "0besXTXnZEcJCsiQaj7jaG"
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
@@ -8122,7 +8122,7 @@
"asset": { "asset": {
"__id__": 0 "__id__": 0
}, },
"fileId": "c8V9s+isxOWZw4MnKaGPZl", "fileId": "0aagOhsKFIq6EuhAzbFG14",
"instance": null, "instance": null,
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
@@ -8203,7 +8203,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "76IPaTY2pOVImlwbHS5DyJ" "fileId": "04MFO0UMFAio1gGI8O9qRh"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
@@ -8271,7 +8271,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "e7FA7sHe5KDbu749C2cU0K" "fileId": "10G0BZr+hMza5rUA8Qgtmq"
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
@@ -8281,7 +8281,7 @@
"asset": { "asset": {
"__id__": 0 "__id__": 0
}, },
"fileId": "98BCi8iSxPJYC3DhF/tRSN", "fileId": "4aIbR+NmRGF4zGPJh2+vk7",
"instance": null, "instance": null,
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
@@ -8362,7 +8362,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "2434J6PINKG7Zviwuxv89Y" "fileId": "82XUe6xt9EPL5mIs2xsPaZ"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
@@ -8430,7 +8430,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "b9mL4efaxLl5I+vtLgT9dn" "fileId": "6fs9DH/oZCt54tRMCeYWUH"
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
@@ -8440,7 +8440,7 @@
"asset": { "asset": {
"__id__": 0 "__id__": 0
}, },
"fileId": "41poaGoDBPMpPk5Dv+nT2N", "fileId": "2aXTNNC9pDiKnJAg+vsyPw",
"instance": null, "instance": null,
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
@@ -8471,7 +8471,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "62BDC1a49NG6iLViqQ9mEs" "fileId": "96oz7gpphNh4wXy5DqxIaN"
}, },
{ {
"__type__": "cc.Layout", "__type__": "cc.Layout",
@@ -8509,7 +8509,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "88NW6oyDpIm7NuXT5WZirE" "fileId": "68RaQ5uBZGPJH7YKxtneTz"
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
@@ -8519,14 +8519,14 @@
"asset": { "asset": {
"__id__": 0 "__id__": 0
}, },
"fileId": "3cW8usDWVKQoW+i5kiq8zv", "fileId": "36efkC0/lBnYK1sqHJ8koP",
"instance": null, "instance": null,
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "pru", "_name": "wfuny",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
@@ -8558,7 +8558,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": -94, "y": -93,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -8660,7 +8660,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "33Kvd7OkJNtr1odgQG4JYo" "fileId": "eefkW38wZO7KqxsKDiiGaQ"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
@@ -8684,7 +8684,7 @@
"b": 255, "b": 255,
"a": 255 "a": 255
}, },
"_string": "击退率:", "_string": "风怒率:",
"_horizontalAlign": 1, "_horizontalAlign": 1,
"_verticalAlign": 1, "_verticalAlign": 1,
"_actualFontSize": 15, "_actualFontSize": 15,
@@ -8728,7 +8728,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "0besXTXnZEcJCsiQaj7jaG" "fileId": "f7X8Lj/XlDtL8S8fmsEk3p"
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
@@ -8738,7 +8738,7 @@
"asset": { "asset": {
"__id__": 0 "__id__": 0
}, },
"fileId": "0aagOhsKFIq6EuhAzbFG14", "fileId": "c8V9s+isxOWZw4MnKaGPZl",
"instance": null, "instance": null,
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
@@ -8819,7 +8819,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "04MFO0UMFAio1gGI8O9qRh" "fileId": "76IPaTY2pOVImlwbHS5DyJ"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
@@ -8887,7 +8887,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "10G0BZr+hMza5rUA8Qgtmq" "fileId": "e7FA7sHe5KDbu749C2cU0K"
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
@@ -8897,7 +8897,7 @@
"asset": { "asset": {
"__id__": 0 "__id__": 0
}, },
"fileId": "4aIbR+NmRGF4zGPJh2+vk7", "fileId": "98BCi8iSxPJYC3DhF/tRSN",
"instance": null, "instance": null,
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
@@ -8978,7 +8978,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "82XUe6xt9EPL5mIs2xsPaZ" "fileId": "2434J6PINKG7Zviwuxv89Y"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
@@ -9046,7 +9046,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "6fs9DH/oZCt54tRMCeYWUH" "fileId": "b9mL4efaxLl5I+vtLgT9dn"
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
@@ -9056,7 +9056,7 @@
"asset": { "asset": {
"__id__": 0 "__id__": 0
}, },
"fileId": "2aXTNNC9pDiKnJAg+vsyPw", "fileId": "41poaGoDBPMpPk5Dv+nT2N",
"instance": null, "instance": null,
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
@@ -9087,7 +9087,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "96oz7gpphNh4wXy5DqxIaN" "fileId": "62BDC1a49NG6iLViqQ9mEs"
}, },
{ {
"__type__": "cc.Layout", "__type__": "cc.Layout",
@@ -9125,7 +9125,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "68RaQ5uBZGPJH7YKxtneTz" "fileId": "88NW6oyDpIm7NuXT5WZirE"
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
@@ -9135,7 +9135,7 @@
"asset": { "asset": {
"__id__": 0 "__id__": 0
}, },
"fileId": "36efkC0/lBnYK1sqHJ8koP", "fileId": "3cW8usDWVKQoW+i5kiq8zv",
"instance": null, "instance": null,
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
@@ -9155,7 +9155,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 210, "width": 210,
"height": 208 "height": 210
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -9180,12 +9180,12 @@
"__prefab": { "__prefab": {
"__id__": 408 "__id__": 408
}, },
"_alignFlags": 41, "_alignFlags": 40,
"_target": null, "_target": null,
"_left": 0, "_left": 0,
"_right": 0, "_right": 0,
"_top": 0, "_top": -190,
"_bottom": 0, "_bottom": 882,
"_horizontalCenter": 0, "_horizontalCenter": 0,
"_verticalCenter": 0, "_verticalCenter": 0,
"_isAbsLeft": true, "_isAbsLeft": true,
@@ -9195,7 +9195,7 @@
"_isAbsHorizontalCenter": true, "_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true, "_isAbsVerticalCenter": true,
"_originalWidth": 100, "_originalWidth": 100,
"_originalHeight": 0, "_originalHeight": 208,
"_alignMode": 2, "_alignMode": 2,
"_lockFlags": 0, "_lockFlags": 0,
"_id": "" "_id": ""
@@ -9216,7 +9216,7 @@
"__prefab": { "__prefab": {
"__id__": 410 "__id__": 410
}, },
"_resizeMode": 1, "_resizeMode": 0,
"_layoutType": 2, "_layoutType": 2,
"_cellSize": { "_cellSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -9235,7 +9235,7 @@
"_constraint": 0, "_constraint": 0,
"_constraintNum": 2, "_constraintNum": 2,
"_affectedByScale": false, "_affectedByScale": false,
"_isAlign": false, "_isAlign": true,
"_id": "" "_id": ""
}, },
{ {
@@ -9251,6 +9251,8 @@
"__id__": 0 "__id__": 0
}, },
"fileId": "0d18lKYtxLpKiCZ/jOdIIS", "fileId": "0d18lKYtxLpKiCZ/jOdIIS",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{ {
@@ -9284,7 +9286,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 105, "x": 105,
"y": 222, "y": 220,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -10352,11 +10354,11 @@
"__prefab": { "__prefab": {
"__id__": 460 "__id__": 460
}, },
"_alignFlags": 41, "_alignFlags": 40,
"_target": null, "_target": null,
"_left": 0, "_left": 0,
"_right": 0, "_right": 0,
"_top": 208, "_top": -172,
"_bottom": 0, "_bottom": 0,
"_horizontalCenter": 0, "_horizontalCenter": 0,
"_verticalCenter": 0, "_verticalCenter": 0,
@@ -10423,6 +10425,8 @@
"__id__": 0 "__id__": 0
}, },
"fileId": "acSAy0hgpMUY4Um7mbnFM2", "fileId": "acSAy0hgpMUY4Um7mbnFM2",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{ {
@@ -10469,7 +10473,7 @@
"_target": null, "_target": null,
"_left": 10, "_left": 10,
"_right": 10, "_right": 10,
"_top": 108.85999999999996, "_top": 103.37000000000002,
"_bottom": -1.4450000000000038, "_bottom": -1.4450000000000038,
"_horizontalCenter": 0, "_horizontalCenter": 0,
"_verticalCenter": 0, "_verticalCenter": 0,
@@ -10519,7 +10523,7 @@
"_horizontalDirection": 0, "_horizontalDirection": 0,
"_constraint": 0, "_constraint": 0,
"_constraintNum": 2, "_constraintNum": 2,
"_affectedByScale": false, "_affectedByScale": true,
"_isAlign": false, "_isAlign": false,
"_id": "" "_id": ""
}, },
@@ -10653,10 +10657,10 @@
"__id__": 349 "__id__": 349
}, },
"wfuny_all_label": { "wfuny_all_label": {
"__id__": 367 "__id__": 391
}, },
"wfuny_plus_label": { "wfuny_plus_label": {
"__id__": 373 "__id__": 397
}, },
"stun_all_label": { "stun_all_label": {
"__id__": 295 "__id__": 295
@@ -10677,10 +10681,10 @@
"__id__": 301 "__id__": 301
}, },
"puncture_all_label": { "puncture_all_label": {
"__id__": 391 "__id__": 367
}, },
"puncture_plus_label": { "puncture_plus_label": {
"__id__": 397 "__id__": 373
}, },
"crit_dmg_all_label": { "crit_dmg_all_label": {
"__id__": 271 "__id__": 271
@@ -10688,6 +10692,24 @@
"crit_dmg_plus_label": { "crit_dmg_plus_label": {
"__id__": 277 "__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": "" "_id": ""
}, },
{ {
@@ -11052,10 +11074,7 @@
"b": 255, "b": 255,
"a": 255 "a": 255
}, },
"_spriteFrame": { "_spriteFrame": null,
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@fcdc9",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 1, "_type": 1,
"_fillType": 0, "_fillType": 0,
"_sizeMode": 0, "_sizeMode": 0,
@@ -11191,10 +11210,7 @@
"b": 255, "b": 255,
"a": 255 "a": 255
}, },
"_spriteFrame": { "_spriteFrame": null,
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@fcdc9",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 1, "_type": 1,
"_fillType": 0, "_fillType": 0,
"_sizeMode": 0, "_sizeMode": 0,
@@ -11330,10 +11346,7 @@
"b": 255, "b": 255,
"a": 255 "a": 255
}, },
"_spriteFrame": { "_spriteFrame": null,
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@fcdc9",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 1, "_type": 1,
"_fillType": 0, "_fillType": 0,
"_sizeMode": 0, "_sizeMode": 0,

View File

@@ -3082,10 +3082,7 @@
"b": 255, "b": 255,
"a": 255 "a": 255
}, },
"_spriteFrame": { "_spriteFrame": null,
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@fcdc9",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 1, "_type": 1,
"_fillType": 0, "_fillType": 0,
"_sizeMode": 0, "_sizeMode": 0,
@@ -3221,10 +3218,7 @@
"b": 255, "b": 255,
"a": 255 "a": 255
}, },
"_spriteFrame": { "_spriteFrame": null,
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@fcdc9",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 1, "_type": 1,
"_fillType": 0, "_fillType": 0,
"_sizeMode": 0, "_sizeMode": 0,
@@ -3360,10 +3354,7 @@
"b": 255, "b": 255,
"a": 255 "a": 255
}, },
"_spriteFrame": { "_spriteFrame": null,
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@fcdc9",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 1, "_type": 1,
"_fillType": 0, "_fillType": 0,
"_sizeMode": 0, "_sizeMode": 0,

View File

@@ -12,9 +12,10 @@
* - HeroInfoheroSet—— 英雄静态配置 * - HeroInfoheroSet—— 英雄静态配置
*/ */
import { mLogger } from "../common/Logger"; 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 { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; 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 { HeroInfo } from "../common/config/heroSet";
import { HeroAttrsComp } from "../hero/HeroAttrsComp"; import { HeroAttrsComp } from "../hero/HeroAttrsComp";
import { getLvColor } from "../common/config/GameSet"; import { getLvColor } from "../common/config/GameSet";
@@ -109,6 +110,30 @@ export class HeroBoxComp extends CCComp {
@property(Label) @property(Label)
private crit_dmg_plus_label: Label = null; 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;
// ======================== 运行时状态 ======================== // ======================== 运行时状态 ========================
/** 绑定的英雄实体 ID0 表示空槽位) */ /** 绑定的英雄实体 ID0 表示空槽位) */
@@ -123,6 +148,32 @@ export class HeroBoxComp extends CCComp {
// ======================== 生命周期 ======================== // ======================== 生命周期 ========================
onLoad() { 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 组件移除时销毁节点 */ /** ECS 组件移除时销毁节点 */