From 106da584e851c0a4d05d678c8afc5663a9dce633 Mon Sep 17 00:00:00 2001 From: richarjiang Date: Wed, 6 May 2026 21:54:25 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E9=80=9A=E5=85=B3?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E8=BF=9B=E5=BA=A6=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/prefabs/PageHome.prefab | 16 +- assets/prefabs/PassModal.prefab | 870 ++++++++++++++++++++++++++++---- assets/prefabs/PassModal.ts | 93 +++- 3 files changed, 861 insertions(+), 118 deletions(-) diff --git a/assets/prefabs/PageHome.prefab b/assets/prefabs/PageHome.prefab index d0a7101..6588eb6 100644 --- a/assets/prefabs/PageHome.prefab +++ b/assets/prefabs/PageHome.prefab @@ -1441,7 +1441,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": 80.73400000000004, + "y": 67.20500000000004, "z": 0 }, "_lrot": { @@ -1850,11 +1850,11 @@ "__prefab": { "__id__": 78 }, - "_alignFlags": 4, + "_alignFlags": 1, "_target": null, "_left": 0, "_right": 0, - "_top": 733.9639999999999, + "_top": 720.295, "_bottom": 868.234, "_horizontalCenter": 0, "_verticalCenter": 0, @@ -1865,7 +1865,7 @@ "_isAbsHorizontalCenter": true, "_isAbsVerticalCenter": true, "_originalWidth": 0, - "_originalHeight": 0, + "_originalHeight": 650, "_alignMode": 2, "_lockFlags": 0, "_id": "" @@ -1883,8 +1883,6 @@ "__id__": 0 }, "fileId": "52Z4d22QhI1rhPunFg8yFm", - "instance": null, - "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -6187,11 +6185,11 @@ "__prefab": { "__id__": 256 }, - "_alignFlags": 4, + "_alignFlags": 1, "_target": null, "_left": 0, "_right": 0, - "_top": 0, + "_top": 1396.401, "_bottom": 663.5989999999999, "_horizontalCenter": 0, "_verticalCenter": 0, @@ -6202,7 +6200,7 @@ "_isAbsHorizontalCenter": true, "_isAbsVerticalCenter": true, "_originalWidth": 0, - "_originalHeight": 0, + "_originalHeight": 100, "_alignMode": 2, "_lockFlags": 0, "_id": "" diff --git a/assets/prefabs/PassModal.prefab b/assets/prefabs/PassModal.prefab index f66b261..6d83eb3 100644 --- a/assets/prefabs/PassModal.prefab +++ b/assets/prefabs/PassModal.prefab @@ -28,23 +28,23 @@ "__id__": 18 }, { - "__id__": 78 + "__id__": 106 } ], "_active": true, "_components": [ { - "__id__": 126 + "__id__": 154 }, { - "__id__": 128 + "__id__": 156 }, { - "__id__": 130 + "__id__": 158 } ], "_prefab": { - "__id__": 132 + "__id__": 160 }, "_lpos": { "__type__": "cc.Vec3", @@ -444,14 +444,14 @@ "_active": true, "_components": [ { - "__id__": 73 + "__id__": 101 }, { - "__id__": 75 + "__id__": 103 } ], "_prefab": { - "__id__": 77 + "__id__": 105 }, "_lpos": { "__type__": "cc.Vec3", @@ -641,16 +641,22 @@ }, { "__id__": 64 + }, + { + "__id__": 70 + }, + { + "__id__": 86 } ], "_active": true, "_components": [ { - "__id__": 70 + "__id__": 98 } ], "_prefab": { - "__id__": 72 + "__id__": 100 }, "_lpos": { "__type__": "cc.Vec3", @@ -1285,7 +1291,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": 0, + "x": -66.44, "y": -28.804, "z": 0 }, @@ -1298,8 +1304,8 @@ }, "_lscale": { "__type__": "cc.Vec3", - "x": 0.5, - "y": 0.5, + "x": 0.35, + "y": 0.35, "z": 1 }, "_mobility": 0, @@ -1335,7 +1341,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -469.666, + "x": -688.951, "y": 0, "z": 0 }, @@ -1376,7 +1382,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 185, + "width": 272, "height": 121 }, "_anchorPoint": { @@ -1462,7 +1468,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 966, + "width": 1400, "height": 164 }, "_anchorPoint": { @@ -1537,7 +1543,7 @@ "__id__": 54 }, "_mode": 0, - "_totalLength": 925, + "_totalLength": 1360, "_progress": 0.2, "_reverse": false, "_id": "" @@ -1721,6 +1727,675 @@ "targetOverrides": null, "nestedPrefabInstanceRoots": null }, + { + "__type__": "cc.Node", + "_name": "Stone", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 25 + }, + "_children": [ + { + "__id__": 71 + }, + { + "__id__": 77 + } + ], + "_active": true, + "_components": [ + { + "__id__": 83 + } + ], + "_prefab": { + "__id__": 85 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 247.432, + "y": -26.347, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "Bg", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 70 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 72 + }, + { + "__id__": 74 + } + ], + "_prefab": { + "__id__": 76 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 0.25, + "y": 0.25, + "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__": 71 + }, + "_enabled": true, + "__prefab": { + "__id__": 73 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 416, + "height": 416 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "e97px+fIBIdoJaQcTlpZQu" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 71 + }, + "_enabled": true, + "__prefab": { + "__id__": 75 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 186, + "g": 255, + "b": 177, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "7a17df33-9d28-4272-9f3e-f336af8d4afb@f9941", + "__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": "1dc7+UezhJCo4hZM7VTUU8" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "ffXfj0eOZEOIG/JkV2Flqs", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "Icon", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 70 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 78 + }, + { + "__id__": 80 + } + ], + "_prefab": { + "__id__": 82 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 0.2, + "y": 0.2, + "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__": 77 + }, + "_enabled": true, + "__prefab": { + "__id__": 79 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 392, + "height": 380 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "0b3YHvKeFMSYqIUk+aMCD5" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 77 + }, + "_enabled": true, + "__prefab": { + "__id__": 81 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "447f92b8-70aa-462a-8caa-b91321c8995b@f9941", + "__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": "c7cvKsIhJDvoOsZWG3YP+y" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "55r6W1hN9Mfpf0E4BujH5m", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 70 + }, + "_enabled": true, + "__prefab": { + "__id__": 84 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "5fI+ICzLRPV4AdIVcStmTm" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "47VYraV1ZAoqnPlsra1tgb", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "ProgressAnchor", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 25 + }, + "_children": [ + { + "__id__": 87 + } + ], + "_active": true, + "_components": [ + { + "__id__": 93 + }, + { + "__id__": 95 + } + ], + "_prefab": { + "__id__": 97 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -289.275, + "y": 32.114, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 0.648, + "y": 0.648, + "z": 0.648 + }, + "_mobility": 0, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "Label", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 86 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 88 + }, + { + "__id__": 90 + } + ], + "_prefab": { + "__id__": 92 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 10.454, + "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__": 87 + }, + "_enabled": true, + "__prefab": { + "__id__": 89 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 63.30078125, + "height": 44.1 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "a3VTAHYGFN8ZpCEcVc4ZUi" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 87 + }, + "_enabled": true, + "__prefab": { + "__id__": 91 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 78, + "g": 131, + "b": 108, + "a": 255 + }, + "_string": "35%", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 35, + "_fontSize": 35, + "_fontFamily": "Arial", + "_lineHeight": 35, + "_overflow": 0, + "_enableWrapText": true, + "_font": { + "__uuid__": "fb4acba6-6bc7-4eb3-be34-8f2ac9823a80", + "__expectedType__": "cc.TTFFont" + }, + "_isSystemFontUsed": false, + "_spacingX": 0, + "_isItalic": false, + "_isBold": false, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 0, + "_enableOutline": false, + "_outlineColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_outlineWidth": 2, + "_enableShadow": false, + "_shadowColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_shadowOffset": { + "__type__": "cc.Vec2", + "x": 2, + "y": 2 + }, + "_shadowBlur": 2, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "accdNVDxRFmbP3u8+QE8FF" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "70poeeqIZCbL8+lW5gi3Hy", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 86 + }, + "_enabled": true, + "__prefab": { + "__id__": 94 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 78 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "87KTx/901Hn4mR3Qao1UgK" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 86 + }, + "_enabled": true, + "__prefab": { + "__id__": 96 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 226, + "g": 255, + "b": 226, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "f620b7ac-7415-45e3-8dd1-4d351aaaef93@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 1, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "5e0/4GridGPag8dWvOXKqh" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "2e8c1/Jh1I3o533E3zNWO1", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, { "__type__": "cc.UITransform", "_name": "", @@ -1731,7 +2406,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 71 + "__id__": 99 }, "_contentSize": { "__type__": "cc.Size", @@ -1772,7 +2447,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 74 + "__id__": 102 }, "_contentSize": { "__type__": "cc.Size", @@ -1800,7 +2475,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 76 + "__id__": 104 }, "_alignFlags": 1, "_target": null, @@ -1849,23 +2524,23 @@ }, "_children": [ { - "__id__": 79 + "__id__": 107 }, { - "__id__": 99 + "__id__": 127 } ], "_active": true, "_components": [ { - "__id__": 121 + "__id__": 149 }, { - "__id__": 123 + "__id__": 151 } ], "_prefab": { - "__id__": 125 + "__id__": 153 }, "_lpos": { "__type__": "cc.Vec3", @@ -1902,30 +2577,30 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 78 + "__id__": 106 }, "_children": [ { - "__id__": 80 + "__id__": 108 }, { - "__id__": 86 + "__id__": 114 } ], "_active": true, "_components": [ { - "__id__": 92 + "__id__": 120 }, { - "__id__": 94 + "__id__": 122 }, { - "__id__": 96 + "__id__": 124 } ], "_prefab": { - "__id__": 98 + "__id__": 126 }, "_lpos": { "__type__": "cc.Vec3", @@ -1962,20 +2637,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 79 + "__id__": 107 }, "_children": [], "_active": true, "_components": [ { - "__id__": 81 + "__id__": 109 }, { - "__id__": 83 + "__id__": 111 } ], "_prefab": { - "__id__": 85 + "__id__": 113 }, "_lpos": { "__type__": "cc.Vec3", @@ -2012,11 +2687,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 80 + "__id__": 108 }, "_enabled": true, "__prefab": { - "__id__": 82 + "__id__": 110 }, "_contentSize": { "__type__": "cc.Size", @@ -2040,11 +2715,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 80 + "__id__": 108 }, "_enabled": true, "__prefab": { - "__id__": 84 + "__id__": 112 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -2124,20 +2799,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 79 + "__id__": 107 }, "_children": [], "_active": true, "_components": [ { - "__id__": 87 + "__id__": 115 }, { - "__id__": 89 + "__id__": 117 } ], "_prefab": { - "__id__": 91 + "__id__": 119 }, "_lpos": { "__type__": "cc.Vec3", @@ -2174,11 +2849,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 86 + "__id__": 114 }, "_enabled": true, "__prefab": { - "__id__": 88 + "__id__": 116 }, "_contentSize": { "__type__": "cc.Size", @@ -2202,11 +2877,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 86 + "__id__": 114 }, "_enabled": true, "__prefab": { - "__id__": 90 + "__id__": 118 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -2260,11 +2935,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 79 + "__id__": 107 }, "_enabled": true, "__prefab": { - "__id__": 93 + "__id__": 121 }, "_contentSize": { "__type__": "cc.Size", @@ -2288,11 +2963,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 79 + "__id__": 107 }, "_enabled": true, "__prefab": { - "__id__": 95 + "__id__": 123 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -2333,11 +3008,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 79 + "__id__": 107 }, "_enabled": true, "__prefab": { - "__id__": 97 + "__id__": 125 }, "clickEvents": [], "_interactable": true, @@ -2402,33 +3077,33 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 78 + "__id__": 106 }, "_children": [ { - "__id__": 100 + "__id__": 128 }, { - "__id__": 106 + "__id__": 134 } ], "_active": true, "_components": [ { - "__id__": 112 + "__id__": 140 }, { - "__id__": 114 + "__id__": 142 }, { - "__id__": 116 + "__id__": 144 }, { - "__id__": 118 + "__id__": 146 } ], "_prefab": { - "__id__": 120 + "__id__": 148 }, "_lpos": { "__type__": "cc.Vec3", @@ -2465,20 +3140,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 99 + "__id__": 127 }, "_children": [], "_active": true, "_components": [ { - "__id__": 101 + "__id__": 129 }, { - "__id__": 103 + "__id__": 131 } ], "_prefab": { - "__id__": 105 + "__id__": 133 }, "_lpos": { "__type__": "cc.Vec3", @@ -2515,11 +3190,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 100 + "__id__": 128 }, "_enabled": true, "__prefab": { - "__id__": 102 + "__id__": 130 }, "_contentSize": { "__type__": "cc.Size", @@ -2543,11 +3218,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 100 + "__id__": 128 }, "_enabled": true, "__prefab": { - "__id__": 104 + "__id__": 132 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -2627,20 +3302,20 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 99 + "__id__": 127 }, "_children": [], "_active": true, "_components": [ { - "__id__": 107 + "__id__": 135 }, { - "__id__": 109 + "__id__": 137 } ], "_prefab": { - "__id__": 111 + "__id__": 139 }, "_lpos": { "__type__": "cc.Vec3", @@ -2677,11 +3352,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 106 + "__id__": 134 }, "_enabled": true, "__prefab": { - "__id__": 108 + "__id__": 136 }, "_contentSize": { "__type__": "cc.Size", @@ -2705,11 +3380,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 106 + "__id__": 134 }, "_enabled": true, "__prefab": { - "__id__": 110 + "__id__": 138 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -2763,11 +3438,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 99 + "__id__": 127 }, "_enabled": true, "__prefab": { - "__id__": 113 + "__id__": 141 }, "_contentSize": { "__type__": "cc.Size", @@ -2791,11 +3466,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 99 + "__id__": 127 }, "_enabled": true, "__prefab": { - "__id__": 115 + "__id__": 143 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -2836,11 +3511,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 99 + "__id__": 127 }, "_enabled": true, "__prefab": { - "__id__": 117 + "__id__": 145 }, "clickEvents": [], "_interactable": true, @@ -2892,11 +3567,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 99 + "__id__": 127 }, "_enabled": true, "__prefab": { - "__id__": 119 + "__id__": 147 }, "_alignFlags": 4, "_target": null, @@ -2941,11 +3616,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 78 + "__id__": 106 }, "_enabled": true, "__prefab": { - "__id__": 122 + "__id__": 150 }, "_contentSize": { "__type__": "cc.Size", @@ -2969,11 +3644,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 78 + "__id__": 106 }, "_enabled": true, "__prefab": { - "__id__": 124 + "__id__": 152 }, "_alignFlags": 4, "_target": null, @@ -3022,7 +3697,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 127 + "__id__": 155 }, "_contentSize": { "__type__": "cc.Size", @@ -3050,7 +3725,7 @@ }, "_enabled": false, "__prefab": { - "__id__": 129 + "__id__": 157 }, "_alignFlags": 45, "_target": null, @@ -3086,7 +3761,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 131 + "__id__": 159 }, "animationNodes": [ { @@ -3096,7 +3771,7 @@ "__id__": 18 }, { - "__id__": 78 + "__id__": 106 } ], "backdropNode": { @@ -3105,10 +3780,10 @@ "openAnimationEnabled": true, "openAnimationDuration": 0.36, "nextLevelButton": { - "__id__": 79 + "__id__": 107 }, "shareButton": { - "__id__": 99 + "__id__": 127 }, "titleLevelLabel": { "__id__": 47 @@ -3119,6 +3794,9 @@ "progressLabel": { "__id__": 67 }, + "progressAnchor": { + "__id__": 86 + }, "successAudio": { "__uuid__": "45d1f0b7-d9d7-41d8-84b2-7abad9304148", "__expectedType__": "cc.AudioClip" diff --git a/assets/prefabs/PassModal.ts b/assets/prefabs/PassModal.ts index c051e7c..2b388b9 100644 --- a/assets/prefabs/PassModal.ts +++ b/assets/prefabs/PassModal.ts @@ -59,6 +59,10 @@ export class PassModal extends BaseModal { @property(Label) progressLabel: Label | null = null; + /** 称号进度游标 */ + @property(Node) + progressAnchor: Node | null = null; + /** 通关音效 */ @property(AudioClip) successAudio: AudioClip | null = null; @@ -89,6 +93,9 @@ export class PassModal extends BaseModal { /** 进度动画所绑定的对象,用于 Tween.stopAllByTarget */ private readonly _progressTweenTarget: { progress: number } = { progress: 0 }; + /** 进度游标 0% 时的本地 X 坐标,使用 prefab 当前摆放位置作为起点 */ + private _progressAnchorStartX: number | null = null; + setParams(params: PassModalParams): void { super.setParams(params); @@ -125,6 +132,8 @@ export class PassModal extends BaseModal { */ onViewLoad(): void { console.log('[PassModal] onViewLoad'); + this._resolveProgressAnchor(); + this._cacheProgressAnchorStartX(); this._bindButtonEvents(); } @@ -234,9 +243,11 @@ export class PassModal extends BaseModal { } private _applyProgressValue(progress: number | undefined): void { - if (this.titleProgressBar && progress !== undefined) { - this.titleProgressBar.progress = this._normalizeProgress(progress); + if (progress === undefined) { + return; } + + this._applyAnimatedProgress(progress); } /** @@ -292,9 +303,7 @@ export class PassModal extends BaseModal { const clampedEnd = Math.max(0, Math.min(1, endProgress)); const onUpdate = () => { - if (self.titleProgressBar?.isValid) { - self.titleProgressBar.progress = self._normalizeProgress(tweenTarget.progress); - } + self._applyAnimatedProgress(tweenTarget.progress); }; tween(tweenTarget) @@ -309,9 +318,7 @@ export class PassModal extends BaseModal { self._applyTitleText(self._titleInfo.titleText); self._applyProgressText(self._titleInfo.progressText); tweenTarget.progress = 0; - if (self.titleProgressBar?.isValid) { - self.titleProgressBar.progress = self._normalizeProgress(0); - } + self._applyAnimatedProgress(0); }) .delay(PassModal.PROGRESS_ANIM_LEVELUP_PAUSE) .to( @@ -329,8 +336,8 @@ export class PassModal extends BaseModal { const tweenTarget = this._progressTweenTarget; // raw 值保留 0~1 区间,onUpdate 里经 _normalizeProgress 再下发,避免畸变区段 - tweenTarget.progress = Math.max(0, Math.min(1, from)); - this.titleProgressBar.progress = this._normalizeProgress(from); + tweenTarget.progress = this._clampProgress(from); + this._applyAnimatedProgress(from); const self = this; const chain = tween(tweenTarget); @@ -345,15 +352,67 @@ export class PassModal extends BaseModal { { easing: 'sineOut', onUpdate: () => { - if (self.titleProgressBar?.isValid) { - self.titleProgressBar.progress = self._normalizeProgress(tweenTarget.progress); - } + self._applyAnimatedProgress(tweenTarget.progress); } } ) .start(); } + private _cacheProgressAnchorStartX(): void { + if (this._progressAnchorStartX !== null || !this.progressAnchor) { + return; + } + + this._progressAnchorStartX = this.progressAnchor.position.x; + } + + private _resolveProgressAnchor(): void { + if (this.progressAnchor?.isValid) { + return; + } + + this.progressAnchor = this.node + .getChildByName('Bg') + ?.getChildByName('Title') + ?.getChildByName('ProgressAnchor') ?? null; + } + + private _applyAnimatedProgress(progress: number): void { + const clampedProgress = this._clampProgress(progress); + + if (this.titleProgressBar?.isValid) { + this.titleProgressBar.progress = this._normalizeProgress(clampedProgress); + } + + this._updateProgressAnchor(clampedProgress); + } + + private _updateProgressAnchor(progress: number): void { + if (!this.progressAnchor?.isValid) { + return; + } + + this._cacheProgressAnchorStartX(); + + const startX = this._progressAnchorStartX ?? this.progressAnchor.position.x; + const travelWidth = this._getProgressAnchorTravelWidth(); + this.progressAnchor.setPosition(startX + travelWidth * progress, this.progressAnchor.position.y, this.progressAnchor.position.z); + + const percentLabel = this.progressAnchor.getChildByName('Label')?.getComponent(Label); + if (percentLabel) { + percentLabel.string = `${Math.round(progress * 100)}%`; + } + } + + private _getProgressAnchorTravelWidth(): number { + if (!this.titleProgressBar) { + return 0; + } + + return Math.abs(this.titleProgressBar.totalLength * this.titleProgressBar.node.scale.x); + } + private _stopProgressAnimation(): void { Tween.stopAllByTarget(this._progressTweenTarget); } @@ -372,6 +431,14 @@ export class PassModal extends BaseModal { return Math.max(MIN_PROGRESS, Math.min(1, progress)); } + private _clampProgress(progress: number): number { + if (!Number.isFinite(progress) || progress <= 0) { + return 0; + } + + return Math.min(1, progress); + } + /** * 下一关按钮点击 */