From d559fdbaa43da5ed3f3debe82b5b4a9a22ce04a7 Mon Sep 17 00:00:00 2001 From: panFD Date: Mon, 7 Sep 2026 21:08:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(config,skill):=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E9=80=9A=E7=94=A8=E6=96=87=E5=AD=97=E9=A3=98=E5=AD=97=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 新增TooltipTypes.tip枚举类型,支持调用方自定义文字和颜色 2. 扩展Tooltip.load和hp_tip方法,增加tipColor参数传递自定义颜色 3. 新增setupTipLabel工具方法,处理通用文字飘字的UI设置 4. 优化现有tip类型的注释和默认颜色逻辑,修复对象池复用颜色残留问题 5. 修复heroSet.ts导入多余空格问题 --- .../resources/game/skill/buff/tooltip.prefab | 1302 +++++------------ assets/script/game/common/config/GameSet.ts | 2 + assets/script/game/common/config/heroSet.ts | 2 +- assets/script/game/hero/HeroViewComp.ts | 10 +- assets/script/game/skill/Tooltip.ts | 6 +- assets/script/game/skill/TooltipCom.ts | 35 +- 6 files changed, 401 insertions(+), 956 deletions(-) diff --git a/assets/resources/game/skill/buff/tooltip.prefab b/assets/resources/game/skill/buff/tooltip.prefab index 193c9f2a..7a4013ed 100644 --- a/assets/resources/game/skill/buff/tooltip.prefab +++ b/assets/resources/game/skill/buff/tooltip.prefab @@ -34,32 +34,35 @@ "__id__": 138 }, { - "__id__": 247 + "__id__": 212 }, { - "__id__": 257 + "__id__": 222 }, { - "__id__": 267 + "__id__": 232 }, { - "__id__": 283 + "__id__": 248 + }, + { + "__id__": 264 } ], "_active": true, "_components": [ { - "__id__": 299 + "__id__": 274 }, { - "__id__": 301 + "__id__": 276 }, { - "__id__": 303 + "__id__": 278 } ], "_prefab": { - "__id__": 305 + "__id__": 280 }, "_lpos": { "__type__": "cc.Vec3", @@ -562,7 +565,7 @@ "__id__": 21 } ], - "_active": true, + "_active": false, "_components": [ { "__id__": 91 @@ -3416,38 +3419,20 @@ "__id__": 183 }, { - "__id__": 200 - }, - { - "__id__": 206 - }, - { - "__id__": 212 - }, - { - "__id__": 218 - }, - { - "__id__": 224 - }, - { - "__id__": 230 - }, - { - "__id__": 236 + "__id__": 201 } ], "_active": true, "_components": [ { - "__id__": 242 + "__id__": 207 }, { - "__id__": 244 + "__id__": 209 } ], "_prefab": { - "__id__": 246 + "__id__": 211 }, "_lpos": { "__type__": "cc.Vec3", @@ -4417,7 +4402,7 @@ "_lscale": { "__type__": "cc.Vec3", "x": 1, - "y": 0.25, + "y": 0.05, "z": 1 }, "_mobility": 0, @@ -4477,7 +4462,7 @@ "__type__": "cc.Color", "r": 255, "g": 255, - "b": 0, + "b": 255, "a": 255 }, "_spriteFrame": { @@ -4577,6 +4562,9 @@ }, { "__id__": 199 + }, + { + "__id__": 200 } ], "removedComponents": [] @@ -4739,820 +4727,14 @@ } }, { - "__type__": "cc.Node", - "_name": "atking", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 138 + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 187 }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 201 - }, - { - "__id__": 203 - } + "propertyPath": [ + "_active" ], - "_prefab": { - "__id__": 205 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": 0, - "y": -2.652, - "z": 0 - }, - "_lrot": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - }, - "_lscale": { - "__type__": "cc.Vec3", - "x": 0.47, - "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__": 200 - }, - "_enabled": true, - "__prefab": { - "__id__": 202 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 236, - "height": 42 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "7aFo3HvWZCtJqSbfXVZtet" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 200 - }, - "_enabled": true, - "__prefab": { - "__id__": 204 - }, - "_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": "abtHaEYwNFyZb1qwKSICO3" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "90g6DFSlVKRZ15w2dPvi/J", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.Node", - "_name": "dead", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 138 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 207 - }, - { - "__id__": 209 - } - ], - "_prefab": { - "__id__": 211 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": 0, - "y": -2.652, - "z": 0 - }, - "_lrot": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - }, - "_lscale": { - "__type__": "cc.Vec3", - "x": 0.47, - "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__": 206 - }, - "_enabled": true, - "__prefab": { - "__id__": 208 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 236, - "height": 42 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "13MVBF5shGFopGOfTUJohC" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 206 - }, - "_enabled": true, - "__prefab": { - "__id__": 210 - }, - "_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": "80nH8NC1FFnb2iYkoQrXH/" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "0cZuqRAahP0pWYirq9RqDm", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.Node", - "_name": "fstart", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 138 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 213 - }, - { - "__id__": 215 - } - ], - "_prefab": { - "__id__": 217 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": 0, - "y": -2.652, - "z": 0 - }, - "_lrot": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - }, - "_lscale": { - "__type__": "cc.Vec3", - "x": 0.47, - "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__": 212 - }, - "_enabled": true, - "__prefab": { - "__id__": 214 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 236, - "height": 42 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "66FcOPSpZOm5nwFreHHVQZ" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 212 - }, - "_enabled": true, - "__prefab": { - "__id__": 216 - }, - "_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": "62NfJdyYxNUrRxi/EvQ+Jh" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "96/D9OS5VJurmTbe6Tb839", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.Node", - "_name": "fend", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 138 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 219 - }, - { - "__id__": 221 - } - ], - "_prefab": { - "__id__": 223 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": 0, - "y": -2.652, - "z": 0 - }, - "_lrot": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - }, - "_lscale": { - "__type__": "cc.Vec3", - "x": 0.47, - "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__": 218 - }, - "_enabled": true, - "__prefab": { - "__id__": 220 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 236, - "height": 42 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "a0AWFH2Z5Luq31m+nQP+AG" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 218 - }, - "_enabled": true, - "__prefab": { - "__id__": 222 - }, - "_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": "0bWp2BFW9DJ60kIy5aYycS" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "7fcNhBQhpEWpnhkAcX29KM", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.Node", - "_name": "atked", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 138 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 225 - }, - { - "__id__": 227 - } - ], - "_prefab": { - "__id__": 229 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": 0, - "y": -2.652, - "z": 0 - }, - "_lrot": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - }, - "_lscale": { - "__type__": "cc.Vec3", - "x": 0.47, - "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__": 224 - }, - "_enabled": true, - "__prefab": { - "__id__": 226 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 236, - "height": 42 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "1cW5Xah4dD/bOqpplw67/4" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 224 - }, - "_enabled": true, - "__prefab": { - "__id__": 228 - }, - "_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": "944v4qp6lPgJrym2vEjngL" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "2dErJTbAdEGLVEeJ8ip7z+", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.Node", - "_name": "revive", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 138 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 231 - }, - { - "__id__": 233 - } - ], - "_prefab": { - "__id__": 235 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": 0, - "y": -2.652, - "z": 0 - }, - "_lrot": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - }, - "_lscale": { - "__type__": "cc.Vec3", - "x": 0.47, - "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__": 230 - }, - "_enabled": true, - "__prefab": { - "__id__": 232 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 236, - "height": 42 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "8bS061iZJPepdq85haE0TE" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 230 - }, - "_enabled": true, - "__prefab": { - "__id__": 234 - }, - "_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": "44hJs1AOxJ8b937edbriM+" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "6brnEfdAVH9bpnrbZli9zI", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null + "value": false }, { "__type__": "cc.Node", @@ -5566,14 +4748,14 @@ "_active": true, "_components": [ { - "__id__": 237 + "__id__": 202 }, { - "__id__": 239 + "__id__": 204 } ], "_prefab": { - "__id__": 241 + "__id__": 206 }, "_lpos": { "__type__": "cc.Vec3", @@ -5610,11 +4792,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 236 + "__id__": 201 }, "_enabled": true, "__prefab": { - "__id__": 238 + "__id__": 203 }, "_contentSize": { "__type__": "cc.Size", @@ -5638,11 +4820,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 236 + "__id__": 201 }, "_enabled": true, "__prefab": { - "__id__": 240 + "__id__": 205 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -5723,7 +4905,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 243 + "__id__": 208 }, "_contentSize": { "__type__": "cc.Size", @@ -5751,7 +4933,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 245 + "__id__": 210 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -5806,17 +4988,17 @@ }, "_children": [ { - "__id__": 248 + "__id__": 213 } ], "_active": false, "_components": [ { - "__id__": 254 + "__id__": 219 } ], "_prefab": { - "__id__": 256 + "__id__": 221 }, "_lpos": { "__type__": "cc.Vec3", @@ -5853,20 +5035,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 247 + "__id__": 212 }, "_children": [], "_active": true, "_components": [ { - "__id__": 249 + "__id__": 214 }, { - "__id__": 251 + "__id__": 216 } ], "_prefab": { - "__id__": 253 + "__id__": 218 }, "_lpos": { "__type__": "cc.Vec3", @@ -5903,11 +5085,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 248 + "__id__": 213 }, "_enabled": true, "__prefab": { - "__id__": 250 + "__id__": 215 }, "_contentSize": { "__type__": "cc.Size", @@ -5931,11 +5113,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 248 + "__id__": 213 }, "_enabled": true, "__prefab": { - "__id__": 252 + "__id__": 217 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -6012,11 +5194,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 247 + "__id__": 212 }, "_enabled": true, "__prefab": { - "__id__": 255 + "__id__": 220 }, "_contentSize": { "__type__": "cc.Size", @@ -6057,17 +5239,17 @@ }, "_children": [ { - "__id__": 258 + "__id__": 223 } ], "_active": false, "_components": [ { - "__id__": 264 + "__id__": 229 } ], "_prefab": { - "__id__": 266 + "__id__": 231 }, "_lpos": { "__type__": "cc.Vec3", @@ -6104,20 +5286,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 257 + "__id__": 222 }, "_children": [], "_active": true, "_components": [ { - "__id__": 259 + "__id__": 224 }, { - "__id__": 261 + "__id__": 226 } ], "_prefab": { - "__id__": 263 + "__id__": 228 }, "_lpos": { "__type__": "cc.Vec3", @@ -6154,11 +5336,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 258 + "__id__": 223 }, "_enabled": true, "__prefab": { - "__id__": 260 + "__id__": 225 }, "_contentSize": { "__type__": "cc.Size", @@ -6182,11 +5364,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 258 + "__id__": 223 }, "_enabled": true, "__prefab": { - "__id__": 262 + "__id__": 227 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -6263,11 +5445,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 257 + "__id__": 222 }, "_enabled": true, "__prefab": { - "__id__": 265 + "__id__": 230 }, "_contentSize": { "__type__": "cc.Size", @@ -6308,20 +5490,20 @@ }, "_children": [ { - "__id__": 268 + "__id__": 233 }, { - "__id__": 274 + "__id__": 239 } ], "_active": false, "_components": [ { - "__id__": 280 + "__id__": 245 } ], "_prefab": { - "__id__": 282 + "__id__": 247 }, "_lpos": { "__type__": "cc.Vec3", @@ -6358,20 +5540,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 267 + "__id__": 232 }, "_children": [], "_active": true, "_components": [ { - "__id__": 269 + "__id__": 234 }, { - "__id__": 271 + "__id__": 236 } ], "_prefab": { - "__id__": 273 + "__id__": 238 }, "_lpos": { "__type__": "cc.Vec3", @@ -6408,11 +5590,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 268 + "__id__": 233 }, "_enabled": true, "__prefab": { - "__id__": 270 + "__id__": 235 }, "_contentSize": { "__type__": "cc.Size", @@ -6436,11 +5618,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 268 + "__id__": 233 }, "_enabled": true, "__prefab": { - "__id__": 272 + "__id__": 237 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -6497,20 +5679,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 267 + "__id__": 232 }, "_children": [], "_active": true, "_components": [ { - "__id__": 275 + "__id__": 240 }, { - "__id__": 277 + "__id__": 242 } ], "_prefab": { - "__id__": 279 + "__id__": 244 }, "_lpos": { "__type__": "cc.Vec3", @@ -6547,11 +5729,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 274 + "__id__": 239 }, "_enabled": true, "__prefab": { - "__id__": 276 + "__id__": 241 }, "_contentSize": { "__type__": "cc.Size", @@ -6575,11 +5757,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 274 + "__id__": 239 }, "_enabled": true, "__prefab": { - "__id__": 278 + "__id__": 243 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -6656,11 +5838,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 267 + "__id__": 232 }, "_enabled": true, "__prefab": { - "__id__": 281 + "__id__": 246 }, "_contentSize": { "__type__": "cc.Size", @@ -6701,20 +5883,20 @@ }, "_children": [ { - "__id__": 284 + "__id__": 249 }, { - "__id__": 290 + "__id__": 255 } ], "_active": false, "_components": [ { - "__id__": 296 + "__id__": 261 } ], "_prefab": { - "__id__": 298 + "__id__": 263 }, "_lpos": { "__type__": "cc.Vec3", @@ -6751,20 +5933,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 283 + "__id__": 248 }, "_children": [], "_active": true, "_components": [ { - "__id__": 285 + "__id__": 250 }, { - "__id__": 287 + "__id__": 252 } ], "_prefab": { - "__id__": 289 + "__id__": 254 }, "_lpos": { "__type__": "cc.Vec3", @@ -6801,11 +5983,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 284 + "__id__": 249 }, "_enabled": true, "__prefab": { - "__id__": 286 + "__id__": 251 }, "_contentSize": { "__type__": "cc.Size", @@ -6829,11 +6011,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 284 + "__id__": 249 }, "_enabled": true, "__prefab": { - "__id__": 288 + "__id__": 253 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -6890,20 +6072,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 283 + "__id__": 248 }, "_children": [], "_active": true, "_components": [ { - "__id__": 291 + "__id__": 256 }, { - "__id__": 293 + "__id__": 258 } ], "_prefab": { - "__id__": 295 + "__id__": 260 }, "_lpos": { "__type__": "cc.Vec3", @@ -6940,11 +6122,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 290 + "__id__": 255 }, "_enabled": true, "__prefab": { - "__id__": 292 + "__id__": 257 }, "_contentSize": { "__type__": "cc.Size", @@ -6968,11 +6150,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 290 + "__id__": 255 }, "_enabled": true, "__prefab": { - "__id__": 294 + "__id__": 259 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -7049,11 +6231,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 283 + "__id__": 248 }, "_enabled": true, "__prefab": { - "__id__": 297 + "__id__": 262 }, "_contentSize": { "__type__": "cc.Size", @@ -7084,6 +6266,257 @@ "targetOverrides": null, "nestedPrefabInstanceRoots": null }, + { + "__type__": "cc.Node", + "_name": "words", + "_objFlags": 512, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 265 + } + ], + "_active": false, + "_components": [ + { + "__id__": 271 + } + ], + "_prefab": { + "__id__": 273 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 20, + "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": 1, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "name", + "_objFlags": 512, + "__editorExtras__": {}, + "_parent": { + "__id__": 264 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 266 + }, + { + "__id__": 268 + } + ], + "_prefab": { + "__id__": 270 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": -37.462, + "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": 1, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 265 + }, + "_enabled": true, + "__prefab": { + "__id__": 267 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 102.71875, + "height": 31.2 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "60jdhT159MdIZfvy8tXTOL" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 265 + }, + "_enabled": true, + "__prefab": { + "__id__": 269 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_string": "skill name", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 20, + "_fontSize": 20, + "_fontFamily": "Arial", + "_lineHeight": 20, + "_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": 3, + "_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": "8cMno5UxVMT6F8JsPrpM82" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "55Qx+au2tFP4DaMb35tSb9", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 264 + }, + "_enabled": true, + "__prefab": { + "__id__": 272 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "14lyfFJOFAaJZO5SL0Wd+z" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "caQpPTq4FKXJy6+HPB5LJd", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, { "__type__": "cc.UITransform", "_name": "", @@ -7094,7 +6527,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 300 + "__id__": 275 }, "_contentSize": { "__type__": "cc.Size", @@ -7122,22 +6555,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 302 - }, - "atking_bg": { - "__id__": 200 - }, - "atked_bg": { - "__id__": 224 - }, - "fstart_bg": { - "__id__": 212 - }, - "dead_bg": { - "__id__": 206 - }, - "revive_bg": { - "__id__": 230 + "__id__": 277 }, "_id": "" }, @@ -7155,7 +6573,7 @@ }, "_enabled": false, "__prefab": { - "__id__": 304 + "__id__": 279 }, "playOnLoad": true, "_clips": [ diff --git a/assets/script/game/common/config/GameSet.ts b/assets/script/game/common/config/GameSet.ts index 31509ae1..2121e205 100644 --- a/assets/script/game/common/config/GameSet.ts +++ b/assets/script/game/common/config/GameSet.ts @@ -148,6 +148,8 @@ export const TooltipTypes = { addmp: 9, shield: 10, miss: 11, + /** 通用文字飘字(闪避/格挡/免疫等),文字与颜色由调用方传入 */ + tip: 12, } diff --git a/assets/script/game/common/config/heroSet.ts b/assets/script/game/common/config/heroSet.ts index 6f67e0f2..704fb8a7 100644 --- a/assets/script/game/common/config/heroSet.ts +++ b/assets/script/game/common/config/heroSet.ts @@ -1,4 +1,4 @@ -import { v3 } from "cc" +import { v3 } from "cc" import { BoxSet, FacSet, FightSet } from "./GameSet" import { SkillOverrides, TGroup, SkillSet, FieldSkillSet, SkillConfig, SkillKind, FieldSkillConfig, FieldSkillType, mergeSkillParams } from "./SkillSet" import { BuffList, BuffConfig, ModOp } from "./BuffSet" diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index d5f1725f..ce08ee39 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -1,4 +1,4 @@ -import { Vec3, _decorator, v3, Collider2D, Contact2DType, Node, Prefab, instantiate, tween, Tween, BoxCollider2D, UITransform } from "cc"; +import { Vec3, _decorator, v3, Collider2D, Contact2DType, Node, Prefab, instantiate, tween, Tween, BoxCollider2D, UITransform, Color } 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"; @@ -222,7 +222,7 @@ export class HeroViewComp extends CCComp { Tooltip.load(pos, TooltipTypes.skill, value, s_uuid, this.node, 1, this.model?.fac ?? FacSet.MON); } /** 血量提示(伤害数字) */ - private hp_tip(type: number = 1, value: string = "", s_uuid: number = 1001, y: number = 0, debuffIcon: string = "") { + private hp_tip(type: number = 1, value: string = "", s_uuid: number = 1001, y: number = 0, debuffIcon: string = "", tipColor: Color | null = null) { let x = this.node.position.x; // 获取怪物高度的一半,定位到中心点 let halfHeight = 0; @@ -234,15 +234,15 @@ export class HeroViewComp extends CCComp { // 起点设为怪物中心偏下位置,使其在血条下方 let ny = this.node.position.y + halfHeight - 15; let pos = v3(x, ny, 0); - Tooltip.load(pos, type, value, s_uuid, this.node.parent, 1, this.model?.fac ?? FacSet.MON, debuffIcon); + Tooltip.load(pos, type, value, s_uuid, this.node.parent, 1, this.model?.fac ?? FacSet.MON, debuffIcon, tipColor); } - /** 护盾减免提示 */ + /** 护盾吸收提示:蓝色 "吸收 N" */ shield_tip(absorbed: number) { this.hp_tip(TooltipTypes.shield, NumberFormatter.formatNumber(Math.max(0, Math.floor(absorbed)))); } - /** 闪避提示 */ + /** 闪避提示:白色 "闪避" */ showMiss() { this.hp_tip(TooltipTypes.miss, "闪避"); } diff --git a/assets/script/game/skill/Tooltip.ts b/assets/script/game/skill/Tooltip.ts index 365a731d..d18fa461 100644 --- a/assets/script/game/skill/Tooltip.ts +++ b/assets/script/game/skill/Tooltip.ts @@ -4,7 +4,7 @@ import { BoxSet, FacSet } from "../common/config/GameSet"; import { SkillSet } from "../common/config/SkillSet"; import { smc } from "../common/SingletonModuleComp"; import { TooltipCom } from "./TooltipCom"; -import { instantiate, Node, Prefab, Vec3 ,tween, v3,animation,Label,resources,SpriteFrame,Sprite, NodePool} from "cc"; +import { instantiate, Node, Prefab, Vec3 ,tween, v3,animation,Label,resources,SpriteFrame,Sprite, NodePool, Color} from "cc"; /** Skill 模块 */ @ecs.register(`Tooltip`) @@ -60,7 +60,7 @@ export class Tooltip extends ecs.Entity { this.remove(TooltipCom); super.destroy(); } - static load(pos: Vec3 = Vec3.ZERO,type:number=1,vaule:string="",s_uuid:number=1001,parent:any=null,cd:number=1,fac:number=FacSet.MON,debuffIcon:string="") { + static load(pos: Vec3 = Vec3.ZERO,type:number=1,vaule:string="",s_uuid:number=1001,parent:any=null,cd:number=1,fac:number=FacSet.MON,debuffIcon:string="",tipColor:Color|null=null) { let node: Node; if (Tooltip.pool.size() > 0) { node = Tooltip.pool.get()!; @@ -75,7 +75,7 @@ export class Tooltip extends ecs.Entity { node.active = true; var sv = node.getComponent(TooltipCom)!; - sv.init(type, vaule, s_uuid, fac, debuffIcon); + sv.init(type, vaule, s_uuid, fac, debuffIcon, tipColor); // this.add(sv); // 不要添加到单例实体上,否则会覆盖或导致单例被销毁 } diff --git a/assets/script/game/skill/TooltipCom.ts b/assets/script/game/skill/TooltipCom.ts index c896e4bf..80f30169 100644 --- a/assets/script/game/skill/TooltipCom.ts +++ b/assets/script/game/skill/TooltipCom.ts @@ -17,6 +17,8 @@ export class TooltipCom extends CCComp { fac: number = FacSet.MON; /** DoT 飘字需激活的 debuff 图标节点名(loss_life/hp/debuff 下的子节点,如 FireDamage);空串=普通伤害 */ debuffIcon: string = ""; + /** 通用文字飘字(TooltipTypes.tip)的自定义颜色,null 表示使用预制体默认色 */ + tipColor: Color | null = null; // 动画参数配置 private readonly popDuration = 0.15; @@ -31,12 +33,13 @@ export class TooltipCom extends CCComp { } /** 初始化并播放动画 */ - init(type: number, value: string, uuid: number, fac: number = FacSet.MON, debuffIcon: string = "") { + init(type: number, value: string, uuid: number, fac: number = FacSet.MON, debuffIcon: string = "", tipColor: Color | null = null) { this.stype = type; this.value = value; this.s_uuid = uuid; this.fac = fac; this.debuffIcon = debuffIcon; + this.tipColor = tipColor; // 初始化或获取 UIOpacity 组件 this._uiOpacity = this.node.getComponent(UIOpacity); @@ -132,16 +135,22 @@ export class TooltipCom extends CCComp { this.node.setPosition(v3(this.node.position.x, currentY - 60)); this.node.setSiblingIndex(topSiblingIndex); break; - case TooltipTypes.shield: // 护盾减免 + case TooltipTypes.shield: // 护盾吸收伤害:显示“吸收”+ 数值 this.node.setPosition(v3(this.node.position.x + offsetX, currentY)); this.node.setSiblingIndex(topSiblingIndex); - this.setupLabel("add_life", "hp", "0"); - isHeal = true; + this.setupTipLabel(`吸收 ${this.value}`, this.tipColor ?? new Color(79, 195, 247, 255)); // 默认蓝 + isHeal = true; // 垂直上飘,区别于伤害随机横飘 break; case TooltipTypes.miss: // 闪避 this.node.setPosition(v3(this.node.position.x + offsetX, currentY)); this.node.setSiblingIndex(topSiblingIndex); - this.setupLabel("add_life", "hp", "闪避"); + this.setupTipLabel(this.value || "闪避", this.tipColor ?? new Color(255, 255, 255, 255)); // 默认白 + isHeal = true; + break; + case TooltipTypes.tip: // 通用文字飘字 + this.node.setPosition(v3(this.node.position.x + offsetX, currentY)); + this.node.setSiblingIndex(topSiblingIndex); + this.setupTipLabel(this.value, this.tipColor); isHeal = true; break; } @@ -158,6 +167,22 @@ export class TooltipCom extends CCComp { } } + /** + * 通用文字飘字:激活 words 节点并设置文字与颜色 + * 预制体需包含 words/name 结构(Label);与 skill 节点区分,走漂移上飘动画而非原地淡出 + * 对象池复用安全:未传色时恢复默认白,避免上次自定义色残留 + */ + private setupTipLabel(text: string, color: Color | null = null) { + const words = this.node.getChildByName("words"); + if (!words) return; + words.active = true; + const label = words.getChildByName("name")?.getComponent(Label); + if (label) { + label.string = text; + label.color = color ?? Color.WHITE.clone(); + } + } + /** * DoT 伤害飘字:激活 loss_life/hp/debuff 下指定的 debuff 图标子节点。 * 仅怪物普通伤害(loss_life)路径调用;debuffIcon 为空或未找到节点时静默跳过。