From 45e3e8712be6f46fd0b7f01cb501d1a94232c95f Mon Sep 17 00:00:00 2001 From: panFD Date: Sat, 19 Sep 2026 22:19:12 +0800 Subject: [PATCH] =?UTF-8?q?feat(ui):=20=E6=96=B0=E5=A2=9E=E5=A4=A9?= =?UTF-8?q?=E8=B5=8B=E8=AF=A6=E6=83=85=E5=BC=B9=E7=AA=97=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 重构天赋加点逻辑:将卡片点击校验与加点弹窗逻辑内聚到TIBoxComp中,TalentsComp仅负责打开弹窗。新增天赋详情弹窗,支持展示天赋信息、前置条件校验,并根据玩家状态动态控制加点按钮显隐。 --- assets/resources/gui/element/TIBox.prefab | 1478 ++--------------- .../script/game/common/config/GameUIConfig.ts | 3 + assets/script/game/map/TIBoxComp.ts | 198 +++ assets/script/game/map/TIBoxComp.ts.meta | 9 + assets/script/game/map/TalentsComp.ts | 94 +- 5 files changed, 335 insertions(+), 1447 deletions(-) create mode 100644 assets/script/game/map/TIBoxComp.ts create mode 100644 assets/script/game/map/TIBoxComp.ts.meta diff --git a/assets/resources/gui/element/TIBox.prefab b/assets/resources/gui/element/TIBox.prefab index add63f7e..6230eef9 100644 --- a/assets/resources/gui/element/TIBox.prefab +++ b/assets/resources/gui/element/TIBox.prefab @@ -25,23 +25,26 @@ "__id__": 8 }, { - "__id__": 211 + "__id__": 146 } ], "_active": true, "_components": [ { - "__id__": 245 + "__id__": 180 }, { - "__id__": 247 + "__id__": 182 }, { - "__id__": 249 + "__id__": 184 + }, + { + "__id__": 186 } ], "_prefab": { - "__id__": 251 + "__id__": 188 }, "_lpos": { "__type__": "cc.Vec3", @@ -224,14 +227,14 @@ "_active": true, "_components": [ { - "__id__": 206 + "__id__": 141 }, { - "__id__": 208 + "__id__": 143 } ], "_prefab": { - "__id__": 210 + "__id__": 145 }, "_lpos": { "__type__": "cc.Vec3", @@ -1264,11 +1267,13 @@ "__id__": 0 }, "fileId": "77VtXPhlZEIqYu0yR8I6fF", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { "__type__": "cc.Node", - "_name": "yaoqiu", + "_name": "ptname", "_objFlags": 0, "__editorExtras__": {}, "_parent": { @@ -1421,6 +1426,8 @@ "__id__": 0 }, "fileId": "51uYWMEAVPNKcUziKlSAxT", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -2337,22 +2344,16 @@ }, { "__id__": 132 - }, - { - "__id__": 138 - }, - { - "__id__": 175 } ], "_active": true, "_components": [ { - "__id__": 203 + "__id__": 138 } ], "_prefab": { - "__id__": 205 + "__id__": 140 }, "_lpos": { "__type__": "cc.Vec3", @@ -3135,1309 +3136,18 @@ "targetOverrides": null, "nestedPrefabInstanceRoots": null }, - { - "__type__": "cc.Node", - "_name": "max", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 107 - }, - "_children": [ - { - "__id__": 139 - }, - { - "__id__": 145 - }, - { - "__id__": 166 - } - ], - "_active": false, - "_components": [ - { - "__id__": 172 - } - ], - "_prefab": { - "__id__": 174 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": 0, - "y": -80.146, - "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": "Label_Ribbon_Hologram", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 138 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 140 - }, - { - "__id__": 142 - } - ], - "_prefab": { - "__id__": 144 - }, - "_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": 0.7, - "y": 0.7, - "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__": 107 + }, + "_enabled": true, + "__prefab": { "__id__": 139 }, - "_enabled": true, - "__prefab": { - "__id__": 141 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 100, - "height": 53 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "a8j/26aGNG8pGwj8umOSbR" - }, - { - "__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": 255, - "g": 255, - "b": 255, - "a": 255 - }, - "_spriteFrame": null, - "_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": "89dki217ZO6qBxE9yLFHEt" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "58feByorpEqZTP7LoYFb3l", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.Node", - "_objFlags": 0, - "_parent": { - "__id__": 138 - }, - "_prefab": { - "__id__": 146 - }, - "__editorExtras__": {} - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 145 - }, - "asset": { - "__uuid__": "c85dc4d5-6ebf-4cee-aa3e-6c027334e622", - "__expectedType__": "cc.Prefab" - }, - "fileId": "40LEKxke9Hs6tfg2pVspXT", - "instance": { - "__id__": 147 - }, - "targetOverrides": null - }, - { - "__type__": "cc.PrefabInstance", - "fileId": "ccOMau9MBDSaNHGdL2roXg", - "prefabRootNode": { - "__id__": 1 - }, - "mountedChildren": [], - "mountedComponents": [], - "propertyOverrides": [ - { - "__id__": 148 - }, - { - "__id__": 150 - }, - { - "__id__": 151 - }, - { - "__id__": 152 - }, - { - "__id__": 153 - }, - { - "__id__": 154 - }, - { - "__id__": 156 - }, - { - "__id__": 158 - }, - { - "__id__": 160 - }, - { - "__id__": 162 - }, - { - "__id__": 164 - } - ], - "removedComponents": [] - }, - { - "__type__": "CCPropertyOverrideInfo", - "targetInfo": { - "__id__": 149 - }, - "propertyPath": [ - "_name" - ], - "value": "Lable" - }, - { - "__type__": "cc.TargetInfo", - "localID": [ - "40LEKxke9Hs6tfg2pVspXT" - ] - }, - { - "__type__": "CCPropertyOverrideInfo", - "targetInfo": { - "__id__": 149 - }, - "propertyPath": [ - "_lpos" - ], - "value": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - } - }, - { - "__type__": "CCPropertyOverrideInfo", - "targetInfo": { - "__id__": 149 - }, - "propertyPath": [ - "_lrot" - ], - "value": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - } - }, - { - "__type__": "CCPropertyOverrideInfo", - "targetInfo": { - "__id__": 149 - }, - "propertyPath": [ - "_euler" - ], - "value": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - } - }, - { - "__type__": "CCPropertyOverrideInfo", - "targetInfo": { - "__id__": 149 - }, - "propertyPath": [ - "_lscale" - ], - "value": { - "__type__": "cc.Vec3", - "x": 0.7, - "y": 0.7, - "z": 1 - } - }, - { - "__type__": "CCPropertyOverrideInfo", - "targetInfo": { - "__id__": 155 - }, - "propertyPath": [ - "_contentSize" - ], - "value": { - "__type__": "cc.Size", - "width": 140, - "height": 100 - } - }, - { - "__type__": "cc.TargetInfo", - "localID": [ - "32q1bLzYBFr5SK8ZtIeSWI" - ] - }, - { - "__type__": "CCPropertyOverrideInfo", - "targetInfo": { - "__id__": 157 - }, - "propertyPath": [ - "_contentSize" - ], - "value": { - "__type__": "cc.Size", - "width": 140, - "height": 54 - } - }, - { - "__type__": "cc.TargetInfo", - "localID": [ - "06bJQzIv9Dd4vvjRlqtfn3" - ] - }, - { - "__type__": "CCPropertyOverrideInfo", - "targetInfo": { - "__id__": 159 - }, - "propertyPath": [ - "_contentSize" - ], - "value": { - "__type__": "cc.Size", - "width": 140, - "height": 45 - } - }, - { - "__type__": "cc.TargetInfo", - "localID": [ - "8d3sM/DlJKPpJHNKbTBwEP" - ] - }, - { - "__type__": "CCPropertyOverrideInfo", - "targetInfo": { - "__id__": 161 - }, - "propertyPath": [ - "_contentSize" - ], - "value": { - "__type__": "cc.Size", - "width": 132, - "height": 44 - } - }, - { - "__type__": "cc.TargetInfo", - "localID": [ - "17CdGbg9BG87rd0n06WZvm" - ] - }, - { - "__type__": "CCPropertyOverrideInfo", - "targetInfo": { - "__id__": 163 - }, - "propertyPath": [ - "_color" - ], - "value": { - "__type__": "cc.Color", - "r": 231, - "g": 231, - "b": 69, - "a": 255 - } - }, - { - "__type__": "cc.TargetInfo", - "localID": [ - "4ckA8btpNNTrqJr6S7VGRN" - ] - }, - { - "__type__": "CCPropertyOverrideInfo", - "targetInfo": { - "__id__": 165 - }, - "propertyPath": [ - "_color" - ], - "value": { - "__type__": "cc.Color", - "r": 213, - "g": 186, - "b": 50, - "a": 255 - } - }, - { - "__type__": "cc.TargetInfo", - "localID": [ - "b1UpBBMc9Obp5MBENsf/W/" - ] - }, - { - "__type__": "cc.Node", - "_name": "Label", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 138 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 167 - }, - { - "__id__": 169 - } - ], - "_prefab": { - "__id__": 171 - }, - "_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__": 166 - }, - "_enabled": true, - "__prefab": { - "__id__": 168 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 59.55419921875, - "height": 54.4 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "b6Avl7zHVFRJruMFqa+196" - }, - { - "__type__": "cc.Label", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 166 - }, - "_enabled": true, - "__prefab": { - "__id__": 170 - }, - "_customMaterial": null, - "_srcBlendFactor": 2, - "_dstBlendFactor": 4, - "_color": { - "__type__": "cc.Color", - "r": 255, - "g": 255, - "b": 255, - "a": 255 - }, - "_string": "MAX", - "_horizontalAlign": 1, - "_verticalAlign": 1, - "_actualFontSize": 25, - "_fontSize": 25, - "_fontFamily": "Arial", - "_lineHeight": 40, - "_overflow": 0, - "_enableWrapText": true, - "_font": null, - "_isSystemFontUsed": true, - "_spacingX": 0, - "_isItalic": false, - "_isBold": true, - "_isUnderline": false, - "_underlineHeight": 2, - "_cacheMode": 0, - "_enableOutline": true, - "_outlineColor": { - "__type__": "cc.Color", - "r": 0, - "g": 0, - "b": 0, - "a": 255 - }, - "_outlineWidth": 2, - "_enableShadow": false, - "_shadowColor": { - "__type__": "cc.Color", - "r": 0, - "g": 0, - "b": 0, - "a": 255 - }, - "_shadowOffset": { - "__type__": "cc.Vec2", - "x": 2, - "y": 2 - }, - "_shadowBlur": 2, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "02++xUMdBDbqVOezTyJFBw" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "4b+TFttZdDxrY05VIj+0a8", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.UITransform", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 138 - }, - "_enabled": true, - "__prefab": { - "__id__": 173 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 100, - "height": 100 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "9eQwy3aIBI6o4vlzpSjoGn" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "d9UW0M93VEHKr6ix+utSGW", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.Node", - "_name": "noactive-001", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 107 - }, - "_children": [ - { - "__id__": 176 - }, - { - "__id__": 184 - }, - { - "__id__": 190 - } - ], - "_active": false, - "_components": [ - { - "__id__": 198 - }, - { - "__id__": 200 - } - ], - "_prefab": { - "__id__": 202 - }, - "_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.Node", - "_name": "blue", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 175 - }, - "_children": [], - "_active": false, - "_components": [ - { - "__id__": 177 - }, - { - "__id__": 179 - }, - { - "__id__": 181 - } - ], - "_prefab": { - "__id__": 183 - }, - "_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__": 176 - }, - "_enabled": true, - "__prefab": { - "__id__": 178 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 200, - "height": 230 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "9eMUhwRIxPMInwDNU5hkDy" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 176 - }, - "_enabled": true, - "__prefab": { - "__id__": 180 - }, - "_customMaterial": null, - "_srcBlendFactor": 2, - "_dstBlendFactor": 4, - "_color": { - "__type__": "cc.Color", - "r": 255, - "g": 255, - "b": 255, - "a": 192 - }, - "_spriteFrame": { - "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@c7ff0", - "__expectedType__": "cc.SpriteFrame" - }, - "_type": 1, - "_fillType": 0, - "_sizeMode": 0, - "_fillCenter": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0 - }, - "_fillStart": 0, - "_fillRange": 0, - "_isTrimmedMode": true, - "_useGrayscale": true, - "_atlas": null, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "6aEVkyWEZOHo9k5aaIjHjC" - }, - { - "__type__": "cc.Widget", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 176 - }, - "_enabled": false, - "__prefab": { - "__id__": 182 - }, - "_alignFlags": 45, - "_target": null, - "_left": 33, - "_right": 33, - "_top": 96.5, - "_bottom": 96.5, - "_horizontalCenter": 0, - "_verticalCenter": 0, - "_isAbsLeft": true, - "_isAbsRight": true, - "_isAbsTop": true, - "_isAbsBottom": true, - "_isAbsHorizontalCenter": true, - "_isAbsVerticalCenter": true, - "_originalWidth": 154, - "_originalHeight": 77, - "_alignMode": 2, - "_lockFlags": 0, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "ccM9yjRkxF2odFwBp0ntKZ" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "56BK1MWhFEXo0mwX686Jf3", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.Node", - "_name": "Icon_Lock03", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 175 - }, - "_children": [], - "_active": false, - "_components": [ - { - "__id__": 185 - }, - { - "__id__": 187 - } - ], - "_prefab": { - "__id__": 189 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": 0, - "y": -73.713, - "z": 0 - }, - "_lrot": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - }, - "_lscale": { - "__type__": "cc.Vec3", - "x": 0.8, - "y": 0.8, - "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__": 184 - }, - "_enabled": true, - "__prefab": { - "__id__": 186 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 71, - "height": 93 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "b3A/1WGkZLB4OiT6FzahpY" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 184 - }, - "_enabled": true, - "__prefab": { - "__id__": 188 - }, - "_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@cebb2", - "__expectedType__": "cc.SpriteFrame" - }, - "_type": 0, - "_fillType": 0, - "_sizeMode": 1, - "_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": "19PEMfELtEm5A6hHQg0vgY" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "a4DOkSb59ORLdeWDLrtfw0", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.Node", - "_name": "ItemFrame_Square_03_Bg", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 175 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 191 - }, - { - "__id__": 193 - }, - { - "__id__": 195 - } - ], - "_prefab": { - "__id__": 197 - }, - "_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": 0.5, - "y": 0.5, - "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__": 190 - }, - "_enabled": true, - "__prefab": { - "__id__": 192 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 192, - "height": 192 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "a7eyKEy89OOKyPqFiptMtg" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 190 - }, - "_enabled": true, - "__prefab": { - "__id__": 194 - }, - "_customMaterial": null, - "_srcBlendFactor": 2, - "_dstBlendFactor": 4, - "_color": { - "__type__": "cc.Color", - "r": 134, - "g": 134, - "b": 134, - "a": 146 - }, - "_spriteFrame": { - "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@85dcd", - "__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": "3eW96Kok5LW4ujxOlZI+os" - }, - { - "__type__": "cc.Widget", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 190 - }, - "_enabled": true, - "__prefab": { - "__id__": 196 - }, - "_alignFlags": 45, - "_target": null, - "_left": 2, - "_right": 2, - "_top": 2, - "_bottom": 2, - "_horizontalCenter": 0, - "_verticalCenter": 0, - "_isAbsLeft": true, - "_isAbsRight": true, - "_isAbsTop": true, - "_isAbsBottom": true, - "_isAbsHorizontalCenter": true, - "_isAbsVerticalCenter": true, - "_originalWidth": 52, - "_originalHeight": 52, - "_alignMode": 2, - "_lockFlags": 0, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "20dd1yCORCMJ0KK2D/l9dg" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "c1c4zSEldIupAbr2Hzi+UL", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.UITransform", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 175 - }, - "_enabled": true, - "__prefab": { - "__id__": 199 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 100, - "height": 100 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "2b2sjdNuFFz6oG7Os88TnJ" - }, - { - "__type__": "cc.Widget", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 175 - }, - "_enabled": true, - "__prefab": { - "__id__": 201 - }, - "_alignFlags": 45, - "_target": null, - "_left": 0, - "_right": 0, - "_top": 0, - "_bottom": 0, - "_horizontalCenter": 0, - "_verticalCenter": 0, - "_isAbsLeft": true, - "_isAbsRight": true, - "_isAbsTop": true, - "_isAbsBottom": true, - "_isAbsHorizontalCenter": true, - "_isAbsVerticalCenter": true, - "_originalWidth": 100, - "_originalHeight": 100, - "_alignMode": 2, - "_lockFlags": 0, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "f4/WKutVBODLN4ZpQYt0SD" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "383UwfGkZB1LllSIRN58AO", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.UITransform", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 107 - }, - "_enabled": true, - "__prefab": { - "__id__": 204 - }, "_contentSize": { "__type__": "cc.Size", "width": 100, @@ -4477,7 +3187,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 207 + "__id__": 142 }, "_contentSize": { "__type__": "cc.Size", @@ -4505,7 +3215,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 209 + "__id__": 144 }, "_alignFlags": 2, "_target": null, @@ -4551,14 +3261,14 @@ "__id__": 1 }, "_prefab": { - "__id__": 212 + "__id__": 147 }, "__editorExtras__": {} }, { "__type__": "cc.PrefabInfo", "root": { - "__id__": 211 + "__id__": 146 }, "asset": { "__uuid__": "506d0f89-1cf1-4c3b-be47-a3abaf3695e8", @@ -4566,7 +3276,7 @@ }, "fileId": "60RuUkpjBAGoLk3z4xlHcF", "instance": { - "__id__": 213 + "__id__": 148 }, "targetOverrides": null }, @@ -4580,58 +3290,58 @@ "mountedComponents": [], "propertyOverrides": [ { - "__id__": 214 + "__id__": 149 }, { - "__id__": 216 + "__id__": 151 }, { - "__id__": 217 + "__id__": 152 }, { - "__id__": 218 + "__id__": 153 }, { - "__id__": 219 + "__id__": 154 }, { - "__id__": 221 + "__id__": 156 }, { - "__id__": 223 + "__id__": 158 }, { - "__id__": 225 + "__id__": 160 }, { - "__id__": 227 + "__id__": 162 }, { - "__id__": 229 + "__id__": 164 }, { - "__id__": 231 + "__id__": 166 }, { - "__id__": 232 + "__id__": 167 }, { - "__id__": 234 + "__id__": 169 }, { - "__id__": 236 + "__id__": 171 }, { - "__id__": 238 + "__id__": 173 }, { - "__id__": 240 + "__id__": 175 }, { - "__id__": 242 + "__id__": 177 }, { - "__id__": 244 + "__id__": 179 } ], "removedComponents": [] @@ -4639,7 +3349,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 215 + "__id__": 150 }, "propertyPath": [ "_name" @@ -4655,7 +3365,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 215 + "__id__": 150 }, "propertyPath": [ "_lpos" @@ -4670,7 +3380,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 215 + "__id__": 150 }, "propertyPath": [ "_lrot" @@ -4686,7 +3396,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 215 + "__id__": 150 }, "propertyPath": [ "_euler" @@ -4701,7 +3411,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 220 + "__id__": 155 }, "propertyPath": [ "_lscale" @@ -4722,7 +3432,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 222 + "__id__": 157 }, "propertyPath": [ "_contentSize" @@ -4742,7 +3452,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 224 + "__id__": 159 }, "propertyPath": [ "_active" @@ -4758,7 +3468,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 226 + "__id__": 161 }, "propertyPath": [ "_lpos" @@ -4779,7 +3489,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 228 + "__id__": 163 }, "propertyPath": [ "_contentSize" @@ -4799,7 +3509,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 230 + "__id__": 165 }, "propertyPath": [ "_top" @@ -4815,7 +3525,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 230 + "__id__": 165 }, "propertyPath": [ "_bottom" @@ -4825,7 +3535,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 233 + "__id__": 168 }, "propertyPath": [ "_active" @@ -4841,7 +3551,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 235 + "__id__": 170 }, "propertyPath": [ "_lpos" @@ -4862,7 +3572,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 237 + "__id__": 172 }, "propertyPath": [ "_contentSize" @@ -4882,7 +3592,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 239 + "__id__": 174 }, "propertyPath": [ "_string" @@ -4898,7 +3608,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 241 + "__id__": 176 }, "propertyPath": [ "_contentSize" @@ -4918,7 +3628,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 243 + "__id__": 178 }, "propertyPath": [ "_spriteFrame" @@ -4937,7 +3647,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 243 + "__id__": 178 }, "propertyPath": [ "_atlas" @@ -4957,7 +3667,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 246 + "__id__": 181 }, "_contentSize": { "__type__": "cc.Size", @@ -4985,7 +3695,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 248 + "__id__": 183 }, "_id": "" }, @@ -5003,7 +3713,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 250 + "__id__": 185 }, "_alignFlags": 45, "_target": null, @@ -5029,6 +3739,57 @@ "__type__": "cc.CompPrefabInfo", "fileId": "69KEoFCvFPgL/uT5tnmJQV" }, + { + "__type__": "332495BMLFC46Eu9SW1WAw3", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 187 + }, + "icon": { + "__id__": 117 + }, + "lbl_name": { + "__id__": 123 + }, + "lbl_level": { + "__id__": 135 + }, + "lbl_prereq_name": { + "__id__": 65 + }, + "lbl_prereq_lv": { + "__id__": 71 + }, + "node_prereq_check_on": { + "__id__": 86 + }, + "node_prereq_check_off": { + "__id__": 80 + }, + "node_prereq": { + "__id__": 43 + }, + "richtext_info": { + "__id__": 99 + }, + "node_add": { + "__id__": 146 + }, + "node_close": { + "__id__": 2 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "4dvZ9XG0ZHkKCXNlTDGG3M" + }, { "__type__": "cc.PrefabInfo", "root": { @@ -5042,10 +3803,7 @@ "targetOverrides": [], "nestedPrefabInstanceRoots": [ { - "__id__": 211 - }, - { - "__id__": 145 + "__id__": 146 }, { "__id__": 9 diff --git a/assets/script/game/common/config/GameUIConfig.ts b/assets/script/game/common/config/GameUIConfig.ts index d1d3af54..bc5d8360 100644 --- a/assets/script/game/common/config/GameUIConfig.ts +++ b/assets/script/game/common/config/GameUIConfig.ts @@ -27,6 +27,8 @@ export enum UIID { SInfo, /** 英雄详情弹窗(图鉴卡片点击弹出:含属性/技能/升级/前后切换) */ HeroInfo, + /** 天赋详情弹窗(天赋迷你卡点击弹出:图标/等级/前置/条幅说明/加点按钮) */ + TIBox, } /** 打开界面方式的配置数据 */ @@ -44,5 +46,6 @@ export var UIConfigData: { [key: number]: UIConfig } = { [UIID.Mission]: { layer: LayerType.UI, prefab: "gui/element/mission" }, [UIID.SInfo]: { layer: LayerType.PopUp, prefab: "gui/element/SInfoBox" }, [UIID.HeroInfo]: { layer: LayerType.PopUp, prefab: "gui/element/heroInfo", bundle: "resources" }, + [UIID.TIBox]: { layer: LayerType.PopUp, prefab: "gui/element/TIBox", bundle: "resources" }, } \ No newline at end of file diff --git a/assets/script/game/map/TIBoxComp.ts b/assets/script/game/map/TIBoxComp.ts new file mode 100644 index 00000000..8e630977 --- /dev/null +++ b/assets/script/game/map/TIBoxComp.ts @@ -0,0 +1,198 @@ +/** + * @file TIBoxComp.ts + * @description 天赋详情弹窗组件(UI 视图层,TIBox.prefab 载体) + * + * 职责: + * 1. 展示天赋图标 / 名称 / 当前等级 / 条幅说明(getTalentDisplayText)。 + * 2. 展示软前置行:前置天赋名称、需求等级、前置已达成勾图标(达成亮 On,未达成亮 Off)。 + * 3. 加点按钮:仅在可加点(层位已解锁 + 前置满足 + 未满级 + 点数足够)时显示; + * 不满足条件或已满级时隐藏,弹窗仍可正常打开查看。 + * 4. 加点成功后通过 TALENT_UPDATE 事件驱动 TalentsComp 全量刷新,并同步刷新本弹窗。 + * + * 使用(oops.gui 模块): + * oops.gui.open(UIID.TIBox, { uuid: 9001 }); + * + * 依赖: + * - TalentSet(配置与校验:isTalentTierUnlocked/isTalentPrereqMet/getTalentUpgradeCost/getTalentDisplayText) + * - smc —— 天赋等级表 / 点数 / upgradeTalent / 图标图集 + * - outlineRich —— RichText 条幅描边 + */ +import { _decorator, EventTouch, Label, Node, NodeEventType, RichText, Sprite, SpriteFrame } 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 { TalentSet, getTalentDisplayText, getTalentUpgradeCost, isTalentPrereqMet, isTalentTierUnlocked } from "../common/config/TalentSet"; +import { GameEvent } from "../common/config/GameEvent"; +import { HRoleName } from "../common/config/heroSet"; +import { outlineRich } from "../common/RichOutline"; +import { smc } from "../common/SingletonModuleComp"; +import { oops } from "db://oops-framework/core/Oops"; + +const { ccclass, property } = _decorator; + +/** TIBox 弹窗初始化参数 */ +export interface TIBoxParams { + /** 天赋 uuid(TalentSet key) */ + uuid: number; +} + +/** TIBoxComp —— 天赋详情弹窗(任何状态均可点开,不可加点时隐藏加点按钮) */ +@ccclass('TIBoxComp') +@ecs.register('TIBoxComp', false) +export class TIBoxComp extends CCComp { + + @property({ type: Sprite, tooltip: "天赋图标" }) + icon: Sprite = null!; + + @property({ type: Label, tooltip: "天赋名称" }) + lbl_name: Label = null!; + + @property({ type: Label, tooltip: "当前天赋等级(当前/满级)" }) + lbl_level: Label = null!; + + @property({ type: Label, tooltip: "前置天赋名称(无前置时隐藏前置行)" }) + lbl_prereq_name: Label = null!; + + @property({ type: Label, tooltip: "前置天赋需求等级" }) + lbl_prereq_lv: Label = null!; + + @property({ type: Node, tooltip: "前置已达成勾图标(On)" }) + node_prereq_check_on: Node = null!; + + @property({ type: Node, tooltip: "前置未达成勾图标(Off)" }) + node_prereq_check_off: Node = null!; + + @property({ type: Node, tooltip: "前置行容器(无前置天赋时整体隐藏)" }) + node_prereq: Node = null!; + + @property({ type: RichText, tooltip: "条幅说明(当前已生效数值 / 每级引导)" }) + richtext_info: RichText = null!; + + @property({ type: Node, tooltip: "加点按钮(不可加点或满级时隐藏)" }) + node_add: Node = null!; + + @property({ type: Node, tooltip: "关闭遮罩/关闭按钮(点击关闭弹窗)" }) + node_close: Node = null!; + + /** 当前展示的天赋 uuid */ + private talent_uuid: number = 0; + + protected onLoad(): void { + this.node_add?.on(NodeEventType.TOUCH_END, this.onAddTap, this); + this.node_close?.on(NodeEventType.TOUCH_END, this.onCloseTap, this); + } + + protected onDestroy(): void { + this.node_add?.targetOff(this); + this.node_close?.targetOff(this); + oops.message.off(GameEvent.TALENT_UPDATE, this.refresh, this); + } + + /** + * oops.gui 添加到舞台回调(框架约定入口) + * @param params 见 TIBoxParams + */ + onAdded(params: TIBoxParams): void { + this.talent_uuid = params?.uuid ?? 0; + // 加点成功后同步刷新本弹窗(等级/按钮状态),与 TalentsComp 同一事件源 + oops.message.on(GameEvent.TALENT_UPDATE, this.refresh, this); + this.refresh(); + } + + /** 全量刷新弹窗内容 */ + private refresh(): void { + const cfg = TalentSet[this.talent_uuid]; + if (!cfg) return; + const levels = smc.getTalentLevels(); + const lv = levels[this.talent_uuid] ?? 0; + + // 图标:技能图标图集(gui/ui7)优先,资源目录回退(与 TalentItemComp 口径一致) + if (this.icon && cfg.icon) { + let frame: SpriteFrame | null = null; + if (smc.skillIconsAtlas) { + frame = smc.skillIconsAtlas.getSpriteFrame(cfg.icon); + } + if (!frame) { + frame = oops.res.get("game/heros/cards/" + cfg.icon, SpriteFrame) as SpriteFrame; + } + if (frame) this.icon.spriteFrame = frame; + } + + if (this.lbl_name) this.lbl_name.string = cfg.name; + if (this.lbl_level) this.lbl_level.string = `${lv}/${cfg.max_lv}`; + // 条幅说明:已加点显示当前生效数值,未加点显示每级引导 + if (this.richtext_info) this.richtext_info.string = outlineRich(this.buildDetailText(cfg, lv)); + + // 软前置行:无前置整体隐藏;有前置展示名称/需求等级/达成勾 + const hasPrereq = !!(cfg.prereq_uuid && cfg.prereq_lv); + if (this.node_prereq) this.node_prereq.active = hasPrereq; + if (hasPrereq) { + const preCfg = TalentSet[cfg.prereq_uuid!]; + const preMet = isTalentPrereqMet(levels, cfg); + if (this.lbl_prereq_name) this.lbl_prereq_name.string = preCfg ? preCfg.name : `天赋${cfg.prereq_uuid}`; + if (this.lbl_prereq_lv) this.lbl_prereq_lv.string = `${cfg.prereq_lv}`; + if (this.node_prereq_check_on) this.node_prereq_check_on.active = preMet; + if (this.node_prereq_check_off) this.node_prereq_check_off.active = !preMet; + } + + // 加点按钮:层位解锁 + 前置满足 + 未满级 + 点数足够时才显示 + if (this.node_add) this.node_add.active = this.canUpgrade(lv, cfg.tier, levels); + } + + /** + * 构建天赋详情条幅文本:当前生效数值 + 下一级预览 + 满级提示 + * @param cfg 天赋配置 + * @param lv 当前等级 + */ + private buildDetailText(cfg: typeof TalentSet[number], lv: number): string { + const lines: string[] = []; + // 当前已生效数值(Lv0 显示每级引导) + lines.push(getTalentDisplayText(cfg, lv)); + // 未满级:追加下一级预览 + if (lv < cfg.max_lv) { + lines.push(`下一级:${getTalentDisplayText(cfg, lv + 1)}`); + } else { + lines.push(`已满级`); + } + // 职业限定提示 + if (cfg.role !== undefined) { + lines.push(`仅${HRoleName[cfg.role]}生效`); + } + return lines.join("\n"); + } + + /** + * 当前是否可加点(与 smc.upgradeTalent 校验口径一致,仅做 UI 预判定) + * @param lv 当前等级 + * @param tier 所属层位 + * @param levels 天赋等级表 + */ + private canUpgrade(lv: number, tier: number, levels: Record): boolean { + const cfg = TalentSet[this.talent_uuid]; + if (!cfg) return false; + if (lv >= cfg.max_lv) return false; + if (!isTalentTierUnlocked(levels, tier)) return false; + if (!isTalentPrereqMet(levels, cfg)) return false; + return smc.getTalentPoints() >= getTalentUpgradeCost(tier); + } + + /** 加点按钮点击:升级成功后由 TALENT_UPDATE 事件驱动刷新(含本弹窗) */ + private onAddTap(event?: EventTouch): void { + if (event) event.propagationStopped = true; + oops.audio.playEffect("music/button"); + smc.upgradeTalent(this.talent_uuid); + } + + /** 点击关闭 */ + private onCloseTap(event?: EventTouch): void { + if (event) event.propagationStopped = true; + oops.audio.playEffect("music/button"); + oops.gui.removeByNode(this.node); + } + + /** ECS 组件移除时销毁节点(CCComp 抽象方法实现) */ + reset(): void { + if (this.node && this.node.isValid) { + this.node.destroy(); + } + } +} diff --git a/assets/script/game/map/TIBoxComp.ts.meta b/assets/script/game/map/TIBoxComp.ts.meta new file mode 100644 index 00000000..8534bdbd --- /dev/null +++ b/assets/script/game/map/TIBoxComp.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "33249e41-30b1-42e3-a12e-f525b5580c37", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/script/game/map/TalentsComp.ts b/assets/script/game/map/TalentsComp.ts index f491f3de..1ff85890 100644 --- a/assets/script/game/map/TalentsComp.ts +++ b/assets/script/game/map/TalentsComp.ts @@ -5,41 +5,30 @@ * 职责: * 1. 页头展示:可用天赋点 / 天赋等级(Lv.x)/ 当前等级经验进度。 * 2. 收集子树内全部 TalentItemComp(编辑器静态摆放),TALENT_UPDATE 事件驱动全量刷新。 - * 3. 卡片点击统一校验(层位解锁 → 软前置 → 满级 → 点数),不满足走 smalltip 气泡; - * 满足则弹出 CommonPrompt 确认加点(smc.upgradeTalent)。 + * 3. 卡片点击统一打开 TIBox 天赋详情弹窗;加点校验(层位/前置/满级/点数)由 TIBoxComp 内聚, + * 不满足条件时弹窗隐藏加点按钮,仅作详情查看。 * 4. 看广告重置入口:CommonPrompt 二次确认后调 smc.resetTalents() 退还全部点数。 * * 依赖: - * - TalentSet(TalentTier/isTalentTierUnlocked/isTalentPrereqMet/getTalentTierInvestedPoints)—— 配置与层位校验 + * - TalentSet(getTalentTierInvestedPoints/getTalentLevelExp)—— 配置与统计 * - TalentItemComp —— 单张迷你升级卡(编辑器静态摆放,按 uuid 自驱动渲染) + * - TIBoxComp —— 天赋详情弹窗(UIID.TIBox) * - smc —— 天赋等级表/点数/升级/重置 */ import { _decorator, Label, Node, NodeEventType, ProgressBar } 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 { - TalentSet, - TALENT_TIER_UNLOCK_THRESHOLD, - getTalentDisplayText, getTalentLevelExp, getTalentTierInvestedPoints, getTalentUpgradeCost, - isTalentPrereqMet, isTalentTierUnlocked, + getTalentLevelExp, getTalentTierInvestedPoints, } from "../common/config/TalentSet"; import { GameEvent } from "../common/config/GameEvent"; import { UIID } from "../common/config/GameUIConfig"; -import { SmallTipComp } from "./SmallTipComp"; import { TalentItemComp } from "./TalentItemComp"; import { smc } from "../common/SingletonModuleComp"; import { oops } from "db://oops-framework/core/Oops"; const { ccclass, property } = _decorator; -/** 层位序号展示文案(提示文案用) */ -const TIER_NAMES: Record = { - 1: "第 1 层", 2: "第 2 层", 3: "第 3 层", 4: "第 4 层", 5: "第 5 层", -}; - -/** 页签/卡片上的 smalltip 气泡节点名 */ -const SMALL_TIP_CHILD = "smalltip"; - /** TalentsComp —— 天赋加点页组件(最小容器:页头 + 编辑器静态卡片收集) */ @ccclass('TalentsComp') @ecs.register('Talents', false) @@ -123,80 +112,11 @@ export class TalentsComp extends CCComp { } /** - * 获取挂载点下的 smalltip 气泡组件(节点缺失或组件未挂时返回 null 并静默跳过提示) - * @param parent 气泡挂载的父节点 - */ - private getSmallTip(parent: Node | null): SmallTipComp | null { - const tipNode = parent?.getChildByName(SMALL_TIP_CHILD); - return tipNode ? (tipNode.getComponent(SmallTipComp) ?? tipNode.addComponent(SmallTipComp)) : null; - } - - /** - * 在指定节点下弹出 smalltip 气泡提示 - * @param anchor 气泡挂载的父节点 - * @param text 提示文案 - */ - private showSmallTip(anchor: Node | null, text: string): void { - const tip = this.getSmallTip(anchor); - tip?.show(text); - } - - /** - * 按 uuid 找到对应的天赋卡节点(气泡锚点用) + * 卡片点击统一入口:任何状态均打开 TIBox 天赋详情弹窗,加点按钮显隐由 TIBoxComp 校验 * @param uuid 天赋 uuid */ - private findItemNode(uuid: number): Node | null { - for (const item of this.talent_items) { - if (item.talent_uuid === uuid) return item.node; - } - return null; - } - - /** 卡片点击统一入口:层位未解锁/前置未满足/已满级/点数不足走 smalltip 气泡;其余弹出 CommonPrompt 确认加点,成功后事件驱动刷新 */ private onTalentTap(uuid: number): void { - const cfg = TalentSet[uuid]; - if (!cfg) return; - const levels = smc.getTalentLevels(); - const anchor = this.findItemNode(uuid); - - // 层位解锁:第 N 层要求第 N-1 层累计投入 ≥ 阈值 - if (!isTalentTierUnlocked(levels, cfg.tier)) { - this.showSmallTip(anchor, `${TIER_NAMES[cfg.tier - 1]}投入${TALENT_TIER_UNLOCK_THRESHOLD} 点解锁`); - return; - } - // 软前置:前置天赋等级需达标 - if (!isTalentPrereqMet(levels, cfg)) { - const preCfg = TalentSet[cfg.prereq_uuid!]; - const preName = preCfg ? preCfg.name : `天赋${cfg.prereq_uuid}`; - this.showSmallTip(anchor, `需「${preName}」达到 Lv.${cfg.prereq_lv}`); - return; - } - const lv = smc.getTalentLv(uuid); - if (lv >= cfg.max_lv) { - this.showSmallTip(anchor, "该天赋已满级"); - return; - } - const cost = getTalentUpgradeCost(cfg.tier); - if (cost <= 0) return; - if (smc.getTalentPoints() < cost) { - this.showSmallTip(anchor, "天赋点不足"); - return; - } - - // CommonPrompt 确认加点(UIID.Window) - oops.gui.open(UIID.Window, { - title: "天赋加点", - content: `${cfg.name} Lv.${lv} → Lv.${lv + 1}\n消耗 ${cost} 点天赋点,获得 ${getTalentDisplayText(cfg, 1)}。是否加点?`, - okWord: "加点", - cancelWord: "取消", - needCancel: true, - maskClose: true, - okFunc: () => { - if (!smc.upgradeTalent(uuid)) { - this.showSmallTip(anchor, "天赋点不足"); - } - }, - }); + oops.gui.open(UIID.TIBox, { uuid }); } /** 看广告重置入口:CommonPrompt 二次确认(广告接入前先直接确认重置) */