From 25cd0b419ec54575ec1c7a9b4eaa13d7b6775865 Mon Sep 17 00:00:00 2001 From: walkpan Date: Fri, 27 Mar 2026 20:14:04 +0800 Subject: [PATCH] =?UTF-8?q?fix(ui):=20=E5=8A=A8=E6=80=81=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=A1=86=E6=97=B6=E5=90=8C=E6=AD=A5=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=90=8D=E7=A7=B0=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复当信息框内容行数变化时,名称标签位置未同步调整的问题。新增 updateNamePosition 方法,根据显示行数动态计算名称的垂直位置,确保视觉布局的一致性。 --- assets/resources/gui/element/ibox.prefab | 587 +++++++++++------------ assets/script/game/map/IBoxComp.ts | 12 + 2 files changed, 286 insertions(+), 313 deletions(-) diff --git a/assets/resources/gui/element/ibox.prefab b/assets/resources/gui/element/ibox.prefab index a4153268..a9670448 100644 --- a/assets/resources/gui/element/ibox.prefab +++ b/assets/resources/gui/element/ibox.prefab @@ -22,11 +22,14 @@ "__id__": 2 }, { - "__id__": 24 + "__id__": 22 } ], "_active": true, "_components": [ + { + "__id__": 190 + }, { "__id__": 192 }, @@ -35,13 +38,10 @@ }, { "__id__": 196 - }, - { - "__id__": 198 } ], "_prefab": { - "__id__": 200 + "__id__": 198 }, "_lpos": { "__type__": "cc.Vec3", @@ -87,18 +87,18 @@ ], "_active": true, "_components": [ + { + "__id__": 15 + }, { "__id__": 17 }, { "__id__": 19 - }, - { - "__id__": 21 } ], "_prefab": { - "__id__": 23 + "__id__": 21 }, "_lpos": { "__type__": "cc.Vec3", @@ -149,18 +149,15 @@ }, { "__id__": 12 - }, - { - "__id__": 14 } ], "_prefab": { - "__id__": 16 + "__id__": 14 }, "_lpos": { "__type__": "cc.Vec3", "x": -195.637, - "y": 44.223, + "y": 50, "z": 0 }, "_lrot": { @@ -421,42 +418,6 @@ "__type__": "cc.CompPrefabInfo", "fileId": "7d5NPWIM1L96hiaEfOEgAk" }, - { - "__type__": "cc.Widget", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 3 - }, - "_enabled": true, - "__prefab": { - "__id__": 15 - }, - "_alignFlags": 1, - "_target": null, - "_left": 0, - "_right": 0, - "_top": -19.223, - "_bottom": 0, - "_horizontalCenter": 0, - "_verticalCenter": 0, - "_isAbsLeft": true, - "_isAbsRight": true, - "_isAbsTop": true, - "_isAbsBottom": true, - "_isAbsHorizontalCenter": true, - "_isAbsVerticalCenter": true, - "_originalWidth": 0, - "_originalHeight": 0, - "_alignMode": 2, - "_lockFlags": 0, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "73eHsPVmxJBYuKtQ/sRQlx" - }, { "__type__": "cc.PrefabInfo", "root": { @@ -480,7 +441,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 18 + "__id__": 16 }, "_contentSize": { "__type__": "cc.Size", @@ -508,7 +469,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 20 + "__id__": 18 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -556,7 +517,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 22 + "__id__": 20 }, "_alignFlags": 18, "_target": null, @@ -605,35 +566,35 @@ }, "_children": [ { - "__id__": 25 + "__id__": 23 }, { - "__id__": 57 + "__id__": 55 }, { - "__id__": 89 + "__id__": 87 }, { - "__id__": 121 + "__id__": 119 }, { - "__id__": 153 + "__id__": 151 } ], "_active": true, "_components": [ + { + "__id__": 183 + }, { "__id__": 185 }, { "__id__": 187 - }, - { - "__id__": 189 } ], "_prefab": { - "__id__": 191 + "__id__": 189 }, "_lpos": { "__type__": "cc.Vec3", @@ -670,33 +631,33 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 24 + "__id__": 22 }, "_children": [ { - "__id__": 26 + "__id__": 24 }, { - "__id__": 32 + "__id__": 30 }, { - "__id__": 38 + "__id__": 36 }, { - "__id__": 44 + "__id__": 42 } ], "_active": true, "_components": [ { - "__id__": 52 + "__id__": 50 }, { - "__id__": 54 + "__id__": 52 } ], "_prefab": { - "__id__": 56 + "__id__": 54 }, "_lpos": { "__type__": "cc.Vec3", @@ -733,20 +694,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 25 + "__id__": 23 }, "_children": [], "_active": true, "_components": [ { - "__id__": 27 + "__id__": 25 }, { - "__id__": 29 + "__id__": 27 } ], "_prefab": { - "__id__": 31 + "__id__": 29 }, "_lpos": { "__type__": "cc.Vec3", @@ -783,11 +744,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 26 + "__id__": 24 }, "_enabled": true, "__prefab": { - "__id__": 28 + "__id__": 26 }, "_contentSize": { "__type__": "cc.Size", @@ -811,11 +772,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 26 + "__id__": 24 }, "_enabled": true, "__prefab": { - "__id__": 30 + "__id__": 28 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -869,20 +830,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 25 + "__id__": 23 }, "_children": [], "_active": true, "_components": [ { - "__id__": 33 + "__id__": 31 }, { - "__id__": 35 + "__id__": 33 } ], "_prefab": { - "__id__": 37 + "__id__": 35 }, "_lpos": { "__type__": "cc.Vec3", @@ -919,11 +880,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 32 + "__id__": 30 }, "_enabled": true, "__prefab": { - "__id__": 34 + "__id__": 32 }, "_contentSize": { "__type__": "cc.Size", @@ -947,11 +908,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 32 + "__id__": 30 }, "_enabled": true, "__prefab": { - "__id__": 36 + "__id__": 34 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -1008,20 +969,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 25 + "__id__": 23 }, "_children": [], "_active": true, "_components": [ { - "__id__": 39 + "__id__": 37 }, { - "__id__": 41 + "__id__": 39 } ], "_prefab": { - "__id__": 43 + "__id__": 41 }, "_lpos": { "__type__": "cc.Vec3", @@ -1058,11 +1019,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 38 + "__id__": 36 }, "_enabled": true, "__prefab": { - "__id__": 40 + "__id__": 38 }, "_contentSize": { "__type__": "cc.Size", @@ -1086,11 +1047,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 38 + "__id__": 36 }, "_enabled": true, "__prefab": { - "__id__": 42 + "__id__": 40 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -1147,23 +1108,23 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 25 + "__id__": 23 }, "_children": [], "_active": true, "_components": [ + { + "__id__": 43 + }, { "__id__": 45 }, { "__id__": 47 - }, - { - "__id__": 49 } ], "_prefab": { - "__id__": 51 + "__id__": 49 }, "_lpos": { "__type__": "cc.Vec3", @@ -1200,11 +1161,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 44 + "__id__": 42 }, "_enabled": true, "__prefab": { - "__id__": 46 + "__id__": 44 }, "_contentSize": { "__type__": "cc.Size", @@ -1228,11 +1189,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 44 + "__id__": 42 }, "_enabled": true, "__prefab": { - "__id__": 48 + "__id__": 46 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -1296,11 +1257,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 44 + "__id__": 42 }, "_enabled": true, "__prefab": { - "__id__": 50 + "__id__": 48 }, "_alignFlags": 40, "_target": null, @@ -1345,11 +1306,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 25 + "__id__": 23 }, "_enabled": true, "__prefab": { - "__id__": 53 + "__id__": 51 }, "_contentSize": { "__type__": "cc.Size", @@ -1373,11 +1334,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 25 + "__id__": 23 }, "_enabled": true, "__prefab": { - "__id__": 55 + "__id__": 53 }, "_alignFlags": 40, "_target": null, @@ -1422,33 +1383,33 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 24 + "__id__": 22 }, "_children": [ { - "__id__": 58 + "__id__": 56 }, { - "__id__": 66 + "__id__": 64 }, { - "__id__": 72 + "__id__": 70 }, { - "__id__": 78 + "__id__": 76 } ], "_active": true, "_components": [ { - "__id__": 84 + "__id__": 82 }, { - "__id__": 86 + "__id__": 84 } ], "_prefab": { - "__id__": 88 + "__id__": 86 }, "_lpos": { "__type__": "cc.Vec3", @@ -1485,23 +1446,23 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 57 + "__id__": 55 }, "_children": [], "_active": true, "_components": [ + { + "__id__": 57 + }, { "__id__": 59 }, { "__id__": 61 - }, - { - "__id__": 63 } ], "_prefab": { - "__id__": 65 + "__id__": 63 }, "_lpos": { "__type__": "cc.Vec3", @@ -1538,11 +1499,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 58 + "__id__": 56 }, "_enabled": true, "__prefab": { - "__id__": 60 + "__id__": 58 }, "_contentSize": { "__type__": "cc.Size", @@ -1566,11 +1527,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 58 + "__id__": 56 }, "_enabled": true, "__prefab": { - "__id__": 62 + "__id__": 60 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -1634,11 +1595,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 58 + "__id__": 56 }, "_enabled": true, "__prefab": { - "__id__": 64 + "__id__": 62 }, "_alignFlags": 40, "_target": null, @@ -1683,20 +1644,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 57 + "__id__": 55 }, "_children": [], "_active": true, "_components": [ { - "__id__": 67 + "__id__": 65 }, { - "__id__": 69 + "__id__": 67 } ], "_prefab": { - "__id__": 71 + "__id__": 69 }, "_lpos": { "__type__": "cc.Vec3", @@ -1733,11 +1694,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 66 + "__id__": 64 }, "_enabled": true, "__prefab": { - "__id__": 68 + "__id__": 66 }, "_contentSize": { "__type__": "cc.Size", @@ -1761,11 +1722,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 66 + "__id__": 64 }, "_enabled": true, "__prefab": { - "__id__": 70 + "__id__": 68 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -1819,20 +1780,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 57 + "__id__": 55 }, "_children": [], "_active": true, "_components": [ { - "__id__": 73 + "__id__": 71 }, { - "__id__": 75 + "__id__": 73 } ], "_prefab": { - "__id__": 77 + "__id__": 75 }, "_lpos": { "__type__": "cc.Vec3", @@ -1869,11 +1830,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 72 + "__id__": 70 }, "_enabled": true, "__prefab": { - "__id__": 74 + "__id__": 72 }, "_contentSize": { "__type__": "cc.Size", @@ -1897,11 +1858,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 72 + "__id__": 70 }, "_enabled": true, "__prefab": { - "__id__": 76 + "__id__": 74 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -1958,20 +1919,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 57 + "__id__": 55 }, "_children": [], "_active": true, "_components": [ { - "__id__": 79 + "__id__": 77 }, { - "__id__": 81 + "__id__": 79 } ], "_prefab": { - "__id__": 83 + "__id__": 81 }, "_lpos": { "__type__": "cc.Vec3", @@ -2008,11 +1969,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 78 + "__id__": 76 }, "_enabled": true, "__prefab": { - "__id__": 80 + "__id__": 78 }, "_contentSize": { "__type__": "cc.Size", @@ -2036,11 +1997,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 78 + "__id__": 76 }, "_enabled": true, "__prefab": { - "__id__": 82 + "__id__": 80 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -2097,11 +2058,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 57 + "__id__": 55 }, "_enabled": true, "__prefab": { - "__id__": 85 + "__id__": 83 }, "_contentSize": { "__type__": "cc.Size", @@ -2125,11 +2086,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 57 + "__id__": 55 }, "_enabled": true, "__prefab": { - "__id__": 87 + "__id__": 85 }, "_alignFlags": 40, "_target": null, @@ -2174,33 +2135,33 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 24 + "__id__": 22 }, "_children": [ { - "__id__": 90 + "__id__": 88 }, { - "__id__": 98 + "__id__": 96 }, { - "__id__": 104 + "__id__": 102 }, { - "__id__": 110 + "__id__": 108 } ], "_active": false, "_components": [ { - "__id__": 116 + "__id__": 114 }, { - "__id__": 118 + "__id__": 116 } ], "_prefab": { - "__id__": 120 + "__id__": 118 }, "_lpos": { "__type__": "cc.Vec3", @@ -2237,23 +2198,23 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 89 + "__id__": 87 }, "_children": [], "_active": false, "_components": [ + { + "__id__": 89 + }, { "__id__": 91 }, { "__id__": 93 - }, - { - "__id__": 95 } ], "_prefab": { - "__id__": 97 + "__id__": 95 }, "_lpos": { "__type__": "cc.Vec3", @@ -2290,11 +2251,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 90 + "__id__": 88 }, "_enabled": true, "__prefab": { - "__id__": 92 + "__id__": 90 }, "_contentSize": { "__type__": "cc.Size", @@ -2318,11 +2279,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 90 + "__id__": 88 }, "_enabled": true, "__prefab": { - "__id__": 94 + "__id__": 92 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -2386,11 +2347,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 90 + "__id__": 88 }, "_enabled": true, "__prefab": { - "__id__": 96 + "__id__": 94 }, "_alignFlags": 40, "_target": null, @@ -2435,20 +2396,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 89 + "__id__": 87 }, "_children": [], "_active": false, "_components": [ { - "__id__": 99 + "__id__": 97 }, { - "__id__": 101 + "__id__": 99 } ], "_prefab": { - "__id__": 103 + "__id__": 101 }, "_lpos": { "__type__": "cc.Vec3", @@ -2485,11 +2446,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 98 + "__id__": 96 }, "_enabled": true, "__prefab": { - "__id__": 100 + "__id__": 98 }, "_contentSize": { "__type__": "cc.Size", @@ -2513,11 +2474,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 98 + "__id__": 96 }, "_enabled": true, "__prefab": { - "__id__": 102 + "__id__": 100 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -2571,20 +2532,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 89 + "__id__": 87 }, "_children": [], "_active": false, "_components": [ { - "__id__": 105 + "__id__": 103 }, { - "__id__": 107 + "__id__": 105 } ], "_prefab": { - "__id__": 109 + "__id__": 107 }, "_lpos": { "__type__": "cc.Vec3", @@ -2621,11 +2582,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 104 + "__id__": 102 }, "_enabled": true, "__prefab": { - "__id__": 106 + "__id__": 104 }, "_contentSize": { "__type__": "cc.Size", @@ -2649,11 +2610,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 104 + "__id__": 102 }, "_enabled": true, "__prefab": { - "__id__": 108 + "__id__": 106 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -2710,20 +2671,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 89 + "__id__": 87 }, "_children": [], "_active": false, "_components": [ { - "__id__": 111 + "__id__": 109 }, { - "__id__": 113 + "__id__": 111 } ], "_prefab": { - "__id__": 115 + "__id__": 113 }, "_lpos": { "__type__": "cc.Vec3", @@ -2760,11 +2721,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 110 + "__id__": 108 }, "_enabled": true, "__prefab": { - "__id__": 112 + "__id__": 110 }, "_contentSize": { "__type__": "cc.Size", @@ -2788,11 +2749,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 110 + "__id__": 108 }, "_enabled": true, "__prefab": { - "__id__": 114 + "__id__": 112 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -2849,11 +2810,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 89 + "__id__": 87 }, "_enabled": true, "__prefab": { - "__id__": 117 + "__id__": 115 }, "_contentSize": { "__type__": "cc.Size", @@ -2877,11 +2838,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 89 + "__id__": 87 }, "_enabled": true, "__prefab": { - "__id__": 119 + "__id__": 117 }, "_alignFlags": 40, "_target": null, @@ -2926,33 +2887,33 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 24 + "__id__": 22 }, "_children": [ { - "__id__": 122 + "__id__": 120 }, { - "__id__": 130 + "__id__": 128 }, { - "__id__": 136 + "__id__": 134 }, { - "__id__": 142 + "__id__": 140 } ], "_active": false, "_components": [ { - "__id__": 148 + "__id__": 146 }, { - "__id__": 150 + "__id__": 148 } ], "_prefab": { - "__id__": 152 + "__id__": 150 }, "_lpos": { "__type__": "cc.Vec3", @@ -2989,23 +2950,23 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 121 + "__id__": 119 }, "_children": [], "_active": false, "_components": [ + { + "__id__": 121 + }, { "__id__": 123 }, { "__id__": 125 - }, - { - "__id__": 127 } ], "_prefab": { - "__id__": 129 + "__id__": 127 }, "_lpos": { "__type__": "cc.Vec3", @@ -3042,11 +3003,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 122 + "__id__": 120 }, "_enabled": true, "__prefab": { - "__id__": 124 + "__id__": 122 }, "_contentSize": { "__type__": "cc.Size", @@ -3070,11 +3031,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 122 + "__id__": 120 }, "_enabled": true, "__prefab": { - "__id__": 126 + "__id__": 124 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -3138,11 +3099,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 122 + "__id__": 120 }, "_enabled": true, "__prefab": { - "__id__": 128 + "__id__": 126 }, "_alignFlags": 40, "_target": null, @@ -3187,20 +3148,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 121 + "__id__": 119 }, "_children": [], "_active": false, "_components": [ { - "__id__": 131 + "__id__": 129 }, { - "__id__": 133 + "__id__": 131 } ], "_prefab": { - "__id__": 135 + "__id__": 133 }, "_lpos": { "__type__": "cc.Vec3", @@ -3237,11 +3198,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 130 + "__id__": 128 }, "_enabled": true, "__prefab": { - "__id__": 132 + "__id__": 130 }, "_contentSize": { "__type__": "cc.Size", @@ -3265,11 +3226,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 130 + "__id__": 128 }, "_enabled": true, "__prefab": { - "__id__": 134 + "__id__": 132 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -3323,20 +3284,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 121 + "__id__": 119 }, "_children": [], "_active": false, "_components": [ { - "__id__": 137 + "__id__": 135 }, { - "__id__": 139 + "__id__": 137 } ], "_prefab": { - "__id__": 141 + "__id__": 139 }, "_lpos": { "__type__": "cc.Vec3", @@ -3373,11 +3334,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 136 + "__id__": 134 }, "_enabled": true, "__prefab": { - "__id__": 138 + "__id__": 136 }, "_contentSize": { "__type__": "cc.Size", @@ -3401,11 +3362,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 136 + "__id__": 134 }, "_enabled": true, "__prefab": { - "__id__": 140 + "__id__": 138 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -3462,20 +3423,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 121 + "__id__": 119 }, "_children": [], "_active": false, "_components": [ { - "__id__": 143 + "__id__": 141 }, { - "__id__": 145 + "__id__": 143 } ], "_prefab": { - "__id__": 147 + "__id__": 145 }, "_lpos": { "__type__": "cc.Vec3", @@ -3512,11 +3473,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 142 + "__id__": 140 }, "_enabled": true, "__prefab": { - "__id__": 144 + "__id__": 142 }, "_contentSize": { "__type__": "cc.Size", @@ -3540,11 +3501,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 142 + "__id__": 140 }, "_enabled": true, "__prefab": { - "__id__": 146 + "__id__": 144 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -3601,11 +3562,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 121 + "__id__": 119 }, "_enabled": true, "__prefab": { - "__id__": 149 + "__id__": 147 }, "_contentSize": { "__type__": "cc.Size", @@ -3629,11 +3590,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 121 + "__id__": 119 }, "_enabled": true, "__prefab": { - "__id__": 151 + "__id__": 149 }, "_alignFlags": 40, "_target": null, @@ -3678,33 +3639,33 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 24 + "__id__": 22 }, "_children": [ { - "__id__": 154 + "__id__": 152 }, { - "__id__": 162 + "__id__": 160 }, { - "__id__": 168 + "__id__": 166 }, { - "__id__": 174 + "__id__": 172 } ], "_active": false, "_components": [ { - "__id__": 180 + "__id__": 178 }, { - "__id__": 182 + "__id__": 180 } ], "_prefab": { - "__id__": 184 + "__id__": 182 }, "_lpos": { "__type__": "cc.Vec3", @@ -3741,23 +3702,23 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 153 + "__id__": 151 }, "_children": [], "_active": true, "_components": [ + { + "__id__": 153 + }, { "__id__": 155 }, { "__id__": 157 - }, - { - "__id__": 159 } ], "_prefab": { - "__id__": 161 + "__id__": 159 }, "_lpos": { "__type__": "cc.Vec3", @@ -3794,11 +3755,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 154 + "__id__": 152 }, "_enabled": true, "__prefab": { - "__id__": 156 + "__id__": 154 }, "_contentSize": { "__type__": "cc.Size", @@ -3822,11 +3783,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 154 + "__id__": 152 }, "_enabled": true, "__prefab": { - "__id__": 158 + "__id__": 156 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -3890,11 +3851,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 154 + "__id__": 152 }, "_enabled": true, "__prefab": { - "__id__": 160 + "__id__": 158 }, "_alignFlags": 40, "_target": null, @@ -3939,20 +3900,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 153 + "__id__": 151 }, "_children": [], "_active": true, "_components": [ { - "__id__": 163 + "__id__": 161 }, { - "__id__": 165 + "__id__": 163 } ], "_prefab": { - "__id__": 167 + "__id__": 165 }, "_lpos": { "__type__": "cc.Vec3", @@ -3989,11 +3950,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 162 + "__id__": 160 }, "_enabled": true, "__prefab": { - "__id__": 164 + "__id__": 162 }, "_contentSize": { "__type__": "cc.Size", @@ -4017,11 +3978,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 162 + "__id__": 160 }, "_enabled": true, "__prefab": { - "__id__": 166 + "__id__": 164 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -4075,20 +4036,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 153 + "__id__": 151 }, "_children": [], "_active": true, "_components": [ { - "__id__": 169 + "__id__": 167 }, { - "__id__": 171 + "__id__": 169 } ], "_prefab": { - "__id__": 173 + "__id__": 171 }, "_lpos": { "__type__": "cc.Vec3", @@ -4125,11 +4086,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 168 + "__id__": 166 }, "_enabled": true, "__prefab": { - "__id__": 170 + "__id__": 168 }, "_contentSize": { "__type__": "cc.Size", @@ -4153,11 +4114,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 168 + "__id__": 166 }, "_enabled": true, "__prefab": { - "__id__": 172 + "__id__": 170 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -4214,20 +4175,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 153 + "__id__": 151 }, "_children": [], "_active": true, "_components": [ { - "__id__": 175 + "__id__": 173 }, { - "__id__": 177 + "__id__": 175 } ], "_prefab": { - "__id__": 179 + "__id__": 177 }, "_lpos": { "__type__": "cc.Vec3", @@ -4264,11 +4225,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 174 + "__id__": 172 }, "_enabled": true, "__prefab": { - "__id__": 176 + "__id__": 174 }, "_contentSize": { "__type__": "cc.Size", @@ -4292,11 +4253,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 174 + "__id__": 172 }, "_enabled": true, "__prefab": { - "__id__": 178 + "__id__": 176 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -4353,11 +4314,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 153 + "__id__": 151 }, "_enabled": true, "__prefab": { - "__id__": 181 + "__id__": 179 }, "_contentSize": { "__type__": "cc.Size", @@ -4381,11 +4342,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 153 + "__id__": 151 }, "_enabled": true, "__prefab": { - "__id__": 183 + "__id__": 181 }, "_alignFlags": 40, "_target": null, @@ -4430,11 +4391,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 24 + "__id__": 22 }, "_enabled": true, "__prefab": { - "__id__": 186 + "__id__": 184 }, "_contentSize": { "__type__": "cc.Size", @@ -4458,11 +4419,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 24 + "__id__": 22 }, "_enabled": true, "__prefab": { - "__id__": 188 + "__id__": 186 }, "_alignFlags": 18, "_target": null, @@ -4494,11 +4455,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 24 + "__id__": 22 }, "_enabled": true, "__prefab": { - "__id__": 190 + "__id__": 188 }, "_resizeMode": 1, "_layoutType": 2, @@ -4549,7 +4510,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 193 + "__id__": 191 }, "_contentSize": { "__type__": "cc.Size", @@ -4577,7 +4538,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 195 + "__id__": 193 }, "_alignFlags": 45, "_target": null, @@ -4613,22 +4574,22 @@ }, "_enabled": true, "__prefab": { - "__id__": 197 + "__id__": 195 }, "Line1": { - "__id__": 25 + "__id__": 23 }, "Line2": { - "__id__": 57 + "__id__": 55 }, "Line3": { - "__id__": 89 + "__id__": 87 }, "Line4": { - "__id__": 121 + "__id__": 119 }, "Line5": { - "__id__": 153 + "__id__": 151 }, "_id": "" }, @@ -4644,9 +4605,9 @@ "node": { "__id__": 1 }, - "_enabled": true, + "_enabled": false, "__prefab": { - "__id__": 199 + "__id__": 197 }, "_id": "" }, diff --git a/assets/script/game/map/IBoxComp.ts b/assets/script/game/map/IBoxComp.ts index 082f0739..abadd86b 100644 --- a/assets/script/game/map/IBoxComp.ts +++ b/assets/script/game/map/IBoxComp.ts @@ -21,6 +21,8 @@ export class IBoxComp extends CCComp { Line5: Node = null! private readonly baseHeight: number = 100; private readonly extraLineHeight: number = 50; + private readonly nameBaseY: number = 50; + private readonly nameExtraLineOffsetY: number = 25; onAdded(args: { heroUuid?: number; @@ -91,6 +93,7 @@ export class IBoxComp extends CCComp { } const targetHeight = this.baseHeight + Math.max(0, showCount - 1) * this.extraLineHeight; this.updateIBoxHeight(targetHeight); + this.updateNamePosition(showCount); } private updateIBoxHeight(height: number) { @@ -111,6 +114,15 @@ export class IBoxComp extends CCComp { } } + private updateNamePosition(showCount: number) { + const bgNode = this.node.getChildByName("Bg"); + const nameNode = bgNode?.getChildByName("name"); + if (!nameNode) return; + const targetY = this.nameBaseY + Math.max(0, showCount - 1) * this.nameExtraLineOffsetY; + const current = nameNode.position; + nameNode.setPosition(current.x, targetY, current.z); + } + private updateLineTypeIcon(line: Node, iType?: IType) { const meleeNode = line.getChildByName("Melee"); const remoteNode = line.getChildByName("remote");