From 2f1af99a1bad22e918921e981f051f06067bad10 Mon Sep 17 00:00:00 2001 From: walkpan Date: Sat, 14 Mar 2026 13:07:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=8D=A1=E7=89=8C?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=BB=84=E4=BB=B6=E5=B9=B6=E9=9B=86=E6=88=90?= =?UTF-8?q?=E8=87=B3=E5=8D=A1=E7=89=8C=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 CardUseComp 组件,用于处理卡牌使用逻辑和效果分发 - 在 CardComp 中集成 CardUseComp,卡牌使用时触发效果事件 - 修改 MissionCardComp,任务开始时自动发牌至槽位 - 更新预制体资源,修复卡牌 UI 节点引用 --- assets/resources/gui/element/card.prefab | 8 +- assets/resources/gui/role_controller.prefab | 593 ++++++++++---------- assets/script/game/map/CardComp.ts | 18 +- assets/script/game/map/CardUseComp.ts | 67 +++ assets/script/game/map/CardUseComp.ts.meta | 9 + assets/script/game/map/MissionCardComp.ts | 4 +- 6 files changed, 408 insertions(+), 291 deletions(-) create mode 100644 assets/script/game/map/CardUseComp.ts create mode 100644 assets/script/game/map/CardUseComp.ts.meta diff --git a/assets/resources/gui/element/card.prefab b/assets/resources/gui/element/card.prefab index b7677362..550e7d12 100644 --- a/assets/resources/gui/element/card.prefab +++ b/assets/resources/gui/element/card.prefab @@ -3251,7 +3251,9 @@ "__prefab": { "__id__": 141 }, - "Lock": null, + "Lock": { + "__id__": 114 + }, "unLock": null, "ap_node": { "__id__": 81 @@ -3262,7 +3264,9 @@ "name_node": { "__id__": 108 }, - "icon_node": null, + "icon_node": { + "__id__": 57 + }, "cost_node": { "__id__": 127 }, diff --git a/assets/resources/gui/role_controller.prefab b/assets/resources/gui/role_controller.prefab index 7b7ec2a8..180ff0f5 100644 --- a/assets/resources/gui/role_controller.prefab +++ b/assets/resources/gui/role_controller.prefab @@ -22,29 +22,29 @@ "__id__": 2 }, { - "__id__": 395 + "__id__": 397 }, { - "__id__": 531 + "__id__": 533 }, { - "__id__": 540 + "__id__": 542 } ], "_active": true, "_components": [ - { - "__id__": 586 - }, { "__id__": 588 }, { "__id__": 590 + }, + { + "__id__": 592 } ], "_prefab": { - "__id__": 592 + "__id__": 594 }, "_lpos": { "__type__": "cc.Vec3", @@ -116,10 +116,13 @@ }, { "__id__": 392 + }, + { + "__id__": 394 } ], "_prefab": { - "__id__": 394 + "__id__": 396 }, "_lpos": { "__type__": "cc.Vec3", @@ -8842,6 +8845,24 @@ "__type__": "cc.CompPrefabInfo", "fileId": "f9o2hpPnBPmqjcVCGnse3t" }, + { + "__type__": "8edfcfKHNpHJZoM3tj1+VUx", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": { + "__id__": 395 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "22gfWiY+lPi6fu8gMqSF6X" + }, { "__type__": "cc.PrefabInfo", "root": { @@ -8865,29 +8886,29 @@ }, "_children": [ { - "__id__": 396 + "__id__": 398 }, { - "__id__": 412 + "__id__": 414 }, { - "__id__": 448 + "__id__": 450 } ], "_active": false, "_components": [ - { - "__id__": 524 - }, { "__id__": 526 }, { "__id__": 528 + }, + { + "__id__": 530 } ], "_prefab": { - "__id__": 530 + "__id__": 532 }, "_lpos": { "__type__": "cc.Vec3", @@ -8924,27 +8945,27 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 395 + "__id__": 397 }, "_children": [ { - "__id__": 397 + "__id__": 399 } ], "_active": true, "_components": [ - { - "__id__": 405 - }, { "__id__": 407 }, { "__id__": 409 + }, + { + "__id__": 411 } ], "_prefab": { - "__id__": 411 + "__id__": 413 }, "_lpos": { "__type__": "cc.Vec3", @@ -8981,23 +9002,23 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 396 + "__id__": 398 }, "_children": [], "_active": true, "_components": [ - { - "__id__": 398 - }, { "__id__": 400 }, { "__id__": 402 + }, + { + "__id__": 404 } ], "_prefab": { - "__id__": 404 + "__id__": 406 }, "_lpos": { "__type__": "cc.Vec3", @@ -9034,11 +9055,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 397 + "__id__": 399 }, "_enabled": true, "__prefab": { - "__id__": 399 + "__id__": 401 }, "_contentSize": { "__type__": "cc.Size", @@ -9062,11 +9083,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 397 + "__id__": 399 }, "_enabled": true, "__prefab": { - "__id__": 401 + "__id__": 403 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -9110,11 +9131,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 397 + "__id__": 399 }, "_enabled": true, "__prefab": { - "__id__": 403 + "__id__": 405 }, "_alignFlags": 45, "_target": null, @@ -9159,11 +9180,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 396 + "__id__": 398 }, "_enabled": true, "__prefab": { - "__id__": 406 + "__id__": 408 }, "_contentSize": { "__type__": "cc.Size", @@ -9187,11 +9208,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 396 + "__id__": 398 }, "_enabled": true, "__prefab": { - "__id__": 408 + "__id__": 410 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -9235,11 +9256,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 396 + "__id__": 398 }, "_enabled": true, "__prefab": { - "__id__": 410 + "__id__": 412 }, "_alignFlags": 45, "_target": null, @@ -9282,17 +9303,17 @@ "__type__": "cc.Node", "_objFlags": 0, "_parent": { - "__id__": 395 + "__id__": 397 }, "_prefab": { - "__id__": 413 + "__id__": 415 }, "__editorExtras__": {} }, { "__type__": "cc.PrefabInfo", "root": { - "__id__": 412 + "__id__": 414 }, "asset": { "__uuid__": "b111b7ce-9621-4519-b4b8-7a5a64c2e98e", @@ -9300,7 +9321,7 @@ }, "fileId": "24rlgXRJ9AHLGpMW+aYyEx", "instance": { - "__id__": 414 + "__id__": 416 }, "targetOverrides": null }, @@ -9313,9 +9334,6 @@ "mountedChildren": [], "mountedComponents": [], "propertyOverrides": [ - { - "__id__": 415 - }, { "__id__": 417 }, @@ -9332,7 +9350,7 @@ "__id__": 425 }, { - "__id__": 428 + "__id__": 427 }, { "__id__": 430 @@ -9360,6 +9378,9 @@ }, { "__id__": 446 + }, + { + "__id__": 448 } ], "removedComponents": [] @@ -9367,7 +9388,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 416 + "__id__": 418 }, "propertyPath": [ "_name" @@ -9383,7 +9404,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 418 + "__id__": 420 }, "propertyPath": [ "_lpos" @@ -9404,7 +9425,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 420 + "__id__": 422 }, "propertyPath": [ "_lrot" @@ -9426,7 +9447,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 422 + "__id__": 424 }, "propertyPath": [ "_euler" @@ -9447,7 +9468,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 424 + "__id__": 426 }, "propertyPath": [ "clickEvents", @@ -9464,14 +9485,14 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 426 + "__id__": 428 }, "propertyPath": [ "clickEvents", "0" ], "value": { - "__id__": 427 + "__id__": 429 } }, { @@ -9483,7 +9504,7 @@ { "__type__": "cc.ClickEvent", "target": { - "__id__": 395 + "__id__": 397 }, "component": "", "_componentId": "11498TbVJpO6qmZ8m9k55Zx", @@ -9493,13 +9514,13 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 429 + "__id__": 431 }, "propertyPath": [ "_target" ], "value": { - "__id__": 412 + "__id__": 414 } }, { @@ -9511,7 +9532,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 431 + "__id__": 433 }, "propertyPath": [ "_bottom" @@ -9527,7 +9548,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 433 + "__id__": 435 }, "propertyPath": [ "_spriteFrame" @@ -9543,26 +9564,6 @@ "87x48JBkdLQ7whX1NTSH9o" ] }, - { - "__type__": "CCPropertyOverrideInfo", - "targetInfo": { - "__id__": 435 - }, - "propertyPath": [ - "_contentSize" - ], - "value": { - "__type__": "cc.Size", - "width": 300, - "height": 120 - } - }, - { - "__type__": "cc.TargetInfo", - "localID": [ - "b6/HPesdpG8ZsWB4vg6xf2" - ] - }, { "__type__": "CCPropertyOverrideInfo", "targetInfo": { @@ -9580,7 +9581,7 @@ { "__type__": "cc.TargetInfo", "localID": [ - "06atudk+BHR4nPzR3SmW4Z" + "b6/HPesdpG8ZsWB4vg6xf2" ] }, { @@ -9588,6 +9589,26 @@ "targetInfo": { "__id__": 439 }, + "propertyPath": [ + "_contentSize" + ], + "value": { + "__type__": "cc.Size", + "width": 300, + "height": 120 + } + }, + { + "__type__": "cc.TargetInfo", + "localID": [ + "06atudk+BHR4nPzR3SmW4Z" + ] + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 441 + }, "propertyPath": [ "_lineHeight" ], @@ -9602,7 +9623,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 441 + "__id__": 443 }, "propertyPath": [ "_contentSize" @@ -9622,7 +9643,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 443 + "__id__": 445 }, "propertyPath": [ "_fontSize" @@ -9638,7 +9659,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 445 + "__id__": 447 }, "propertyPath": [ "_actualFontSize" @@ -9654,7 +9675,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 447 + "__id__": 449 }, "propertyPath": [ "_outlineWidth" @@ -9673,33 +9694,33 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 395 + "__id__": 397 }, "_children": [ { - "__id__": 449 + "__id__": 451 }, { - "__id__": 471 + "__id__": 473 }, { - "__id__": 495 + "__id__": 497 } ], "_active": true, "_components": [ - { - "__id__": 517 - }, { "__id__": 519 }, { "__id__": 521 + }, + { + "__id__": 523 } ], "_prefab": { - "__id__": 523 + "__id__": 525 }, "_lpos": { "__type__": "cc.Vec3", @@ -9736,27 +9757,27 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 448 + "__id__": 450 }, "_children": [ { - "__id__": 450 + "__id__": 452 }, { - "__id__": 456 + "__id__": 458 }, { - "__id__": 462 + "__id__": 464 } ], "_active": true, "_components": [ { - "__id__": 468 + "__id__": 470 } ], "_prefab": { - "__id__": 470 + "__id__": 472 }, "_lpos": { "__type__": "cc.Vec3", @@ -9793,20 +9814,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 449 + "__id__": 451 }, "_children": [], "_active": true, "_components": [ { - "__id__": 451 + "__id__": 453 }, { - "__id__": 453 + "__id__": 455 } ], "_prefab": { - "__id__": 455 + "__id__": 457 }, "_lpos": { "__type__": "cc.Vec3", @@ -9843,11 +9864,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 450 + "__id__": 452 }, "_enabled": true, "__prefab": { - "__id__": 452 + "__id__": 454 }, "_contentSize": { "__type__": "cc.Size", @@ -9871,11 +9892,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 450 + "__id__": 452 }, "_enabled": true, "__prefab": { - "__id__": 454 + "__id__": 456 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -9929,20 +9950,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 449 + "__id__": 451 }, "_children": [], "_active": false, "_components": [ { - "__id__": 457 + "__id__": 459 }, { - "__id__": 459 + "__id__": 461 } ], "_prefab": { - "__id__": 461 + "__id__": 463 }, "_lpos": { "__type__": "cc.Vec3", @@ -9979,11 +10000,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 456 + "__id__": 458 }, "_enabled": true, "__prefab": { - "__id__": 458 + "__id__": 460 }, "_contentSize": { "__type__": "cc.Size", @@ -10007,11 +10028,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 456 + "__id__": 458 }, "_enabled": true, "__prefab": { - "__id__": 460 + "__id__": 462 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -10065,20 +10086,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 449 + "__id__": 451 }, "_children": [], "_active": true, "_components": [ { - "__id__": 463 + "__id__": 465 }, { - "__id__": 465 + "__id__": 467 } ], "_prefab": { - "__id__": 467 + "__id__": 469 }, "_lpos": { "__type__": "cc.Vec3", @@ -10115,11 +10136,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 462 + "__id__": 464 }, "_enabled": true, "__prefab": { - "__id__": 464 + "__id__": 466 }, "_contentSize": { "__type__": "cc.Size", @@ -10143,11 +10164,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 462 + "__id__": 464 }, "_enabled": true, "__prefab": { - "__id__": 466 + "__id__": 468 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -10201,11 +10222,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 449 + "__id__": 451 }, "_enabled": true, "__prefab": { - "__id__": 469 + "__id__": 471 }, "_contentSize": { "__type__": "cc.Size", @@ -10242,30 +10263,30 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 448 + "__id__": 450 }, "_children": [ { - "__id__": 472 + "__id__": 474 }, { - "__id__": 478 + "__id__": 480 }, { - "__id__": 484 + "__id__": 486 } ], "_active": true, "_components": [ { - "__id__": 490 + "__id__": 492 }, { - "__id__": 492 + "__id__": 494 } ], "_prefab": { - "__id__": 494 + "__id__": 496 }, "_lpos": { "__type__": "cc.Vec3", @@ -10302,20 +10323,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 471 + "__id__": 473 }, "_children": [], "_active": true, "_components": [ { - "__id__": 473 + "__id__": 475 }, { - "__id__": 475 + "__id__": 477 } ], "_prefab": { - "__id__": 477 + "__id__": 479 }, "_lpos": { "__type__": "cc.Vec3", @@ -10352,11 +10373,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 472 + "__id__": 474 }, "_enabled": true, "__prefab": { - "__id__": 474 + "__id__": 476 }, "_contentSize": { "__type__": "cc.Size", @@ -10380,11 +10401,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 472 + "__id__": 474 }, "_enabled": true, "__prefab": { - "__id__": 476 + "__id__": 478 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -10438,20 +10459,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 471 + "__id__": 473 }, "_children": [], "_active": true, "_components": [ { - "__id__": 479 + "__id__": 481 }, { - "__id__": 481 + "__id__": 483 } ], "_prefab": { - "__id__": 483 + "__id__": 485 }, "_lpos": { "__type__": "cc.Vec3", @@ -10488,11 +10509,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 478 + "__id__": 480 }, "_enabled": true, "__prefab": { - "__id__": 480 + "__id__": 482 }, "_contentSize": { "__type__": "cc.Size", @@ -10516,11 +10537,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 478 + "__id__": 480 }, "_enabled": true, "__prefab": { - "__id__": 482 + "__id__": 484 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -10574,20 +10595,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 471 + "__id__": 473 }, "_children": [], "_active": true, "_components": [ { - "__id__": 485 + "__id__": 487 }, { - "__id__": 487 + "__id__": 489 } ], "_prefab": { - "__id__": 489 + "__id__": 491 }, "_lpos": { "__type__": "cc.Vec3", @@ -10624,11 +10645,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 484 + "__id__": 486 }, "_enabled": true, "__prefab": { - "__id__": 486 + "__id__": 488 }, "_contentSize": { "__type__": "cc.Size", @@ -10652,11 +10673,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 484 + "__id__": 486 }, "_enabled": true, "__prefab": { - "__id__": 488 + "__id__": 490 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -10710,11 +10731,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 471 + "__id__": 473 }, "_enabled": true, "__prefab": { - "__id__": 491 + "__id__": 493 }, "_contentSize": { "__type__": "cc.Size", @@ -10738,11 +10759,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 471 + "__id__": 473 }, "_enabled": true, "__prefab": { - "__id__": 493 + "__id__": 495 }, "clickEvents": [], "_interactable": true, @@ -10807,27 +10828,27 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 448 + "__id__": 450 }, "_children": [ { - "__id__": 496 + "__id__": 498 }, { - "__id__": 502 + "__id__": 504 }, { - "__id__": 508 + "__id__": 510 } ], "_active": true, "_components": [ { - "__id__": 514 + "__id__": 516 } ], "_prefab": { - "__id__": 516 + "__id__": 518 }, "_lpos": { "__type__": "cc.Vec3", @@ -10864,20 +10885,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 495 + "__id__": 497 }, "_children": [], "_active": true, "_components": [ { - "__id__": 497 + "__id__": 499 }, { - "__id__": 499 + "__id__": 501 } ], "_prefab": { - "__id__": 501 + "__id__": 503 }, "_lpos": { "__type__": "cc.Vec3", @@ -10914,11 +10935,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 496 + "__id__": 498 }, "_enabled": true, "__prefab": { - "__id__": 498 + "__id__": 500 }, "_contentSize": { "__type__": "cc.Size", @@ -10942,11 +10963,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 496 + "__id__": 498 }, "_enabled": true, "__prefab": { - "__id__": 500 + "__id__": 502 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -11000,20 +11021,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 495 + "__id__": 497 }, "_children": [], "_active": false, "_components": [ { - "__id__": 503 + "__id__": 505 }, { - "__id__": 505 + "__id__": 507 } ], "_prefab": { - "__id__": 507 + "__id__": 509 }, "_lpos": { "__type__": "cc.Vec3", @@ -11050,11 +11071,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 502 + "__id__": 504 }, "_enabled": true, "__prefab": { - "__id__": 504 + "__id__": 506 }, "_contentSize": { "__type__": "cc.Size", @@ -11078,11 +11099,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 502 + "__id__": 504 }, "_enabled": true, "__prefab": { - "__id__": 506 + "__id__": 508 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -11136,20 +11157,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 495 + "__id__": 497 }, "_children": [], "_active": true, "_components": [ { - "__id__": 509 + "__id__": 511 }, { - "__id__": 511 + "__id__": 513 } ], "_prefab": { - "__id__": 513 + "__id__": 515 }, "_lpos": { "__type__": "cc.Vec3", @@ -11186,11 +11207,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 508 + "__id__": 510 }, "_enabled": true, "__prefab": { - "__id__": 510 + "__id__": 512 }, "_contentSize": { "__type__": "cc.Size", @@ -11214,11 +11235,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 508 + "__id__": 510 }, "_enabled": true, "__prefab": { - "__id__": 512 + "__id__": 514 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -11272,11 +11293,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 495 + "__id__": 497 }, "_enabled": true, "__prefab": { - "__id__": 515 + "__id__": 517 }, "_contentSize": { "__type__": "cc.Size", @@ -11313,11 +11334,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 448 + "__id__": 450 }, "_enabled": true, "__prefab": { - "__id__": 518 + "__id__": 520 }, "_contentSize": { "__type__": "cc.Size", @@ -11341,11 +11362,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 448 + "__id__": 450 }, "_enabled": true, "__prefab": { - "__id__": 520 + "__id__": 522 }, "_alignFlags": 44, "_target": null, @@ -11377,11 +11398,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 448 + "__id__": 450 }, "_enabled": true, "__prefab": { - "__id__": 522 + "__id__": 524 }, "_resizeMode": 1, "_layoutType": 1, @@ -11428,11 +11449,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 395 + "__id__": 397 }, "_enabled": true, "__prefab": { - "__id__": 525 + "__id__": 527 }, "_contentSize": { "__type__": "cc.Size", @@ -11456,11 +11477,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 395 + "__id__": 397 }, "_enabled": true, "__prefab": { - "__id__": 527 + "__id__": 529 }, "_alignFlags": 21, "_target": null, @@ -11492,11 +11513,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 395 + "__id__": 397 }, "_enabled": true, "__prefab": { - "__id__": 529 + "__id__": 531 }, "_id": "" }, @@ -11524,14 +11545,14 @@ "__id__": 1 }, "_prefab": { - "__id__": 532 + "__id__": 534 }, "__editorExtras__": {} }, { "__type__": "cc.PrefabInfo", "root": { - "__id__": 531 + "__id__": 533 }, "asset": { "__uuid__": "26bff847-cd29-48a5-bbfa-c3e2dbda688d", @@ -11539,7 +11560,7 @@ }, "fileId": "5a9CMsVQhKP5Y+UJfTKPbx", "instance": { - "__id__": 533 + "__id__": 535 }, "targetOverrides": null }, @@ -11552,20 +11573,20 @@ "mountedChildren": [], "mountedComponents": [], "propertyOverrides": [ - { - "__id__": 534 - }, { "__id__": 536 }, - { - "__id__": 537 - }, { "__id__": 538 }, { "__id__": 539 + }, + { + "__id__": 540 + }, + { + "__id__": 541 } ], "removedComponents": [] @@ -11573,7 +11594,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 535 + "__id__": 537 }, "propertyPath": [ "_name" @@ -11589,7 +11610,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 535 + "__id__": 537 }, "propertyPath": [ "_lpos" @@ -11604,7 +11625,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 535 + "__id__": 537 }, "propertyPath": [ "_lrot" @@ -11620,7 +11641,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 535 + "__id__": 537 }, "propertyPath": [ "_euler" @@ -11635,7 +11656,7 @@ { "__type__": "CCPropertyOverrideInfo", "targetInfo": { - "__id__": 535 + "__id__": 537 }, "propertyPath": [ "_active" @@ -11652,23 +11673,23 @@ }, "_children": [ { - "__id__": 541 + "__id__": 543 } ], "_active": true, "_components": [ - { - "__id__": 579 - }, { "__id__": 581 }, { "__id__": 583 + }, + { + "__id__": 585 } ], "_prefab": { - "__id__": 585 + "__id__": 587 }, "_lpos": { "__type__": "cc.Vec3", @@ -11705,18 +11726,15 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 540 + "__id__": 542 }, "_children": [ { - "__id__": 542 + "__id__": 544 } ], "_active": true, "_components": [ - { - "__id__": 570 - }, { "__id__": 572 }, @@ -11725,10 +11743,13 @@ }, { "__id__": 576 + }, + { + "__id__": 578 } ], "_prefab": { - "__id__": 578 + "__id__": 580 }, "_lpos": { "__type__": "cc.Vec3", @@ -11765,27 +11786,27 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 541 + "__id__": 543 }, "_children": [ { - "__id__": 543 + "__id__": 545 }, { - "__id__": 551 + "__id__": 553 }, { - "__id__": 557 + "__id__": 559 } ], "_active": true, "_components": [ { - "__id__": 567 + "__id__": 569 } ], "_prefab": { - "__id__": 569 + "__id__": 571 }, "_lpos": { "__type__": "cc.Vec3", @@ -11822,23 +11843,23 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 542 + "__id__": 544 }, "_children": [], "_active": true, "_components": [ - { - "__id__": 544 - }, { "__id__": 546 }, { "__id__": 548 + }, + { + "__id__": 550 } ], "_prefab": { - "__id__": 550 + "__id__": 552 }, "_lpos": { "__type__": "cc.Vec3", @@ -11875,11 +11896,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 543 + "__id__": 545 }, "_enabled": true, "__prefab": { - "__id__": 545 + "__id__": 547 }, "_contentSize": { "__type__": "cc.Size", @@ -11903,11 +11924,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 543 + "__id__": 545 }, "_enabled": true, "__prefab": { - "__id__": 547 + "__id__": 549 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -11951,11 +11972,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 543 + "__id__": 545 }, "_enabled": true, "__prefab": { - "__id__": 549 + "__id__": 551 }, "_alignFlags": 40, "_target": null, @@ -12000,20 +12021,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 542 + "__id__": 544 }, "_children": [], "_active": true, "_components": [ { - "__id__": 552 + "__id__": 554 }, { - "__id__": 554 + "__id__": 556 } ], "_prefab": { - "__id__": 556 + "__id__": 558 }, "_lpos": { "__type__": "cc.Vec3", @@ -12050,11 +12071,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 551 + "__id__": 553 }, "_enabled": true, "__prefab": { - "__id__": 553 + "__id__": 555 }, "_contentSize": { "__type__": "cc.Size", @@ -12078,11 +12099,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 551 + "__id__": 553 }, "_enabled": true, "__prefab": { - "__id__": 555 + "__id__": 557 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -12139,14 +12160,11 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 542 + "__id__": 544 }, "_children": [], "_active": true, "_components": [ - { - "__id__": 558 - }, { "__id__": 560 }, @@ -12155,10 +12173,13 @@ }, { "__id__": 564 + }, + { + "__id__": 566 } ], "_prefab": { - "__id__": 566 + "__id__": 568 }, "_lpos": { "__type__": "cc.Vec3", @@ -12195,11 +12216,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 557 + "__id__": 559 }, "_enabled": true, "__prefab": { - "__id__": 559 + "__id__": 561 }, "_contentSize": { "__type__": "cc.Size", @@ -12223,11 +12244,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 557 + "__id__": 559 }, "_enabled": true, "__prefab": { - "__id__": 561 + "__id__": 563 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -12291,11 +12312,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 557 + "__id__": 559 }, "_enabled": true, "__prefab": { - "__id__": 563 + "__id__": 565 }, "_alignFlags": 10, "_target": null, @@ -12327,11 +12348,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 557 + "__id__": 559 }, "_enabled": true, "__prefab": { - "__id__": 565 + "__id__": 567 }, "templateMode": true, "watchPath": "data.data.gold", @@ -12364,11 +12385,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 542 + "__id__": 544 }, "_enabled": true, "__prefab": { - "__id__": 568 + "__id__": 570 }, "_contentSize": { "__type__": "cc.Size", @@ -12405,11 +12426,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 541 + "__id__": 543 }, "_enabled": true, "__prefab": { - "__id__": 571 + "__id__": 573 }, "_contentSize": { "__type__": "cc.Size", @@ -12433,11 +12454,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 541 + "__id__": 543 }, "_enabled": true, "__prefab": { - "__id__": 573 + "__id__": 575 }, "_alignFlags": 8, "_target": null, @@ -12469,11 +12490,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 541 + "__id__": 543 }, "_enabled": true, "__prefab": { - "__id__": 575 + "__id__": 577 }, "_resizeMode": 0, "_layoutType": 1, @@ -12507,11 +12528,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 541 + "__id__": 543 }, "_enabled": true, "__prefab": { - "__id__": 577 + "__id__": 579 }, "_alignFlags": 40, "_target": null, @@ -12556,11 +12577,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 540 + "__id__": 542 }, "_enabled": true, "__prefab": { - "__id__": 580 + "__id__": 582 }, "_contentSize": { "__type__": "cc.Size", @@ -12584,11 +12605,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 540 + "__id__": 542 }, "_enabled": true, "__prefab": { - "__id__": 582 + "__id__": 584 }, "_alignFlags": 17, "_target": null, @@ -12620,11 +12641,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 540 + "__id__": 542 }, "_enabled": true, "__prefab": { - "__id__": 584 + "__id__": 586 }, "_id": "" }, @@ -12655,7 +12676,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 587 + "__id__": 589 }, "_contentSize": { "__type__": "cc.Size", @@ -12683,7 +12704,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 589 + "__id__": 591 }, "_alignFlags": 45, "_target": null, @@ -12719,7 +12740,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 591 + "__id__": 593 }, "debugMode": false, "_id": "" @@ -12741,10 +12762,10 @@ "targetOverrides": [], "nestedPrefabInstanceRoots": [ { - "__id__": 531 + "__id__": 533 }, { - "__id__": 412 + "__id__": 414 }, { "__id__": 367 diff --git a/assets/script/game/map/CardComp.ts b/assets/script/game/map/CardComp.ts index 657e2489..2027692a 100644 --- a/assets/script/game/map/CardComp.ts +++ b/assets/script/game/map/CardComp.ts @@ -3,6 +3,7 @@ import { _decorator, EventTouch, Label, Node, NodeEventType, Sprite, SpriteAtlas import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; import { CardConfig, CardType } from "../common/config/CardSet"; +import { CardUseComp } from "./CardUseComp"; @@ -44,12 +45,14 @@ export class CardComp extends CCComp { private isUsing: boolean = false; private restPosition: Vec3 = new Vec3(); private opacityComp: UIOpacity | null = null; + private cardUseComp: CardUseComp | null = null; onLoad() { /** 初始阶段只做UI状态准备,不触发业务逻辑 */ this.bindEvents(); this.restPosition = this.node.position.clone(); this.opacityComp = this.node.getComponent(UIOpacity) || this.node.addComponent(UIOpacity); + this.cardUseComp = this.resolveCardUseComp(); this.opacityComp.opacity = 255; this.updateLockUI(); this.applyEmptyUI(); @@ -127,7 +130,6 @@ export class CardComp extends CCComp { return true; } - /** 使用当前卡牌:仅做UI层清空,不触发效果事件(下一步再接) */ useCard(): CardConfig | null { if (!this.cardData || this.isUsing) return null; this.isUsing = true; @@ -137,12 +139,13 @@ export class CardComp extends CCComp { type: used.type }); this.playUseDisappearAnim(() => { + this.cardUseComp?.onCardUsed(used); this.clearAfterUse(); this.isUsing = false; }); return used; } - + /** 查询槽位是否有卡 */ hasCard(): boolean { return !!this.cardData; @@ -349,6 +352,17 @@ export class CardComp extends CCComp { if (label) label.string = value; } + private resolveCardUseComp(): CardUseComp | null { + let current: Node | null = this.node.parent; + while (current) { + const comp = current.getComponent(CardUseComp); + if (comp) return comp; + current = current.parent; + } + mLogger.log(this.debugMode, "CardComp", "CardUseComp not found for", this.node.name); + return null; + } + /** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */ reset() { this.node.destroy(); diff --git a/assets/script/game/map/CardUseComp.ts b/assets/script/game/map/CardUseComp.ts new file mode 100644 index 00000000..762bc2ac --- /dev/null +++ b/assets/script/game/map/CardUseComp.ts @@ -0,0 +1,67 @@ +import { mLogger } from "../common/Logger"; +import { _decorator } 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 { CardType } from "../common/config/CardSet"; + +const { ccclass, property } = _decorator; + +interface CardUsePayload { + uuid: number + type: CardType + cost: number + slotName?: string +} + +/** 视图层对象 */ +@ccclass('CardUseComp') +@ecs.register('CardUseComp', false) +export class CardUseComp extends CCComp { + private debugMode: boolean = true; + private useCount: number = 0; + + onLoad() { + + } + + start() { + + } + + onCardUsed(payload: CardUsePayload) { + this.useCount += 1; + mLogger.log(this.debugMode, "CardUseComp", "onCardUsed", { + useCount: this.useCount, + ...payload + }); + this.executeCardEffectEntry(payload); + } + + private executeCardEffectEntry(payload: CardUsePayload) { + const effectTag = this.getEffectEntryTag(payload.type); + mLogger.log(this.debugMode, "CardUseComp", "executeCardEffectEntry", payload); + mLogger.log(this.debugMode, "CardUseComp", "effect entry tag", effectTag); + } + + private getEffectEntryTag(type: CardType): string { + switch (type) { + case CardType.Hero: + return "hero"; + case CardType.Skill: + return "skill"; + case CardType.Special: + return "special"; + case CardType.Buff: + case CardType.Debuff: + return "buff"; + default: + return "unknown"; + } + } + + + /** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */ + reset() { + this.node.destroy(); + } +} diff --git a/assets/script/game/map/CardUseComp.ts.meta b/assets/script/game/map/CardUseComp.ts.meta new file mode 100644 index 00000000..d4ff69f1 --- /dev/null +++ b/assets/script/game/map/CardUseComp.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "8edfc7ca-1cda-4725-9a0c-ded8f5f95531", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/script/game/map/MissionCardComp.ts b/assets/script/game/map/MissionCardComp.ts index 34f11030..0143669b 100644 --- a/assets/script/game/map/MissionCardComp.ts +++ b/assets/script/game/map/MissionCardComp.ts @@ -55,7 +55,7 @@ export class MissionCardComp extends CCComp { this.onMissionStart(); } - /** 任务开始时:重置卡池等级、清空4槽、显示面板 */ + /** 任务开始时:重置卡池等级、清空4槽、显示面板 刷新一次卡池*/ onMissionStart() { this.poolLv = CARD_POOL_INIT_LEVEL; this.layoutCardSlots(); @@ -65,6 +65,8 @@ export class MissionCardComp extends CCComp { } this.updatePoolLvUI(); this.node.active = true; + const cards = this.buildDrawCards(); + this.dispatchCardsToSlots(cards); mLogger.log(this.debugMode, "MissionCardComp", "mission start", { poolLv: this.poolLv });