From 336d7d03dbb65b6283d0eb113726973697ec994a Mon Sep 17 00:00:00 2001 From: walkpan Date: Mon, 11 May 2026 16:05:59 +0800 Subject: [PATCH] =?UTF-8?q?perf(=E5=A4=A9=E8=B5=8B=E9=9D=A2=E6=9D=BF):=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=A4=A9=E8=B5=8B=E9=9D=A2=E6=9D=BF=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E6=80=A7=E8=83=BD=EF=BC=8C=E5=87=8F=E5=B0=91=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E8=B5=84=E6=BA=90=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 调整天赋面板预制体的UI布局参数,优化间距、内边距与容器尺寸。将天赋子项的图集加载改为父组件统一预加载并缓存,避免重复加载同一资源。面板添加时先立即刷新UI以保证秒开,后续异步更新所有子项的图标。 --- .../gui/element/prefab_talent_item.prefab | 1695 +---------------- assets/resources/gui/element/talents.prefab | 40 +- assets/script/game/map/TalentItemComp.ts | 36 +- assets/script/game/map/TalentsComp.ts | 15 +- 4 files changed, 130 insertions(+), 1656 deletions(-) diff --git a/assets/resources/gui/element/prefab_talent_item.prefab b/assets/resources/gui/element/prefab_talent_item.prefab index f7001dfc..1898613f 100644 --- a/assets/resources/gui/element/prefab_talent_item.prefab +++ b/assets/resources/gui/element/prefab_talent_item.prefab @@ -37,29 +37,26 @@ "__id__": 113 }, { - "__id__": 183 + "__id__": 119 }, { - "__id__": 189 - }, - { - "__id__": 203 + "__id__": 133 } ], "_active": true, "_components": [ { - "__id__": 217 + "__id__": 147 }, { - "__id__": 219 + "__id__": 149 }, { - "__id__": 221 + "__id__": 151 } ], "_prefab": { - "__id__": 223 + "__id__": 153 }, "_lpos": { "__type__": "cc.Vec3", @@ -214,7 +211,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 170, + "width": 180, "height": 230 }, "_anchorPoint": { @@ -336,7 +333,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 170, + "width": 180, "height": 230 }, "_anchorPoint": { @@ -577,7 +574,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 140, + "width": 150, "height": 140 }, "_anchorPoint": { @@ -974,7 +971,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 140, + "width": 150, "height": 140 }, "_anchorPoint": { @@ -2078,1556 +2075,6 @@ "targetOverrides": null, "nestedPrefabInstanceRoots": null }, - { - "__type__": "cc.Node", - "_name": "pb_level", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 1 - }, - "_children": [ - { - "__id__": 114 - }, - { - "__id__": 122 - }, - { - "__id__": 130 - } - ], - "_active": false, - "_components": [ - { - "__id__": 176 - }, - { - "__id__": 178 - }, - { - "__id__": 180 - } - ], - "_prefab": { - "__id__": 182 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": 0, - "y": 94.3, - "z": 0 - }, - "_lrot": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - }, - "_lscale": { - "__type__": "cc.Vec3", - "x": 1, - "y": 1, - "z": 1 - }, - "_mobility": 0, - "_layer": 1073741824, - "_euler": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_id": "" - }, - { - "__type__": "cc.Node", - "_name": "Slider_Level_02_Bg", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 113 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 115 - }, - { - "__id__": 117 - }, - { - "__id__": 119 - } - ], - "_prefab": { - "__id__": 121 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_lrot": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - }, - "_lscale": { - "__type__": "cc.Vec3", - "x": 1, - "y": 1, - "z": 1 - }, - "_mobility": 0, - "_layer": 1073741824, - "_euler": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_id": "" - }, - { - "__type__": "cc.UITransform", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 114 - }, - "_enabled": true, - "__prefab": { - "__id__": 116 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 100, - "height": 26 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "c8yKdMl11J75MaD4Ka614B" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 114 - }, - "_enabled": true, - "__prefab": { - "__id__": 118 - }, - "_customMaterial": null, - "_srcBlendFactor": 2, - "_dstBlendFactor": 4, - "_color": { - "__type__": "cc.Color", - "r": 138, - "g": 138, - "b": 138, - "a": 255 - }, - "_spriteFrame": { - "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@46c83", - "__expectedType__": "cc.SpriteFrame" - }, - "_type": 0, - "_fillType": 0, - "_sizeMode": 0, - "_fillCenter": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0 - }, - "_fillStart": 0, - "_fillRange": 0, - "_isTrimmedMode": true, - "_useGrayscale": false, - "_atlas": null, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "4drFgd/axJ8bf/cRlVuCa9" - }, - { - "__type__": "cc.Widget", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 114 - }, - "_enabled": true, - "__prefab": { - "__id__": 120 - }, - "_alignFlags": 45, - "_target": null, - "_left": 0, - "_right": 0, - "_top": 2, - "_bottom": 2, - "_horizontalCenter": 0, - "_verticalCenter": 0, - "_isAbsLeft": true, - "_isAbsRight": true, - "_isAbsTop": true, - "_isAbsBottom": true, - "_isAbsHorizontalCenter": true, - "_isAbsVerticalCenter": true, - "_originalWidth": 25, - "_originalHeight": 25, - "_alignMode": 2, - "_lockFlags": 0, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "cbjva3b6hL/77yhWuBHDST" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "a4vV6nwbFD3YKfjuWPCWkH", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.Node", - "_name": "Bar", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 113 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 123 - }, - { - "__id__": 125 - }, - { - "__id__": 127 - } - ], - "_prefab": { - "__id__": 129 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": -50, - "y": 0, - "z": 0 - }, - "_lrot": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - }, - "_lscale": { - "__type__": "cc.Vec3", - "x": 1, - "y": 1, - "z": 1 - }, - "_mobility": 0, - "_layer": 1073741824, - "_euler": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_id": "" - }, - { - "__type__": "cc.UITransform", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 122 - }, - "_enabled": true, - "__prefab": { - "__id__": 124 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 100, - "height": 30 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "98D+2hN8lPsJoIydMyaZVu" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 122 - }, - "_enabled": true, - "__prefab": { - "__id__": 126 - }, - "_customMaterial": null, - "_srcBlendFactor": 2, - "_dstBlendFactor": 4, - "_color": { - "__type__": "cc.Color", - "r": 255, - "g": 255, - "b": 255, - "a": 255 - }, - "_spriteFrame": { - "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@f96ec", - "__expectedType__": "cc.SpriteFrame" - }, - "_type": 1, - "_fillType": 0, - "_sizeMode": 0, - "_fillCenter": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0 - }, - "_fillStart": 0, - "_fillRange": 0, - "_isTrimmedMode": true, - "_useGrayscale": false, - "_atlas": { - "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73", - "__expectedType__": "cc.SpriteAtlas" - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "1dTj8qJSVEhKwRxQIKVTPc" - }, - { - "__type__": "cc.Widget", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 122 - }, - "_enabled": true, - "__prefab": { - "__id__": 128 - }, - "_alignFlags": 5, - "_target": null, - "_left": 0, - "_right": 0, - "_top": 0, - "_bottom": 0, - "_horizontalCenter": 0, - "_verticalCenter": 0, - "_isAbsLeft": true, - "_isAbsRight": true, - "_isAbsTop": true, - "_isAbsBottom": false, - "_isAbsHorizontalCenter": true, - "_isAbsVerticalCenter": true, - "_originalWidth": 100, - "_originalHeight": 80, - "_alignMode": 2, - "_lockFlags": 0, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "bc52Y+ux1EQaSlgboFxwVn" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "daEpuCGJVEvJeTwUAPmf0+", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.Node", - "_name": "Layout", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 113 - }, - "_children": [ - { - "__id__": 131 - }, - { - "__id__": 139 - }, - { - "__id__": 147 - }, - { - "__id__": 155 - }, - { - "__id__": 163 - } - ], - "_active": true, - "_components": [ - { - "__id__": 171 - }, - { - "__id__": 173 - } - ], - "_prefab": { - "__id__": 175 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": -1.413, - "y": 0, - "z": 0 - }, - "_lrot": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - }, - "_lscale": { - "__type__": "cc.Vec3", - "x": 1, - "y": 1, - "z": 1 - }, - "_mobility": 0, - "_layer": 1073741824, - "_euler": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_id": "" - }, - { - "__type__": "cc.Node", - "_name": "Slider_Level_03_InnerBorder1", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 130 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 132 - }, - { - "__id__": 134 - }, - { - "__id__": 136 - } - ], - "_prefab": { - "__id__": 138 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": -38.5, - "y": 0, - "z": 0 - }, - "_lrot": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - }, - "_lscale": { - "__type__": "cc.Vec3", - "x": 1, - "y": 1, - "z": 1 - }, - "_mobility": 0, - "_layer": 1073741824, - "_euler": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_id": "" - }, - { - "__type__": "cc.UITransform", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 131 - }, - "_enabled": true, - "__prefab": { - "__id__": 133 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 23, - "height": 30 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "58kgy83l1JoKys1lz8Yj8J" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 131 - }, - "_enabled": true, - "__prefab": { - "__id__": 135 - }, - "_customMaterial": null, - "_srcBlendFactor": 2, - "_dstBlendFactor": 4, - "_color": { - "__type__": "cc.Color", - "r": 0, - "g": 0, - "b": 0, - "a": 255 - }, - "_spriteFrame": { - "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@95588", - "__expectedType__": "cc.SpriteFrame" - }, - "_type": 1, - "_fillType": 0, - "_sizeMode": 0, - "_fillCenter": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0 - }, - "_fillStart": 0, - "_fillRange": 0, - "_isTrimmedMode": true, - "_useGrayscale": false, - "_atlas": null, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "86Ta4+dddFoa9BdUQ9E9SE" - }, - { - "__type__": "cc.Widget", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 131 - }, - "_enabled": false, - "__prefab": { - "__id__": 137 - }, - "_alignFlags": 45, - "_target": null, - "_left": 0, - "_right": 0, - "_top": 5, - "_bottom": 5, - "_horizontalCenter": 0, - "_verticalCenter": 0, - "_isAbsLeft": true, - "_isAbsRight": true, - "_isAbsTop": true, - "_isAbsBottom": true, - "_isAbsHorizontalCenter": true, - "_isAbsVerticalCenter": true, - "_originalWidth": 23, - "_originalHeight": 24, - "_alignMode": 2, - "_lockFlags": 0, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "47bcpWCsVLWppL9i1eY16Q" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "daM2ROowNL2Yelabn8Tzb3", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.Node", - "_name": "Slider_Level_03_InnerBorder2", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 130 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 140 - }, - { - "__id__": 142 - }, - { - "__id__": 144 - } - ], - "_prefab": { - "__id__": 146 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": -18.5, - "y": 0, - "z": 0 - }, - "_lrot": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - }, - "_lscale": { - "__type__": "cc.Vec3", - "x": 1, - "y": 1, - "z": 1 - }, - "_mobility": 0, - "_layer": 1073741824, - "_euler": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_id": "" - }, - { - "__type__": "cc.UITransform", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 139 - }, - "_enabled": true, - "__prefab": { - "__id__": 141 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 23, - "height": 30 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "5akJ4b+udFXJv9Q/p6iH6p" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 139 - }, - "_enabled": true, - "__prefab": { - "__id__": 143 - }, - "_customMaterial": null, - "_srcBlendFactor": 2, - "_dstBlendFactor": 4, - "_color": { - "__type__": "cc.Color", - "r": 0, - "g": 0, - "b": 0, - "a": 255 - }, - "_spriteFrame": { - "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@95588", - "__expectedType__": "cc.SpriteFrame" - }, - "_type": 1, - "_fillType": 0, - "_sizeMode": 0, - "_fillCenter": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0 - }, - "_fillStart": 0, - "_fillRange": 0, - "_isTrimmedMode": true, - "_useGrayscale": false, - "_atlas": null, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "04Hdz4a9pN65SEP2WHh8QO" - }, - { - "__type__": "cc.Widget", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 139 - }, - "_enabled": false, - "__prefab": { - "__id__": 145 - }, - "_alignFlags": 45, - "_target": null, - "_left": 0, - "_right": 0, - "_top": 5, - "_bottom": 5, - "_horizontalCenter": 0, - "_verticalCenter": 0, - "_isAbsLeft": true, - "_isAbsRight": true, - "_isAbsTop": true, - "_isAbsBottom": true, - "_isAbsHorizontalCenter": true, - "_isAbsVerticalCenter": true, - "_originalWidth": 23, - "_originalHeight": 24, - "_alignMode": 2, - "_lockFlags": 0, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "2clB8lZsVHhInWsLCPTODx" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "b46kyaTPVEAYla7r04cJGe", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.Node", - "_name": "Slider_Level_03_InnerBorder3", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 130 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 148 - }, - { - "__id__": 150 - }, - { - "__id__": 152 - } - ], - "_prefab": { - "__id__": 154 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": 1.5, - "y": 0, - "z": 0 - }, - "_lrot": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - }, - "_lscale": { - "__type__": "cc.Vec3", - "x": 1, - "y": 1, - "z": 1 - }, - "_mobility": 0, - "_layer": 1073741824, - "_euler": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_id": "" - }, - { - "__type__": "cc.UITransform", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 147 - }, - "_enabled": true, - "__prefab": { - "__id__": 149 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 23, - "height": 30 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "8bkInkhuxLbavG80+cyUQv" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 147 - }, - "_enabled": true, - "__prefab": { - "__id__": 151 - }, - "_customMaterial": null, - "_srcBlendFactor": 2, - "_dstBlendFactor": 4, - "_color": { - "__type__": "cc.Color", - "r": 0, - "g": 0, - "b": 0, - "a": 255 - }, - "_spriteFrame": { - "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@95588", - "__expectedType__": "cc.SpriteFrame" - }, - "_type": 1, - "_fillType": 0, - "_sizeMode": 0, - "_fillCenter": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0 - }, - "_fillStart": 0, - "_fillRange": 0, - "_isTrimmedMode": true, - "_useGrayscale": false, - "_atlas": null, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "28/lvaczVOB4H3VURLyQm9" - }, - { - "__type__": "cc.Widget", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 147 - }, - "_enabled": false, - "__prefab": { - "__id__": 153 - }, - "_alignFlags": 45, - "_target": null, - "_left": 0, - "_right": 0, - "_top": 5, - "_bottom": 5, - "_horizontalCenter": 0, - "_verticalCenter": 0, - "_isAbsLeft": true, - "_isAbsRight": true, - "_isAbsTop": true, - "_isAbsBottom": true, - "_isAbsHorizontalCenter": true, - "_isAbsVerticalCenter": true, - "_originalWidth": 23, - "_originalHeight": 24, - "_alignMode": 2, - "_lockFlags": 0, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "bc8fP/nLlJ5ZM0z/ElvJQ1" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "adj245AONCbpPSCHSHN7Md", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.Node", - "_name": "Slider_Level_03_InnerBorder4", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 130 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 156 - }, - { - "__id__": 158 - }, - { - "__id__": 160 - } - ], - "_prefab": { - "__id__": 162 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": 21.5, - "y": 0, - "z": 0 - }, - "_lrot": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - }, - "_lscale": { - "__type__": "cc.Vec3", - "x": 1, - "y": 1, - "z": 1 - }, - "_mobility": 0, - "_layer": 1073741824, - "_euler": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_id": "" - }, - { - "__type__": "cc.UITransform", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 155 - }, - "_enabled": true, - "__prefab": { - "__id__": 157 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 23, - "height": 30 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "d8L9fbY0JJlIe3pLeaLV9U" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 155 - }, - "_enabled": true, - "__prefab": { - "__id__": 159 - }, - "_customMaterial": null, - "_srcBlendFactor": 2, - "_dstBlendFactor": 4, - "_color": { - "__type__": "cc.Color", - "r": 0, - "g": 0, - "b": 0, - "a": 255 - }, - "_spriteFrame": { - "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@95588", - "__expectedType__": "cc.SpriteFrame" - }, - "_type": 1, - "_fillType": 0, - "_sizeMode": 0, - "_fillCenter": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0 - }, - "_fillStart": 0, - "_fillRange": 0, - "_isTrimmedMode": true, - "_useGrayscale": false, - "_atlas": null, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "e8dlO8UtxE/7pE2pkjiezQ" - }, - { - "__type__": "cc.Widget", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 155 - }, - "_enabled": false, - "__prefab": { - "__id__": 161 - }, - "_alignFlags": 45, - "_target": null, - "_left": 0, - "_right": 0, - "_top": 5, - "_bottom": 5, - "_horizontalCenter": 0, - "_verticalCenter": 0, - "_isAbsLeft": true, - "_isAbsRight": true, - "_isAbsTop": true, - "_isAbsBottom": true, - "_isAbsHorizontalCenter": true, - "_isAbsVerticalCenter": true, - "_originalWidth": 23, - "_originalHeight": 24, - "_alignMode": 2, - "_lockFlags": 0, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "c415QrUVFFSb2YtG4Qko8f" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "0fm2ed+ZhMhaShgtzyHBOj", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.Node", - "_name": "Slider_Level_03_InnerBorder5", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 130 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 164 - }, - { - "__id__": 166 - }, - { - "__id__": 168 - } - ], - "_prefab": { - "__id__": 170 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": 41.5, - "y": 0, - "z": 0 - }, - "_lrot": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - }, - "_lscale": { - "__type__": "cc.Vec3", - "x": 1, - "y": 1, - "z": 1 - }, - "_mobility": 0, - "_layer": 1073741824, - "_euler": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_id": "" - }, - { - "__type__": "cc.UITransform", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 163 - }, - "_enabled": true, - "__prefab": { - "__id__": 165 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 23, - "height": 30 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "e0e/HGqwlH4p0N53UmZmwV" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 163 - }, - "_enabled": true, - "__prefab": { - "__id__": 167 - }, - "_customMaterial": null, - "_srcBlendFactor": 2, - "_dstBlendFactor": 4, - "_color": { - "__type__": "cc.Color", - "r": 0, - "g": 0, - "b": 0, - "a": 255 - }, - "_spriteFrame": { - "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@95588", - "__expectedType__": "cc.SpriteFrame" - }, - "_type": 1, - "_fillType": 0, - "_sizeMode": 0, - "_fillCenter": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0 - }, - "_fillStart": 0, - "_fillRange": 0, - "_isTrimmedMode": true, - "_useGrayscale": false, - "_atlas": null, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "9fAjfc3BZNaLWBo1CeiUuQ" - }, - { - "__type__": "cc.Widget", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 163 - }, - "_enabled": false, - "__prefab": { - "__id__": 169 - }, - "_alignFlags": 45, - "_target": null, - "_left": 0, - "_right": 0, - "_top": 5, - "_bottom": 5, - "_horizontalCenter": 0, - "_verticalCenter": 0, - "_isAbsLeft": true, - "_isAbsRight": true, - "_isAbsTop": true, - "_isAbsBottom": true, - "_isAbsHorizontalCenter": true, - "_isAbsVerticalCenter": true, - "_originalWidth": 23, - "_originalHeight": 24, - "_alignMode": 2, - "_lockFlags": 0, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "19wGy2zEhEio1SmYEnd5A8" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "a0f6AJ0WFEJITdu5yo1uey", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.UITransform", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 130 - }, - "_enabled": true, - "__prefab": { - "__id__": 172 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 100, - "height": 30 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "70YsdqWJxHWY2KOQiMqTcz" - }, - { - "__type__": "cc.Layout", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 130 - }, - "_enabled": true, - "__prefab": { - "__id__": 174 - }, - "_resizeMode": 0, - "_layoutType": 1, - "_cellSize": { - "__type__": "cc.Size", - "width": 40, - "height": 40 - }, - "_startAxis": 0, - "_paddingLeft": 0, - "_paddingRight": 0, - "_paddingTop": 0, - "_paddingBottom": 0, - "_spacingX": -3, - "_spacingY": 0, - "_verticalDirection": 1, - "_horizontalDirection": 0, - "_constraint": 0, - "_constraintNum": 2, - "_affectedByScale": false, - "_isAlign": false, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "05lbNPjrlKZo0Qp1G7LUTC" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "1cN0e9hbxJcIuWVokxTPom", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.UITransform", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 113 - }, - "_enabled": true, - "__prefab": { - "__id__": 177 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 100, - "height": 30 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "e2MawzpZFPmJDJPY6Ukqvh" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 113 - }, - "_enabled": false, - "__prefab": { - "__id__": 179 - }, - "_customMaterial": null, - "_srcBlendFactor": 2, - "_dstBlendFactor": 4, - "_color": { - "__type__": "cc.Color", - "r": 255, - "g": 255, - "b": 255, - "a": 255 - }, - "_spriteFrame": { - "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@46c83", - "__expectedType__": "cc.SpriteFrame" - }, - "_type": 1, - "_fillType": 0, - "_sizeMode": 0, - "_fillCenter": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0 - }, - "_fillStart": 0, - "_fillRange": 0, - "_isTrimmedMode": true, - "_useGrayscale": false, - "_atlas": { - "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73", - "__expectedType__": "cc.SpriteAtlas" - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "d7YTUArFVNFLk0yn9RKFUs" - }, - { - "__type__": "cc.ProgressBar", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 113 - }, - "_enabled": true, - "__prefab": { - "__id__": 181 - }, - "_barSprite": { - "__id__": 125 - }, - "_mode": 0, - "_totalLength": 100, - "_progress": 1, - "_reverse": false, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "d6xWqOU7hEVY1zPiTNGwnT" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "4aw0JIWyhJvaBKMUiVysD8", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, { "__type__": "cc.Node", "_name": "lbl_level", @@ -3640,14 +2087,14 @@ "_active": true, "_components": [ { - "__id__": 184 + "__id__": 114 }, { - "__id__": 186 + "__id__": 116 } ], "_prefab": { - "__id__": 188 + "__id__": 118 }, "_lpos": { "__type__": "cc.Vec3", @@ -3684,11 +2131,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 183 + "__id__": 113 }, "_enabled": true, "__prefab": { - "__id__": 185 + "__id__": 115 }, "_contentSize": { "__type__": "cc.Size", @@ -3712,11 +2159,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 183 + "__id__": 113 }, "_enabled": true, "__prefab": { - "__id__": 187 + "__id__": 117 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -3797,23 +2244,23 @@ }, "_children": [ { - "__id__": 190 + "__id__": 120 } ], "_active": true, "_components": [ { - "__id__": 196 + "__id__": 126 }, { - "__id__": 198 + "__id__": 128 }, { - "__id__": 200 + "__id__": 130 } ], "_prefab": { - "__id__": 202 + "__id__": 132 }, "_lpos": { "__type__": "cc.Vec3", @@ -3850,20 +2297,20 @@ "_objFlags": 512, "__editorExtras__": {}, "_parent": { - "__id__": 189 + "__id__": 119 }, "_children": [], "_active": false, "_components": [ { - "__id__": 191 + "__id__": 121 }, { - "__id__": 193 + "__id__": 123 } ], "_prefab": { - "__id__": 195 + "__id__": 125 }, "_lpos": { "__type__": "cc.Vec3", @@ -3900,11 +2347,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 190 + "__id__": 120 }, "_enabled": true, "__prefab": { - "__id__": 192 + "__id__": 122 }, "_contentSize": { "__type__": "cc.Size", @@ -3928,11 +2375,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 190 + "__id__": 120 }, "_enabled": true, "__prefab": { - "__id__": 194 + "__id__": 124 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -4009,11 +2456,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 189 + "__id__": 119 }, "_enabled": true, "__prefab": { - "__id__": 197 + "__id__": 127 }, "_contentSize": { "__type__": "cc.Size", @@ -4037,11 +2484,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 189 + "__id__": 119 }, "_enabled": false, "__prefab": { - "__id__": 199 + "__id__": 129 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -4085,11 +2532,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 189 + "__id__": 119 }, "_enabled": true, "__prefab": { - "__id__": 201 + "__id__": 131 }, "clickEvents": [], "_interactable": true, @@ -4141,7 +2588,7 @@ "_duration": 0.1, "_zoomScale": 1.2, "_target": { - "__id__": 189 + "__id__": 119 }, "_id": "" }, @@ -4172,20 +2619,20 @@ }, "_children": [ { - "__id__": 204 + "__id__": 134 } ], "_active": true, "_components": [ { - "__id__": 212 + "__id__": 142 }, { - "__id__": 214 + "__id__": 144 } ], "_prefab": { - "__id__": 216 + "__id__": 146 }, "_lpos": { "__type__": "cc.Vec3", @@ -4222,23 +2669,23 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 203 + "__id__": 133 }, "_children": [], "_active": true, "_components": [ { - "__id__": 205 + "__id__": 135 }, { - "__id__": 207 + "__id__": 137 }, { - "__id__": 209 + "__id__": 139 } ], "_prefab": { - "__id__": 211 + "__id__": 141 }, "_lpos": { "__type__": "cc.Vec3", @@ -4275,11 +2722,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 204 + "__id__": 134 }, "_enabled": true, "__prefab": { - "__id__": 206 + "__id__": 136 }, "_contentSize": { "__type__": "cc.Size", @@ -4303,11 +2750,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 204 + "__id__": 134 }, "_enabled": true, "__prefab": { - "__id__": 208 + "__id__": 138 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -4348,11 +2795,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 204 + "__id__": 134 }, "_enabled": true, "__prefab": { - "__id__": 210 + "__id__": 140 }, "_alignFlags": 8, "_target": null, @@ -4397,11 +2844,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 203 + "__id__": 133 }, "_enabled": true, "__prefab": { - "__id__": 213 + "__id__": 143 }, "_contentSize": { "__type__": "cc.Size", @@ -4425,11 +2872,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 203 + "__id__": 133 }, "_enabled": true, "__prefab": { - "__id__": 215 + "__id__": 145 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -4510,11 +2957,11 @@ }, "_enabled": true, "__prefab": { - "__id__": 218 + "__id__": 148 }, "_contentSize": { "__type__": "cc.Size", - "width": 170, + "width": 180, "height": 230 }, "_anchorPoint": { @@ -4538,7 +2985,7 @@ }, "_enabled": false, "__prefab": { - "__id__": 220 + "__id__": 150 }, "_alignFlags": 40, "_target": null, @@ -4574,7 +3021,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 222 + "__id__": 152 }, "lbl_name": { "__id__": 104 @@ -4586,13 +3033,13 @@ "__id__": 110 }, "lbl_level": { - "__id__": 186 + "__id__": 116 }, "lbl_cost": { - "__id__": 214 + "__id__": 144 }, "btn_upgrade": { - "__id__": 200 + "__id__": 130 }, "item_bg": { "__id__": 2 @@ -4618,13 +3065,13 @@ "instance": null, "targetOverrides": [ { - "__id__": 224 + "__id__": 154 }, { - "__id__": 227 + "__id__": 157 }, { - "__id__": 230 + "__id__": 160 } ], "nestedPrefabInstanceRoots": [ @@ -4639,7 +3086,7 @@ "__id__": 46 }, "sourceInfo": { - "__id__": 225 + "__id__": 155 }, "propertyPath": [ "icon_node" @@ -4648,7 +3095,7 @@ "__id__": 46 }, "targetInfo": { - "__id__": 226 + "__id__": 156 } }, { @@ -4669,7 +3116,7 @@ "__id__": 46 }, "sourceInfo": { - "__id__": 228 + "__id__": 158 }, "propertyPath": [ "info_label" @@ -4678,7 +3125,7 @@ "__id__": 46 }, "targetInfo": { - "__id__": 229 + "__id__": 159 } }, { @@ -4704,7 +3151,7 @@ "__id__": 46 }, "targetInfo": { - "__id__": 231 + "__id__": 161 } }, { diff --git a/assets/resources/gui/element/talents.prefab b/assets/resources/gui/element/talents.prefab index 76655d5e..c0ec73f7 100644 --- a/assets/resources/gui/element/talents.prefab +++ b/assets/resources/gui/element/talents.prefab @@ -286,7 +286,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": 666.634, + "y": 706.696, "z": 0 }, "_lrot": { @@ -356,7 +356,7 @@ "_target": null, "_left": 0, "_right": 0, - "_top": -27.134000000000015, + "_top": -67.19600000000003, "_bottom": 0, "_horizontalCenter": 0, "_verticalCenter": 0, @@ -426,7 +426,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": 5, + "y": 15, "z": 0 }, "_lrot": { @@ -844,7 +844,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": -255, + "y": -245, "z": 0 }, "_lrot": { @@ -945,7 +945,7 @@ "_contentSize": { "__type__": "cc.Size", "width": 720, - "height": 990 + "height": 1010 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -1159,12 +1159,12 @@ "height": 40 }, "_startAxis": 0, - "_paddingLeft": 39.9, - "_paddingRight": 40, - "_paddingTop": 50, + "_paddingLeft": 10, + "_paddingRight": 10, + "_paddingTop": 0, "_paddingBottom": 0, - "_spacingX": 30, - "_spacingY": 30, + "_spacingX": 20, + "_spacingY": 20, "_verticalDirection": 1, "_horizontalDirection": 0, "_constraint": 2, @@ -1218,7 +1218,7 @@ "_contentSize": { "__type__": "cc.Size", "width": 720, - "height": 990 + "height": 1010 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -1292,7 +1292,7 @@ "_target": null, "_left": 0, "_right": 0, - "_top": 140, + "_top": 120, "_bottom": 150, "_horizontalCenter": 0, "_verticalCenter": 0, @@ -1371,7 +1371,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": 540, + "y": 632.047, "z": 0 }, "_lrot": { @@ -1542,7 +1542,7 @@ "__id__": 60 }, "_children": [], - "_active": true, + "_active": false, "_components": [ { "__id__": 68 @@ -1701,7 +1701,7 @@ "__id__": 60 }, "_children": [], - "_active": true, + "_active": false, "_components": [ { "__id__": 74 @@ -1870,7 +1870,7 @@ "__id__": 94 } ], - "_active": true, + "_active": false, "_components": [ { "__id__": 102 @@ -2546,7 +2546,7 @@ "__id__": 60 }, "_children": [], - "_active": true, + "_active": false, "_components": [ { "__id__": 110 @@ -2705,7 +2705,7 @@ "__id__": 60 }, "_children": [], - "_active": true, + "_active": false, "_components": [ { "__id__": 116 @@ -2868,7 +2868,7 @@ "__id__": 122 } ], - "_active": true, + "_active": false, "_components": [ { "__id__": 128 @@ -3274,7 +3274,7 @@ "_target": null, "_left": 0, "_right": 0, - "_top": 0, + "_top": -92.04700000000003, "_bottom": 0, "_horizontalCenter": 0, "_verticalCenter": 0, diff --git a/assets/script/game/map/TalentItemComp.ts b/assets/script/game/map/TalentItemComp.ts index d59b570c..f432d3e0 100644 --- a/assets/script/game/map/TalentItemComp.ts +++ b/assets/script/game/map/TalentItemComp.ts @@ -38,9 +38,17 @@ export class TalentItemComp extends CCComp { @property({ type: Node, tooltip: "图标背景" }) icon_bg: Node = null!; - private _talentId: TalentType = TalentType.Attack; + private _talentId: TalentType = TalentType.DeadTrigger; private _onClickCallback: ((talentId: TalentType, currentLevel: number) => void) | null = null; private _currentLevel: number = 0; + + private static _cachedAtlas: SpriteAtlas | null = null; + + public static setAtlas(atlas: SpriteAtlas) { + TalentItemComp._cachedAtlas = atlas; + } + + private _talentInfo: TalentInfo | null = null; protected onLoad(): void { if (this.btn_upgrade && this.btn_upgrade.node) { @@ -55,6 +63,7 @@ export class TalentItemComp extends CCComp { * @param onClickCallback 点击升级按钮的回调 */ public updateItem(talentInfo: TalentInfo, currentLevel: number, onClickCallback: (talentId: TalentType, currentLevel: number) => void) { + this._talentInfo = talentInfo; this._talentId = talentInfo.id; this._currentLevel = currentLevel; this._onClickCallback = onClickCallback; @@ -63,16 +72,8 @@ export class TalentItemComp extends CCComp { this.lbl_name.string = talentInfo.name; } - if (this.icon_node && talentInfo.icon) { - resources.load("gui/uicons", SpriteAtlas, (err, atlas) => { - if (err || !atlas) return; - const frame = atlas.getSpriteFrame(talentInfo.icon!); - if (frame && this.icon_node && this.icon_node.isValid) { - const sprite = this.icon_node.getComponent(Sprite) || this.icon_node.addComponent(Sprite); - sprite.spriteFrame = frame; - } - }); - } + // 同步尝试刷新一次图标(如果图集已经缓存过,比如重新打开界面时) + this.refreshIcon(); if (this.lbl_desc) { let currentVal = currentLevel === 0 ? 0 : talentInfo.values[currentLevel - 1]; @@ -96,6 +97,19 @@ export class TalentItemComp extends CCComp { } } + /** 单独更新图标,供父节点加载完图集后回调 */ + public refreshIcon() { + if (!this._talentInfo || !this.icon_node || !this._talentInfo.icon) return; + + if (TalentItemComp._cachedAtlas) { + const frame = TalentItemComp._cachedAtlas.getSpriteFrame(this._talentInfo.icon); + if (frame && this.icon_node.isValid) { + const sprite = this.icon_node.getComponent(Sprite) || this.icon_node.addComponent(Sprite); + sprite.spriteFrame = frame; + } + } + } + private onUpgradeClicked() { if (this._onClickCallback) { this._onClickCallback(this._talentId, this._currentLevel); diff --git a/assets/script/game/map/TalentsComp.ts b/assets/script/game/map/TalentsComp.ts index f42dfd11..ee255808 100644 --- a/assets/script/game/map/TalentsComp.ts +++ b/assets/script/game/map/TalentsComp.ts @@ -18,7 +18,7 @@ * - ScoreWeights(ScoreSet)—— 得分权重配置 * - GameEvent.MissionEnd / MissionStart —— 游戏生命周期事件 */ -import { _decorator, Node, Label, Button, ProgressBar, instantiate, Prefab } from "cc"; +import { _decorator, Node, Label, Button, ProgressBar, instantiate, Prefab, resources, SpriteAtlas } 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 { mLogger } from "../common/Logger"; @@ -88,7 +88,20 @@ export class TalentsComp extends CCComp { } onAdded(args: any) { + // 先立刻刷新界面结构,保证面板秒开 this.refreshUI(); + + // 异步预加载图集,不阻塞主界面的生成 + resources.load("gui/uicons", SpriteAtlas, (err, atlas) => { + if (!err && atlas) { + TalentItemComp.setAtlas(atlas); + // 图集加载完毕后,让所有的子组件只刷新一下自己的图标 + this.talents_content.children.forEach(child => { + let comp = child.getComponent(TalentItemComp); + if (comp) comp.refreshIcon(); + }); + } + }); } /** 刷新整体界面 */