From 15a98f985ba1931a0137c41a727d5817beacd8cf Mon Sep 17 00:00:00 2001 From: pan Date: Tue, 28 Jul 2026 16:35:54 +0800 Subject: [PATCH] =?UTF-8?q?refactor(HeroBoxComp):=20=E5=B0=81=E8=A3=85?= =?UTF-8?q?=E6=9B=B4=E5=A4=9A=E6=8C=89=E9=92=AE=E7=8A=B6=E6=80=81=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将英雄盒子的更多按钮显隐状态切换逻辑抽离为独立私有方法,提升代码可读性和维护性。 --- assets/resources/gui/element/herobox.prefab | 1044 ++++++++++++++----- assets/script/game/map/HeroBoxComp.ts | 18 + 2 files changed, 810 insertions(+), 252 deletions(-) diff --git a/assets/resources/gui/element/herobox.prefab b/assets/resources/gui/element/herobox.prefab index bafb38b4..21280676 100644 --- a/assets/resources/gui/element/herobox.prefab +++ b/assets/resources/gui/element/herobox.prefab @@ -38,22 +38,25 @@ }, { "__id__": 165 + }, + { + "__id__": 417 } ], "_active": true, "_components": [ { - "__id__": 417 + "__id__": 448 }, { - "__id__": 419 + "__id__": 450 }, { - "__id__": 421 + "__id__": 452 } ], "_prefab": { - "__id__": 577 + "__id__": 608 }, "_lpos": { "__type__": "cc.Vec3", @@ -418,7 +421,8 @@ "fileId": "c46/YsCPVOJYA4mWEpNYRx", "instance": { "__id__": 29 - } + }, + "targetOverrides": null }, { "__type__": "cc.PrefabInstance", @@ -550,9 +554,9 @@ }, "_alignFlags": 9, "_target": null, - "_left": 15, + "_left": 16, "_right": 0, - "_top": 15, + "_top": 16, "_bottom": 0, "_horizontalCenter": 0, "_verticalCenter": 0, @@ -598,8 +602,8 @@ ], "value": { "__type__": "cc.Vec3", - "x": -60, - "y": 160, + "x": -59, + "y": 159, "z": 0 } }, @@ -3012,6 +3016,8 @@ "__id__": 0 }, "fileId": "894Jil2OhD84XdOP9fS7Ua", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -3961,6 +3967,8 @@ "__id__": 0 }, "fileId": "c4EX2JgJ5HZrDspvOG9J2p", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -4575,6 +4583,8 @@ "__id__": 0 }, "fileId": "eeQCVMj0JGZJiignND/ULN", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -5189,6 +5199,8 @@ "__id__": 0 }, "fileId": "3d4GQZURdM5r23jdOMVjD5", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -5803,6 +5815,8 @@ "__id__": 0 }, "fileId": "bcbF+3UzZP9JVCuP62yFKE", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -6417,6 +6431,8 @@ "__id__": 0 }, "fileId": "5fVUNuQxBMFpbzm5ZRCdj+", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -7031,6 +7047,8 @@ "__id__": 0 }, "fileId": "7f/qT0lxZD/YzyDm1+jb4C", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -7645,6 +7663,8 @@ "__id__": 0 }, "fileId": "36efkC0/lBnYK1sqHJ8koP", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -8259,6 +8279,8 @@ "__id__": 0 }, "fileId": "3cW8usDWVKQoW+i5kiq8zv", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -8372,6 +8394,8 @@ "__id__": 0 }, "fileId": "0d18lKYtxLpKiCZ/jOdIIS", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -8838,6 +8862,8 @@ "__id__": 0 }, "fileId": "acSAy0hgpMUY4Um7mbnFM2", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -9019,6 +9045,517 @@ "__id__": 0 }, "fileId": "84sZynr/VEY71GepqNMLrx", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "noHero", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 418 + }, + { + "__id__": 437 + } + ], + "_active": false, + "_components": [ + { + "__id__": 443 + }, + { + "__id__": 445 + } + ], + "_prefab": { + "__id__": 447 + }, + "_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", + "_objFlags": 0, + "_parent": { + "__id__": 417 + }, + "_prefab": { + "__id__": 419 + }, + "__editorExtras__": {} + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 418 + }, + "asset": { + "__uuid__": "b8282f33-ab04-44c5-b349-4bdc291374e6", + "__expectedType__": "cc.Prefab" + }, + "fileId": "53+ryxPCZCH4lnXIdDcAFq", + "instance": { + "__id__": 420 + }, + "targetOverrides": null + }, + { + "__type__": "cc.PrefabInstance", + "fileId": "4aIVyonrFKF4ZXN30k03rc", + "prefabRootNode": { + "__id__": 1 + }, + "mountedChildren": [], + "mountedComponents": [], + "propertyOverrides": [ + { + "__id__": 421 + }, + { + "__id__": 423 + }, + { + "__id__": 424 + }, + { + "__id__": 425 + }, + { + "__id__": 426 + }, + { + "__id__": 428 + }, + { + "__id__": 430 + }, + { + "__id__": 432 + }, + { + "__id__": 434 + }, + { + "__id__": 435 + }, + { + "__id__": 436 + } + ], + "removedComponents": [] + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 422 + }, + "propertyPath": [ + "_name" + ], + "value": "pbgb" + }, + { + "__type__": "cc.TargetInfo", + "localID": [ + "53+ryxPCZCH4lnXIdDcAFq" + ] + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 422 + }, + "propertyPath": [ + "_lpos" + ], + "value": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 422 + }, + "propertyPath": [ + "_lrot" + ], + "value": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + } + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 422 + }, + "propertyPath": [ + "_euler" + ], + "value": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 427 + }, + "propertyPath": [ + "_contentSize" + ], + "value": { + "__type__": "cc.Size", + "width": 202, + "height": 402 + } + }, + { + "__type__": "cc.TargetInfo", + "localID": [ + "fbsMBT3QJAj7gL4t3G3jxn" + ] + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 429 + }, + "propertyPath": [ + "_contentSize" + ], + "value": { + "__type__": "cc.Size", + "width": 202, + "height": 402 + } + }, + { + "__type__": "cc.TargetInfo", + "localID": [ + "51nWzhi2VDXpqlsDyJESVG" + ] + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 431 + }, + "propertyPath": [ + "_contentSize" + ], + "value": { + "__type__": "cc.Size", + "width": 202, + "height": 402 + } + }, + { + "__type__": "cc.TargetInfo", + "localID": [ + "d62+XKXfhHCICfkyYRyDL3" + ] + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 433 + }, + "propertyPath": [ + "_left" + ], + "value": 14 + }, + { + "__type__": "cc.TargetInfo", + "localID": [ + "9eL+/nVtRIT7DnXviLbhVO" + ] + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 433 + }, + "propertyPath": [ + "_right" + ], + "value": 14 + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 433 + }, + "propertyPath": [ + "_top" + ], + "value": 14 + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 433 + }, + "propertyPath": [ + "_bottom" + ], + "value": 14 + }, + { + "__type__": "cc.Node", + "_name": "Toggle_Check_02_On", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 417 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 438 + }, + { + "__id__": 440 + } + ], + "_prefab": { + "__id__": 442 + }, + "_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__": 437 + }, + "_enabled": true, + "__prefab": { + "__id__": 439 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 80, + "height": 76 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "ae6WJK/bRBVrTHfgVLlf/W" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 437 + }, + "_enabled": true, + "__prefab": { + "__id__": 441 + }, + "_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@5f79a", + "__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": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "2fMy8fnntF4YQjs451bo9V" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "d8QC5C0kVPl6zPATCgrAEc", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 417 + }, + "_enabled": true, + "__prefab": { + "__id__": 444 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 230, + "height": 430 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "b9GFzLp/5GlZYZhC/w6etl" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 417 + }, + "_enabled": true, + "__prefab": { + "__id__": 446 + }, + "_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": "4d45xbc1tBBoKruF7gEz8P" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "0cT3xJLPpKzbC6m5p/bbqm", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -9031,7 +9568,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 418 + "__id__": 449 }, "_contentSize": { "__type__": "cc.Size", @@ -9059,7 +9596,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 420 + "__id__": 451 }, "_alignFlags": 0, "_target": null, @@ -9095,13 +9632,13 @@ }, "_enabled": true, "__prefab": { - "__id__": 422 + "__id__": 453 }, "icon_node": { - "__id__": 423 + "__id__": 454 }, "bg_node": { - "__id__": 463 + "__id__": 494 }, "name_label": { "__id__": 88 @@ -9202,20 +9739,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 424 + "__id__": 455 }, "_children": [], "_active": true, "_components": [ { - "__id__": 458 + "__id__": 489 }, { - "__id__": 460 + "__id__": 491 } ], "_prefab": { - "__id__": 462 + "__id__": 493 }, "_lpos": { "__type__": "cc.Vec3", @@ -9256,38 +9793,38 @@ }, "_children": [ { - "__id__": 425 + "__id__": 456 }, { - "__id__": 423 + "__id__": 454 }, { - "__id__": 431 + "__id__": 462 }, { - "__id__": 437 + "__id__": 468 }, { - "__id__": 443 + "__id__": 474 } ], "_active": true, "_components": [ { - "__id__": 449 + "__id__": 480 }, { - "__id__": 451 + "__id__": 482 }, { - "__id__": 453 + "__id__": 484 }, { - "__id__": 455 + "__id__": 486 } ], "_prefab": { - "__id__": 457 + "__id__": 488 }, "_lpos": { "__type__": "cc.Vec3", @@ -9324,20 +9861,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 424 + "__id__": 455 }, "_children": [], "_active": true, "_components": [ { - "__id__": 426 + "__id__": 457 }, { - "__id__": 428 + "__id__": 459 } ], "_prefab": { - "__id__": 430 + "__id__": 461 }, "_lpos": { "__type__": "cc.Vec3", @@ -9374,11 +9911,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 425 + "__id__": 456 }, "_enabled": true, "__prefab": { - "__id__": 427 + "__id__": 458 }, "_contentSize": { "__type__": "cc.Size", @@ -9402,11 +9939,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 425 + "__id__": 456 }, "_enabled": true, "__prefab": { - "__id__": 429 + "__id__": 460 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -9460,20 +9997,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 424 + "__id__": 455 }, "_children": [], "_active": false, "_components": [ { - "__id__": 432 + "__id__": 463 }, { - "__id__": 434 + "__id__": 465 } ], "_prefab": { - "__id__": 436 + "__id__": 467 }, "_lpos": { "__type__": "cc.Vec3", @@ -9510,11 +10047,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 431 + "__id__": 462 }, "_enabled": true, "__prefab": { - "__id__": 433 + "__id__": 464 }, "_contentSize": { "__type__": "cc.Size", @@ -9538,11 +10075,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 431 + "__id__": 462 }, "_enabled": true, "__prefab": { - "__id__": 435 + "__id__": 466 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -9596,20 +10133,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 424 + "__id__": 455 }, "_children": [], "_active": false, "_components": [ { - "__id__": 438 + "__id__": 469 }, { - "__id__": 440 + "__id__": 471 } ], "_prefab": { - "__id__": 442 + "__id__": 473 }, "_lpos": { "__type__": "cc.Vec3", @@ -9646,11 +10183,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 437 + "__id__": 468 }, "_enabled": true, "__prefab": { - "__id__": 439 + "__id__": 470 }, "_contentSize": { "__type__": "cc.Size", @@ -9674,11 +10211,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 437 + "__id__": 468 }, "_enabled": true, "__prefab": { - "__id__": 441 + "__id__": 472 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -9732,20 +10269,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 424 + "__id__": 455 }, "_children": [], "_active": false, "_components": [ { - "__id__": 444 + "__id__": 475 }, { - "__id__": 446 + "__id__": 477 } ], "_prefab": { - "__id__": 448 + "__id__": 479 }, "_lpos": { "__type__": "cc.Vec3", @@ -9782,11 +10319,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 443 + "__id__": 474 }, "_enabled": true, "__prefab": { - "__id__": 445 + "__id__": 476 }, "_contentSize": { "__type__": "cc.Size", @@ -9810,11 +10347,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 443 + "__id__": 474 }, "_enabled": true, "__prefab": { - "__id__": 447 + "__id__": 478 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -9868,11 +10405,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 424 + "__id__": 455 }, "_enabled": true, "__prefab": { - "__id__": 450 + "__id__": 481 }, "_contentSize": { "__type__": "cc.Size", @@ -9896,11 +10433,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 424 + "__id__": 455 }, "_enabled": true, "__prefab": { - "__id__": 452 + "__id__": 483 }, "_type": 0, "_inverted": false, @@ -9918,11 +10455,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 424 + "__id__": 455 }, "_enabled": true, "__prefab": { - "__id__": 454 + "__id__": 485 }, "_alignFlags": 45, "_target": null, @@ -9954,11 +10491,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 424 + "__id__": 455 }, "_enabled": true, "__prefab": { - "__id__": 456 + "__id__": 487 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -10013,11 +10550,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 423 + "__id__": 454 }, "_enabled": true, "__prefab": { - "__id__": 459 + "__id__": 490 }, "_contentSize": { "__type__": "cc.Size", @@ -10041,11 +10578,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 423 + "__id__": 454 }, "_enabled": true, "__prefab": { - "__id__": 461 + "__id__": 492 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -10100,35 +10637,35 @@ }, "_children": [ { - "__id__": 464 + "__id__": 495 }, { - "__id__": 480 + "__id__": 511 }, { - "__id__": 496 + "__id__": 527 }, { - "__id__": 512 + "__id__": 543 }, { - "__id__": 528 + "__id__": 559 }, { - "__id__": 544 + "__id__": 575 } ], "_active": true, "_components": [ { - "__id__": 572 + "__id__": 603 }, { - "__id__": 574 + "__id__": 605 } ], "_prefab": { - "__id__": 576 + "__id__": 607 }, "_lpos": { "__type__": "cc.Vec3", @@ -10165,27 +10702,27 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 463 + "__id__": 494 }, "_children": [ { - "__id__": 465 + "__id__": 496 } ], "_active": true, "_components": [ { - "__id__": 473 + "__id__": 504 }, { - "__id__": 475 + "__id__": 506 }, { - "__id__": 477 + "__id__": 508 } ], "_prefab": { - "__id__": 479 + "__id__": 510 }, "_lpos": { "__type__": "cc.Vec3", @@ -10222,23 +10759,23 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 464 + "__id__": 495 }, "_children": [], "_active": true, "_components": [ { - "__id__": 466 + "__id__": 497 }, { - "__id__": 468 + "__id__": 499 }, { - "__id__": 470 + "__id__": 501 } ], "_prefab": { - "__id__": 472 + "__id__": 503 }, "_lpos": { "__type__": "cc.Vec3", @@ -10275,11 +10812,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 465 + "__id__": 496 }, "_enabled": true, "__prefab": { - "__id__": 467 + "__id__": 498 }, "_contentSize": { "__type__": "cc.Size", @@ -10303,11 +10840,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 465 + "__id__": 496 }, "_enabled": true, "__prefab": { - "__id__": 469 + "__id__": 500 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -10351,11 +10888,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 465 + "__id__": 496 }, "_enabled": true, "__prefab": { - "__id__": 471 + "__id__": 502 }, "_alignFlags": 45, "_target": null, @@ -10400,11 +10937,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 464 + "__id__": 495 }, "_enabled": true, "__prefab": { - "__id__": 474 + "__id__": 505 }, "_contentSize": { "__type__": "cc.Size", @@ -10428,11 +10965,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 464 + "__id__": 495 }, "_enabled": true, "__prefab": { - "__id__": 476 + "__id__": 507 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -10476,11 +11013,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 464 + "__id__": 495 }, "_enabled": true, "__prefab": { - "__id__": 478 + "__id__": 509 }, "_alignFlags": 45, "_target": null, @@ -10525,27 +11062,27 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 463 + "__id__": 494 }, "_children": [ { - "__id__": 481 + "__id__": 512 } ], "_active": true, "_components": [ { - "__id__": 489 + "__id__": 520 }, { - "__id__": 491 + "__id__": 522 }, { - "__id__": 493 + "__id__": 524 } ], "_prefab": { - "__id__": 495 + "__id__": 526 }, "_lpos": { "__type__": "cc.Vec3", @@ -10582,23 +11119,23 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 480 + "__id__": 511 }, "_children": [], "_active": true, "_components": [ { - "__id__": 482 + "__id__": 513 }, { - "__id__": 484 + "__id__": 515 }, { - "__id__": 486 + "__id__": 517 } ], "_prefab": { - "__id__": 488 + "__id__": 519 }, "_lpos": { "__type__": "cc.Vec3", @@ -10635,11 +11172,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 481 + "__id__": 512 }, "_enabled": true, "__prefab": { - "__id__": 483 + "__id__": 514 }, "_contentSize": { "__type__": "cc.Size", @@ -10663,11 +11200,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 481 + "__id__": 512 }, "_enabled": true, "__prefab": { - "__id__": 485 + "__id__": 516 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -10708,11 +11245,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 481 + "__id__": 512 }, "_enabled": true, "__prefab": { - "__id__": 487 + "__id__": 518 }, "_alignFlags": 45, "_target": null, @@ -10757,11 +11294,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 480 + "__id__": 511 }, "_enabled": true, "__prefab": { - "__id__": 490 + "__id__": 521 }, "_contentSize": { "__type__": "cc.Size", @@ -10785,11 +11322,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 480 + "__id__": 511 }, "_enabled": true, "__prefab": { - "__id__": 492 + "__id__": 523 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -10833,11 +11370,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 480 + "__id__": 511 }, "_enabled": true, "__prefab": { - "__id__": 494 + "__id__": 525 }, "_alignFlags": 45, "_target": null, @@ -10882,27 +11419,27 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 463 + "__id__": 494 }, "_children": [ { - "__id__": 497 + "__id__": 528 } ], "_active": true, "_components": [ { - "__id__": 505 + "__id__": 536 }, { - "__id__": 507 + "__id__": 538 }, { - "__id__": 509 + "__id__": 540 } ], "_prefab": { - "__id__": 511 + "__id__": 542 }, "_lpos": { "__type__": "cc.Vec3", @@ -10939,23 +11476,23 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 496 + "__id__": 527 }, "_children": [], "_active": true, "_components": [ { - "__id__": 498 + "__id__": 529 }, { - "__id__": 500 + "__id__": 531 }, { - "__id__": 502 + "__id__": 533 } ], "_prefab": { - "__id__": 504 + "__id__": 535 }, "_lpos": { "__type__": "cc.Vec3", @@ -10992,11 +11529,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 497 + "__id__": 528 }, "_enabled": true, "__prefab": { - "__id__": 499 + "__id__": 530 }, "_contentSize": { "__type__": "cc.Size", @@ -11020,11 +11557,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 497 + "__id__": 528 }, "_enabled": true, "__prefab": { - "__id__": 501 + "__id__": 532 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -11068,11 +11605,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 497 + "__id__": 528 }, "_enabled": true, "__prefab": { - "__id__": 503 + "__id__": 534 }, "_alignFlags": 45, "_target": null, @@ -11117,11 +11654,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 496 + "__id__": 527 }, "_enabled": true, "__prefab": { - "__id__": 506 + "__id__": 537 }, "_contentSize": { "__type__": "cc.Size", @@ -11145,11 +11682,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 496 + "__id__": 527 }, "_enabled": true, "__prefab": { - "__id__": 508 + "__id__": 539 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -11193,11 +11730,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 496 + "__id__": 527 }, "_enabled": true, "__prefab": { - "__id__": 510 + "__id__": 541 }, "_alignFlags": 45, "_target": null, @@ -11242,27 +11779,27 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 463 + "__id__": 494 }, "_children": [ { - "__id__": 513 + "__id__": 544 } ], "_active": true, "_components": [ { - "__id__": 521 + "__id__": 552 }, { - "__id__": 523 + "__id__": 554 }, { - "__id__": 525 + "__id__": 556 } ], "_prefab": { - "__id__": 527 + "__id__": 558 }, "_lpos": { "__type__": "cc.Vec3", @@ -11299,23 +11836,23 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 512 + "__id__": 543 }, "_children": [], "_active": true, "_components": [ { - "__id__": 514 + "__id__": 545 }, { - "__id__": 516 + "__id__": 547 }, { - "__id__": 518 + "__id__": 549 } ], "_prefab": { - "__id__": 520 + "__id__": 551 }, "_lpos": { "__type__": "cc.Vec3", @@ -11352,11 +11889,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 513 + "__id__": 544 }, "_enabled": true, "__prefab": { - "__id__": 515 + "__id__": 546 }, "_contentSize": { "__type__": "cc.Size", @@ -11380,11 +11917,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 513 + "__id__": 544 }, "_enabled": true, "__prefab": { - "__id__": 517 + "__id__": 548 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -11428,11 +11965,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 513 + "__id__": 544 }, "_enabled": true, "__prefab": { - "__id__": 519 + "__id__": 550 }, "_alignFlags": 45, "_target": null, @@ -11477,11 +12014,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 512 + "__id__": 543 }, "_enabled": true, "__prefab": { - "__id__": 522 + "__id__": 553 }, "_contentSize": { "__type__": "cc.Size", @@ -11505,11 +12042,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 512 + "__id__": 543 }, "_enabled": true, "__prefab": { - "__id__": 524 + "__id__": 555 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -11553,11 +12090,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 512 + "__id__": 543 }, "_enabled": true, "__prefab": { - "__id__": 526 + "__id__": 557 }, "_alignFlags": 45, "_target": null, @@ -11602,27 +12139,27 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 463 + "__id__": 494 }, "_children": [ { - "__id__": 529 + "__id__": 560 } ], "_active": true, "_components": [ { - "__id__": 537 + "__id__": 568 }, { - "__id__": 539 + "__id__": 570 }, { - "__id__": 541 + "__id__": 572 } ], "_prefab": { - "__id__": 543 + "__id__": 574 }, "_lpos": { "__type__": "cc.Vec3", @@ -11659,23 +12196,23 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 528 + "__id__": 559 }, "_children": [], "_active": true, "_components": [ { - "__id__": 530 + "__id__": 561 }, { - "__id__": 532 + "__id__": 563 }, { - "__id__": 534 + "__id__": 565 } ], "_prefab": { - "__id__": 536 + "__id__": 567 }, "_lpos": { "__type__": "cc.Vec3", @@ -11712,11 +12249,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 529 + "__id__": 560 }, "_enabled": true, "__prefab": { - "__id__": 531 + "__id__": 562 }, "_contentSize": { "__type__": "cc.Size", @@ -11740,11 +12277,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 529 + "__id__": 560 }, "_enabled": true, "__prefab": { - "__id__": 533 + "__id__": 564 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -11788,11 +12325,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 529 + "__id__": 560 }, "_enabled": true, "__prefab": { - "__id__": 535 + "__id__": 566 }, "_alignFlags": 45, "_target": null, @@ -11837,11 +12374,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 528 + "__id__": 559 }, "_enabled": true, "__prefab": { - "__id__": 538 + "__id__": 569 }, "_contentSize": { "__type__": "cc.Size", @@ -11865,11 +12402,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 528 + "__id__": 559 }, "_enabled": true, "__prefab": { - "__id__": 540 + "__id__": 571 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -11913,11 +12450,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 528 + "__id__": 559 }, "_enabled": true, "__prefab": { - "__id__": 542 + "__id__": 573 }, "_alignFlags": 45, "_target": null, @@ -11962,27 +12499,27 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 463 + "__id__": 494 }, "_children": [ { - "__id__": 545 + "__id__": 576 }, { - "__id__": 553 + "__id__": 584 }, { - "__id__": 561 + "__id__": 592 } ], "_active": false, "_components": [ { - "__id__": 569 + "__id__": 600 } ], "_prefab": { - "__id__": 571 + "__id__": 602 }, "_lpos": { "__type__": "cc.Vec3", @@ -12019,23 +12556,23 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 544 + "__id__": 575 }, "_children": [], "_active": true, "_components": [ { - "__id__": 546 + "__id__": 577 }, { - "__id__": 548 + "__id__": 579 }, { - "__id__": 550 + "__id__": 581 } ], "_prefab": { - "__id__": 552 + "__id__": 583 }, "_lpos": { "__type__": "cc.Vec3", @@ -12072,11 +12609,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 545 + "__id__": 576 }, "_enabled": true, "__prefab": { - "__id__": 547 + "__id__": 578 }, "_contentSize": { "__type__": "cc.Size", @@ -12100,11 +12637,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 545 + "__id__": 576 }, "_enabled": true, "__prefab": { - "__id__": 549 + "__id__": 580 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -12145,11 +12682,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 545 + "__id__": 576 }, "_enabled": true, "__prefab": { - "__id__": 551 + "__id__": 582 }, "_alignFlags": 45, "_target": null, @@ -12194,23 +12731,23 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 544 + "__id__": 575 }, "_children": [], "_active": true, "_components": [ { - "__id__": 554 + "__id__": 585 }, { - "__id__": 556 + "__id__": 587 }, { - "__id__": 558 + "__id__": 589 } ], "_prefab": { - "__id__": 560 + "__id__": 591 }, "_lpos": { "__type__": "cc.Vec3", @@ -12247,11 +12784,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 553 + "__id__": 584 }, "_enabled": true, "__prefab": { - "__id__": 555 + "__id__": 586 }, "_contentSize": { "__type__": "cc.Size", @@ -12275,11 +12812,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 553 + "__id__": 584 }, "_enabled": true, "__prefab": { - "__id__": 557 + "__id__": 588 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -12320,11 +12857,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 553 + "__id__": 584 }, "_enabled": true, "__prefab": { - "__id__": 559 + "__id__": 590 }, "_alignFlags": 45, "_target": null, @@ -12369,23 +12906,23 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 544 + "__id__": 575 }, "_children": [], "_active": true, "_components": [ { - "__id__": 562 + "__id__": 593 }, { - "__id__": 564 + "__id__": 595 }, { - "__id__": 566 + "__id__": 597 } ], "_prefab": { - "__id__": 568 + "__id__": 599 }, "_lpos": { "__type__": "cc.Vec3", @@ -12422,11 +12959,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 561 + "__id__": 592 }, "_enabled": true, "__prefab": { - "__id__": 563 + "__id__": 594 }, "_contentSize": { "__type__": "cc.Size", @@ -12450,11 +12987,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 561 + "__id__": 592 }, "_enabled": true, "__prefab": { - "__id__": 565 + "__id__": 596 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -12495,11 +13032,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 561 + "__id__": 592 }, "_enabled": true, "__prefab": { - "__id__": 567 + "__id__": 598 }, "_alignFlags": 45, "_target": null, @@ -12544,11 +13081,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 544 + "__id__": 575 }, "_enabled": true, "__prefab": { - "__id__": 570 + "__id__": 601 }, "_contentSize": { "__type__": "cc.Size", @@ -12585,11 +13122,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 463 + "__id__": 494 }, "_enabled": true, "__prefab": { - "__id__": 573 + "__id__": 604 }, "_contentSize": { "__type__": "cc.Size", @@ -12613,11 +13150,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 463 + "__id__": 494 }, "_enabled": true, "__prefab": { - "__id__": 575 + "__id__": 606 }, "_alignFlags": 45, "_target": null, @@ -12668,19 +13205,22 @@ "instance": null, "targetOverrides": [ { - "__id__": 578 + "__id__": 609 }, { - "__id__": 580 + "__id__": 611 }, { - "__id__": 582 + "__id__": 613 }, { - "__id__": 584 + "__id__": 615 } ], "nestedPrefabInstanceRoots": [ + { + "__id__": 418 + }, { "__id__": 383 }, @@ -12706,7 +13246,7 @@ "__id__": 27 }, "targetInfo": { - "__id__": 579 + "__id__": 610 } }, { @@ -12718,7 +13258,7 @@ { "__type__": "cc.TargetOverrideInfo", "source": { - "__id__": 421 + "__id__": 452 }, "sourceInfo": null, "propertyPath": [ @@ -12728,7 +13268,7 @@ "__id__": 27 }, "targetInfo": { - "__id__": 581 + "__id__": 612 } }, { @@ -12740,7 +13280,7 @@ { "__type__": "cc.TargetOverrideInfo", "source": { - "__id__": 421 + "__id__": 452 }, "sourceInfo": null, "propertyPath": [ @@ -12750,7 +13290,7 @@ "__id__": 27 }, "targetInfo": { - "__id__": 583 + "__id__": 614 } }, { @@ -12762,7 +13302,7 @@ { "__type__": "cc.TargetOverrideInfo", "source": { - "__id__": 421 + "__id__": 452 }, "sourceInfo": null, "propertyPath": [ @@ -12772,7 +13312,7 @@ "__id__": 383 }, "targetInfo": { - "__id__": 585 + "__id__": 616 } }, { diff --git a/assets/script/game/map/HeroBoxComp.ts b/assets/script/game/map/HeroBoxComp.ts index 648d63b3..f467d967 100644 --- a/assets/script/game/map/HeroBoxComp.ts +++ b/assets/script/game/map/HeroBoxComp.ts @@ -206,6 +206,24 @@ export class HeroBoxComp extends CCComp { const height = visible ? this.attrBoxHeightExpanded : this.attrBoxHeightCollapsed; transform.setContentSize(transform.width, height); } + // 切换更多按钮状态子节点:收起=n_* 激活,展开=a_* 激活 + this.setMoreBtnState(visible); + } + + /** + * 切换更多按钮的状态子节点。 + * 收起态激活 n_Bg / n_Arrow,展开态激活 a_Bg / a_Arrow。 + */ + private setMoreBtnState(expanded: boolean) { + if (!this.more_btn || !this.more_btn.isValid) return; + const nBg = this.more_btn.getChildByName("n_Bg"); + const nArrow = this.more_btn.getChildByName("n_Arrow"); + const aBg = this.more_btn.getChildByName("a_Bg"); + const aArrow = this.more_btn.getChildByName("a_Arrow"); + if (nBg) nBg.active = !expanded; + if (nArrow) nArrow.active = !expanded; + if (aBg) aBg.active = expanded; + if (aArrow) aArrow.active = expanded; } /** ECS 组件移除时销毁节点 */