diff --git a/assets/main.scene b/assets/main.scene index f97be43..70c1ee2 100644 --- a/assets/main.scene +++ b/assets/main.scene @@ -478,6 +478,10 @@ "__uuid__": "3b33c592-ea62-4449-84ed-bf72416d7457", "__expectedType__": "cc.Prefab" }, + "pagePreviewLevelsPrefab": { + "__uuid__": "4e73abff-cd5a-42dd-bdfd-34c55645f6ea", + "__expectedType__": "cc.Prefab" + }, "toastPrefab": { "__uuid__": "cff2809d-6daa-4749-a911-bb99e97b4b54", "__expectedType__": "cc.Prefab" diff --git a/assets/main.ts b/assets/main.ts index c3e7188..30e0f84 100644 --- a/assets/main.ts +++ b/assets/main.ts @@ -18,6 +18,9 @@ export class main extends Component { @property({ type: Prefab, tooltip: '写关卡页面预制体' }) pageWriteLevelsPrefab: Prefab | null = null; + @property({ type: Prefab, tooltip: '预览试卷页面预制体' }) + pagePreviewLevelsPrefab: Prefab | null = null; + @property({ type: Prefab, tooltip: 'Toast 预制体' }) toastPrefab: Prefab | null = null; @@ -61,6 +64,14 @@ export class main extends Component { }); } + if (this.pagePreviewLevelsPrefab) { + ViewManager.instance.register('PagePreviewLevels', { + prefab: this.pagePreviewLevelsPrefab, + cache: true, + zIndex: 3 + }); + } + // 初始化 Toast 管理器 if (this.toastPrefab) { ToastManager.instance.init(this.toastPrefab, this.node); diff --git a/assets/prefabs/PagePreviewLevels.prefab b/assets/prefabs/PagePreviewLevels.prefab new file mode 100644 index 0000000..1bdba4d --- /dev/null +++ b/assets/prefabs/PagePreviewLevels.prefab @@ -0,0 +1,2700 @@ +[ + { + "__type__": "cc.Prefab", + "_name": "PagePreviewLevels", + "_objFlags": 0, + "__editorExtras__": {}, + "_native": "", + "data": { + "__id__": 1 + }, + "optimizationPolicy": 0, + "persistent": false + }, + { + "__type__": "cc.Node", + "_name": "PagePreviewLevels", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": null, + "_children": [ + { + "__id__": 2 + }, + { + "__id__": 10 + }, + { + "__id__": 20 + }, + { + "__id__": 28 + }, + { + "__id__": 64 + }, + { + "__id__": 96 + } + ], + "_active": true, + "_components": [ + { + "__id__": 110 + }, + { + "__id__": 112 + } + ], + "_prefab": { + "__id__": 114 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "Bg", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 3 + }, + { + "__id__": 5 + }, + { + "__id__": 7 + } + ], + "_prefab": { + "__id__": 9 + }, + "_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__": 2 + }, + "_enabled": true, + "__prefab": { + "__id__": 4 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1080, + "height": 2160 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "53yqiKjGpBMpB+zFUcgMqd" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": { + "__id__": 6 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "d532045e-55f8-47c2-9493-b918e18364b0@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_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": "c0tci7dVRBvLvhdTSGwwaj" + }, + { + "__type__": "d33b0ZrKQJEaKZYN2Peg+C/", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": { + "__id__": 8 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "79PpsO+yRP5bxMY6jH6uvU" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "6dBmbb1wNKJbTWR+1pa+y2", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "IconBack", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 11 + }, + { + "__id__": 13 + }, + { + "__id__": 15 + }, + { + "__id__": 17 + } + ], + "_prefab": { + "__id__": 19 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -410.938, + "y": 942.514, + "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__": 10 + }, + "_enabled": true, + "__prefab": { + "__id__": 12 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 108, + "height": 108 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "74C+oVkAVF+qP0KmO0vO9s" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 10 + }, + "_enabled": true, + "__prefab": { + "__id__": 14 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "9c27734d-854f-476b-961d-d1b92c75f8c0@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": "50F2n9/idMcb4kNVxsjCrO" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 10 + }, + "_enabled": true, + "__prefab": { + "__id__": 16 + }, + "_alignFlags": 9, + "_target": null, + "_left": -414.938, + "_right": 0, + "_top": -946.514, + "_bottom": 0, + "_horizontalCenter": 0, + "_verticalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_alignMode": 2, + "_lockFlags": 0, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "aeoBSE1olAMZgVzcdHBpmS" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 10 + }, + "_enabled": true, + "__prefab": { + "__id__": 18 + }, + "clickEvents": [], + "_interactable": true, + "_transition": 0, + "_normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_hoverColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "a": 255 + }, + "_pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_disabledColor": { + "__type__": "cc.Color", + "r": 124, + "g": 124, + "b": 124, + "a": 255 + }, + "_normalSprite": null, + "_hoverSprite": null, + "_pressedSprite": null, + "_disabledSprite": null, + "_duration": 0.1, + "_zoomScale": 1.2, + "_target": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "82tUBmfqVOgJCAwJwK5EDe" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "ac1NMltcFCHYLwVCCxc8qC", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "PKTitle", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 21 + }, + { + "__id__": 23 + }, + { + "__id__": 25 + } + ], + "_prefab": { + "__id__": 27 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 926.043, + "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__": 20 + }, + "_enabled": true, + "__prefab": { + "__id__": 22 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 120, + "height": 75.6 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "c5ghOAcp1ECbkMMsrPPkVp" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 20 + }, + "_enabled": true, + "__prefab": { + "__id__": 24 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 2, + "g": 0, + "b": 0, + "a": 255 + }, + "_string": "挑战", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 60, + "_fontSize": 60, + "_fontFamily": "Arial", + "_lineHeight": 60, + "_overflow": 0, + "_enableWrapText": true, + "_font": null, + "_isSystemFontUsed": true, + "_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": "0eoveggdVC3ZCwVHz5eWft" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 20 + }, + "_enabled": true, + "__prefab": { + "__id__": 26 + }, + "_alignFlags": 0, + "_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": 0, + "_originalHeight": 0, + "_alignMode": 2, + "_lockFlags": 0, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "4c978YnaJIVILderK2iuF+" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "10pKg+ShxGcaRs2ZOkD8zw", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "ScrollView", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 29 + }, + { + "__id__": 47 + } + ], + "_active": true, + "_components": [ + { + "__id__": 59 + }, + { + "__id__": 61 + }, + { + "__id__": 44 + } + ], + "_prefab": { + "__id__": 63 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "scrollBar", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 28 + }, + "_children": [ + { + "__id__": 30 + } + ], + "_active": true, + "_components": [ + { + "__id__": 36 + }, + { + "__id__": 38 + }, + { + "__id__": 40 + }, + { + "__id__": 42 + } + ], + "_prefab": { + "__id__": 58 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 480, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "bar", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 29 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 31 + }, + { + "__id__": 33 + } + ], + "_prefab": { + "__id__": 35 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -11, + "y": -31.25, + "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__": 30 + }, + "_enabled": true, + "__prefab": { + "__id__": 32 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 10, + "height": 156.25 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "82nLNlfqVJAYMTl1a6YEex" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 30 + }, + "_enabled": true, + "__prefab": { + "__id__": 34 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "afc47931-f066-46b0-90be-9fe61f213428@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": "f2zfcTJ8JGKoudnJuOdDQG" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "7ftQxXd7lA37wFTPELK1m6", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 29 + }, + "_enabled": true, + "__prefab": { + "__id__": 37 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 12, + "height": 1650 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 1, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "69UaCd35VHhresQBUsKm0V" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 29 + }, + "_enabled": true, + "__prefab": { + "__id__": 39 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "ffb88a8f-af62-48f4-8f1d-3cb606443a43@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": "9dHOrcDpxJdZRc4LhNpRGw" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 29 + }, + "_enabled": true, + "__prefab": { + "__id__": 41 + }, + "_alignFlags": 37, + "_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": 0, + "_originalHeight": 250, + "_alignMode": 1, + "_lockFlags": 0, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "a6DbNylwpKorG5o7c1jwTG" + }, + { + "__type__": "cc.ScrollBar", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 29 + }, + "_enabled": true, + "__prefab": { + "__id__": 43 + }, + "_scrollView": { + "__id__": 44 + }, + "_handle": { + "__id__": 33 + }, + "_direction": 1, + "_enableAutoHide": false, + "_autoHideTime": 1, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "3cFd3mpJBPMIGof6V21VXf" + }, + { + "__type__": "cc.ScrollView", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 28 + }, + "_enabled": true, + "__prefab": { + "__id__": 45 + }, + "bounceDuration": 0.23, + "brake": 0.75, + "elastic": true, + "inertia": true, + "horizontal": false, + "vertical": true, + "cancelInnerEvents": true, + "scrollEvents": [], + "_content": { + "__id__": 46 + }, + "_horizontalScrollBar": null, + "_verticalScrollBar": { + "__id__": 42 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "41CkPWTalMl7449CGStmHY" + }, + { + "__type__": "cc.Node", + "_name": "content", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 47 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 55 + } + ], + "_prefab": { + "__id__": 57 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -10, + "y": 125, + "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": "view", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 28 + }, + "_children": [ + { + "__id__": 46 + } + ], + "_active": true, + "_components": [ + { + "__id__": 48 + }, + { + "__id__": 50 + }, + { + "__id__": 52 + } + ], + "_prefab": { + "__id__": 54 + }, + "_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__": 47 + }, + "_enabled": true, + "__prefab": { + "__id__": 49 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 960, + "height": 1650 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "106gjlARROkocJeCULY4zK" + }, + { + "__type__": "cc.Mask", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 47 + }, + "_enabled": true, + "__prefab": { + "__id__": 51 + }, + "_type": 0, + "_inverted": false, + "_segments": 64, + "_alphaThreshold": 0.1, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "2652jdoURPvqEMSmihM89c" + }, + { + "__type__": "cc.Graphics", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 47 + }, + "_enabled": true, + "__prefab": { + "__id__": 53 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_lineWidth": 1, + "_strokeColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_lineJoin": 2, + "_lineCap": 0, + "_fillColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 0 + }, + "_miterLimit": 10, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "ddjXcH2mlFp6Dbyy1C1s1u" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "28LEGbpJFA640TMIApPWDv", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 46 + }, + "_enabled": true, + "__prefab": { + "__id__": 56 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 960, + "height": 400 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 1 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "7e2pFLSzhJeI3ZY2CoShfk" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "401qq2/stPI7HDaiqf9nOB", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "9ckkYwTvdGb62G7GzNM/E6", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 28 + }, + "_enabled": true, + "__prefab": { + "__id__": 60 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 960, + "height": 1650 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "e2OiFZRCNMt6ObBhzhZBVM" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 28 + }, + "_enabled": false, + "__prefab": { + "__id__": 62 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "b730527c-3233-41c2-aaf7-7cdab58f9749@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": "f8n6toWwZDHptPD20aKZka" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "9ao62uyHxFk4Fds2UE9uDX", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "ListTpl", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 65 + }, + { + "__id__": 71 + }, + { + "__id__": 77 + }, + { + "__id__": 83 + } + ], + "_active": true, + "_components": [ + { + "__id__": 89 + }, + { + "__id__": 91 + }, + { + "__id__": 93 + } + ], + "_prefab": { + "__id__": 95 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -1047.016, + "y": 660.746, + "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": "LevelCover", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 64 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 66 + }, + { + "__id__": 68 + } + ], + "_prefab": { + "__id__": 70 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -237.601, + "y": 1.509, + "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__": 65 + }, + "_enabled": true, + "__prefab": { + "__id__": 67 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 200, + "height": 200 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "7a4E5BFyxMrZ0VWGER3XGr" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 65 + }, + "_enabled": true, + "__prefab": { + "__id__": 69 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": null, + "_type": 0, + "_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": "ffCtkO2HxPuqBqUvyomxU9" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "77fkixQ8tDsa4zu8G9d1yM", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "Tips1", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 64 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 72 + }, + { + "__id__": 74 + } + ], + "_prefab": { + "__id__": 76 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 74.813, + "y": 74.721, + "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__": 71 + }, + "_enabled": true, + "__prefab": { + "__id__": 73 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 85.01953125, + "height": 50.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "24M8EvZX9JnYDDPyi/g2uA" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 71 + }, + "_enabled": true, + "__prefab": { + "__id__": 75 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 219, + "g": 133, + "b": 54, + "a": 255 + }, + "_string": "提示 1", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 30, + "_fontSize": 30, + "_fontFamily": "Arial", + "_lineHeight": 40, + "_overflow": 0, + "_enableWrapText": false, + "_font": null, + "_isSystemFontUsed": true, + "_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": "1cITvT9CpCQ4BSe8xQ1jT/" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "0dzVPu7N1ODbfcTjssS0Qc", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "Tips2", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 64 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 78 + }, + { + "__id__": 80 + } + ], + "_prefab": { + "__id__": 82 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 74.813, + "y": 14.526, + "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__": 77 + }, + "_enabled": true, + "__prefab": { + "__id__": 79 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 85.01953125, + "height": 50.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "e3mvNJvTZCCJrej2KcHeIV" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 77 + }, + "_enabled": true, + "__prefab": { + "__id__": 81 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 219, + "g": 133, + "b": 54, + "a": 255 + }, + "_string": "提示 2", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 30, + "_fontSize": 30, + "_fontFamily": "Arial", + "_lineHeight": 40, + "_overflow": 0, + "_enableWrapText": false, + "_font": null, + "_isSystemFontUsed": true, + "_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": "abugfc6ABEVafG0lUSnEyd" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "73DNQUFGBAZK5N8cYRPa20", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "Answer", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 64 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 84 + }, + { + "__id__": 86 + } + ], + "_prefab": { + "__id__": 88 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 74.813, + "y": -60.718, + "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__": 83 + }, + "_enabled": true, + "__prefab": { + "__id__": 85 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 80, + "height": 50.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "df6SUXN8NFhJOASSjxnLTi" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 83 + }, + "_enabled": true, + "__prefab": { + "__id__": 87 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 219, + "g": 133, + "b": 54, + "a": 255 + }, + "_string": "答案", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 40, + "_fontSize": 40, + "_fontFamily": "Arial", + "_lineHeight": 40, + "_overflow": 0, + "_enableWrapText": false, + "_font": null, + "_isSystemFontUsed": true, + "_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": "6bkzMP6B5Bea4dYljKBhEX" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "18qnS+AYVLiIVSKTZ3hS9s", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 64 + }, + "_enabled": true, + "__prefab": { + "__id__": 90 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 800, + "height": 300 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "b3nlYV2HdDFpLnVxw3YtMV" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 64 + }, + "_enabled": true, + "__prefab": { + "__id__": 92 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 243, + "g": 225, + "b": 222, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "7d8f9b89-4fd1-4c9f-a3ab-38ec7cded7ca@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_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": "69vNFRzsRO2r+s1ePspkyp" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 64 + }, + "_enabled": true, + "__prefab": { + "__id__": 94 + }, + "clickEvents": [], + "_interactable": true, + "_transition": 0, + "_normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_hoverColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "a": 255 + }, + "_pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_disabledColor": { + "__type__": "cc.Color", + "r": 124, + "g": 124, + "b": 124, + "a": 255 + }, + "_normalSprite": null, + "_hoverSprite": null, + "_pressedSprite": null, + "_disabledSprite": null, + "_duration": 0.1, + "_zoomScale": 1.2, + "_target": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "00XHdx8z5Cu7Eu9UXmyV/F" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "b34mWMqo5FlrJeymITyURt", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "BackButton", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 97 + } + ], + "_active": true, + "_components": [ + { + "__id__": 103 + }, + { + "__id__": 105 + }, + { + "__id__": 107 + } + ], + "_prefab": { + "__id__": 109 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": -892.368, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "Label", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 96 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 98 + }, + { + "__id__": 100 + } + ], + "_prefab": { + "__id__": 102 + }, + "_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__": 97 + }, + "_enabled": true, + "__prefab": { + "__id__": 99 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 120, + "height": 75.6 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "e3LbxK42JF6Jg1NbzKpc8t" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 97 + }, + "_enabled": true, + "__prefab": { + "__id__": 101 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_string": "返回", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 60, + "_fontSize": 60, + "_fontFamily": "Arial", + "_lineHeight": 60, + "_overflow": 0, + "_enableWrapText": true, + "_font": null, + "_isSystemFontUsed": true, + "_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": "ea82axleJB2Iv2NbMe48i5" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "97ZJtjF8JCNIoLwu41mpbe", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 96 + }, + "_enabled": true, + "__prefab": { + "__id__": 104 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 800, + "height": 200 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "dd+zkEHa5PRIvXz4t40xcM" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 96 + }, + "_enabled": true, + "__prefab": { + "__id__": 106 + }, + "clickEvents": [], + "_interactable": true, + "_transition": 3, + "_normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_hoverColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "a": 255 + }, + "_pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_disabledColor": { + "__type__": "cc.Color", + "r": 124, + "g": 124, + "b": 124, + "a": 255 + }, + "_normalSprite": null, + "_hoverSprite": null, + "_pressedSprite": null, + "_disabledSprite": null, + "_duration": 0.1, + "_zoomScale": 1.2, + "_target": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "c7Qa9uhcxPLIysIccGhXSp" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 96 + }, + "_enabled": true, + "__prefab": { + "__id__": 108 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 21, + "g": 228, + "b": 21, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "7d8f9b89-4fd1-4c9f-a3ab-38ec7cded7ca@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_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": "25UQT+hdpE664yrnDJOZfq" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "1aVRLSE2dBq5hPoM3kNcEs", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 111 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "f8Abjzw6JHHZ9tLJK/WsCf" + }, + { + "__type__": "507c2Nb5EdEKKyl2lVVCGCg", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 113 + }, + "backBtn": { + "__id__": 10 + }, + "scrollView": { + "__id__": 28 + }, + "listContent": { + "__id__": 46 + }, + "listTemplate": { + "__id__": 64 + }, + "backButton": { + "__id__": 96 + }, + "pkTitle": { + "__id__": 20 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "adGFh4+EFES7DyboGrG5Gv" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "c46/YsCPVOJYA4mWEpNYRx", + "instance": null, + "targetOverrides": null + } +] \ No newline at end of file diff --git a/assets/prefabs/PagePreviewLevels.prefab.meta b/assets/prefabs/PagePreviewLevels.prefab.meta new file mode 100644 index 0000000..65d1a9f --- /dev/null +++ b/assets/prefabs/PagePreviewLevels.prefab.meta @@ -0,0 +1,13 @@ +{ + "ver": "1.1.50", + "importer": "prefab", + "imported": true, + "uuid": "4e73abff-cd5a-42dd-bdfd-34c55645f6ea", + "files": [ + ".json" + ], + "subMetas": {}, + "userData": { + "syncNodeName": "PagePreviewLevels" + } +} diff --git a/assets/prefabs/PagePreviewLevels.ts b/assets/prefabs/PagePreviewLevels.ts new file mode 100644 index 0000000..4cd677a --- /dev/null +++ b/assets/prefabs/PagePreviewLevels.ts @@ -0,0 +1,246 @@ +import { _decorator, Node, Button, Sprite, Label, ScrollView, instantiate, UITransform, Vec2 } from 'cc'; +import { BaseView } from 'db://assets/scripts/core/BaseView'; +import { ViewManager } from 'db://assets/scripts/core/ViewManager'; +import { LevelDataManager } from 'db://assets/scripts/utils/LevelDataManager'; +const { ccclass, property } = _decorator; + +/** + * 预览试卷页面 + * 垂直滚动展示用户在 PageWriteLevels 中选中的 6 个关卡 + * 每个关卡展示:封面图、提示1、提示2、答案 + * + * prefab 节点结构(已在编辑器中搭建): + * PagePreviewLevels + * ├── Bg + * ├── IconBack ← backBtn (返回按钮) + * ├── PKTitle ← 标题 "挑战" + * ├── ScrollView ← scrollView + * │ ├── scrollBar + * │ └── view + * │ └── content ← listContent + * ├── ListTpl ← listTemplate (关卡模板) + * │ ├── LevelCover ← Sprite 封面图 + * │ ├── Tips1 ← Label 提示1 + * │ ├── Tips2 ← Label 提示2 + * │ └── Answer ← Label 答案 + * └── BackButton ← backButton (底部返回按钮) + */ + +/** 布局配置 — 垂直列表 */ +const LAYOUT = { + /** 关卡项高度(与 ListTpl UITransform 高度一致) */ + ITEM_HEIGHT: 300, + /** 关卡项之间的垂直间距 */ + SPACING_Y: 30, + /** 列表顶部内边距 */ + PADDING_TOP: 20, +}; + +@ccclass('PagePreviewLevels') +export class PagePreviewLevels extends BaseView { + @property({ type: Node, tooltip: '返回按钮(左上角)' }) + backBtn: Node | null = null; + + @property({ type: Node, tooltip: 'ScrollView 节点' }) + scrollView: Node | null = null; + + @property({ type: Node, tooltip: '列表 content 节点' }) + listContent: Node | null = null; + + @property({ type: Node, tooltip: '关卡模板节点' }) + listTemplate: Node | null = null; + + @property({ type: Node, tooltip: '底部返回按钮' }) + backButton: Node | null = null; + + @property({ type: Node, tooltip: '标题Label节点' }) + pkTitle: Node | null = null; + + /** 已创建的 item 节点列表 */ + private _itemNodes: Node[] = []; + + // ─── 生命周期 ─────────────────────────────────────── + + onViewLoad(): void { + console.log('[PagePreviewLevels] onViewLoad'); + this._initButtons(); + this._initScrollView(); + } + + onViewShow(): void { + console.log('[PagePreviewLevels] onViewShow'); + this._buildList(); + } + + onViewHide(): void { + console.log('[PagePreviewLevels] onViewHide'); + } + + onViewDestroy(): void { + console.log('[PagePreviewLevels] onViewDestroy'); + this._offButtons(); + this._clearList(); + } + + // ─── 初始化 ───────────────────────────────────────── + + private _initButtons(): void { + if (this.backBtn) { + this.backBtn.on(Button.EventType.CLICK, this._onBackClick, this); + } + if (this.backButton) { + this.backButton.on(Button.EventType.CLICK, this._onBackClick, this); + } + } + + private _offButtons(): void { + if (this.backBtn) { + this.backBtn.off(Button.EventType.CLICK, this._onBackClick, this); + } + if (this.backButton) { + this.backButton.off(Button.EventType.CLICK, this._onBackClick, this); + } + } + + private _initScrollView(): void { + if (!this.listContent) return; + const contentTransform = this.listContent.getComponent(UITransform); + if (contentTransform) { + contentTransform.setAnchorPoint(0.5, 1); + } + } + + // ─── 列表构建 ─────────────────────────────────────── + + private _buildList(): void { + this._clearList(); + + const params = this.getParams(); + if (!params || !params.selectedIndices || params.selectedIndices.length === 0) { + console.warn('[PagePreviewLevels] 未传入选中关卡数据'); + return; + } + + // 显示用户输入的标题 + if (this.pkTitle) { + const label = this.pkTitle.getComponent(Label); + if (label) { + label.string = params.shareTitle || '挑战'; + } + } + + const indices: number[] = params.selectedIndices; + console.log('[PagePreviewLevels] 选中关卡索引:', indices); + + // 更新 content 高度 + this._updateContentSize(indices.length); + + // 创建每个关卡 item + for (let i = 0; i < indices.length; i++) { + const levelIndex = indices[i]; + const itemNode = this._createItem(i); + if (itemNode) { + this.listContent!.addChild(itemNode); + this._itemNodes.push(itemNode); + this._loadLevelData(itemNode, levelIndex, i); + } + } + + // 滚动到顶部 + const scrollComp = this.scrollView?.getComponent(ScrollView); + if (scrollComp) { + scrollComp.scrollToTop(0); + } + } + + private _clearList(): void { + for (const node of this._itemNodes) { + if (node && node.isValid) { + node.destroy(); + } + } + this._itemNodes = []; + } + + private _updateContentSize(count: number): void { + if (!this.listContent) return; + const contentTransform = this.listContent.getComponent(UITransform); + if (!contentTransform) return; + + const totalHeight = LAYOUT.PADDING_TOP + + count * LAYOUT.ITEM_HEIGHT + + (count > 0 ? (count - 1) * LAYOUT.SPACING_Y : 0) + + LAYOUT.PADDING_TOP; + + contentTransform.setContentSize(contentTransform.contentSize.width, totalHeight); + } + + /** + * 创建单个关卡展示项 + * content anchor=(0.5, 1),y 轴负向下 + */ + private _createItem(displayIndex: number): Node | null { + if (!this.listTemplate) return null; + + const item = instantiate(this.listTemplate); + item.active = true; + item.name = `preview_item_${displayIndex}`; + + // 垂直居中排列:x=0(水平居中于 content),y 负向下 + const y = -(LAYOUT.PADDING_TOP + displayIndex * (LAYOUT.ITEM_HEIGHT + LAYOUT.SPACING_Y) + LAYOUT.ITEM_HEIGHT / 2); + item.setPosition(0, y, 0); + + return item; + } + + /** + * 异步加载关卡数据并填充到 item 节点 + */ + private async _loadLevelData(item: Node, levelIndex: number, displayIndex: number): Promise { + const config = await LevelDataManager.instance.ensureLevelReady(levelIndex); + if (!config || !item.isValid) return; + + // 填充封面图 + const levelCover = item.getChildByName('LevelCover'); + if (levelCover) { + const sprite = levelCover.getComponent(Sprite); + if (sprite && config.spriteFrame) { + sprite.spriteFrame = config.spriteFrame; + } + } + + // 填充提示1 + const tips1 = item.getChildByName('Tips1'); + if (tips1) { + const label = tips1.getComponent(Label); + if (label) { + label.string = `线索一:${config.clue1 || ''}`; + } + } + + // 填充提示2 + const tips2 = item.getChildByName('Tips2'); + if (tips2) { + const label = tips2.getComponent(Label); + if (label) { + label.string = `线索二:${config.clue2 || ''}`; + } + } + + // 填充答案 + const answer = item.getChildByName('Answer'); + if (answer) { + const label = answer.getComponent(Label); + if (label) { + label.string = `答案:${config.answer || ''}`; + } + } + } + + // ─── 事件处理 ─────────────────────────────────────── + + private _onBackClick(): void { + console.log('[PagePreviewLevels] 返回'); + ViewManager.instance.back(); + } +} diff --git a/assets/prefabs/PagePreviewLevels.ts.meta b/assets/prefabs/PagePreviewLevels.ts.meta new file mode 100644 index 0000000..a237d6c --- /dev/null +++ b/assets/prefabs/PagePreviewLevels.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "507c235b-e447-4428-aca5-da55550860a0", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/prefabs/PageWriteLevels.prefab b/assets/prefabs/PageWriteLevels.prefab index 5b9c101..c3b0fec 100644 --- a/assets/prefabs/PageWriteLevels.prefab +++ b/assets/prefabs/PageWriteLevels.prefab @@ -38,19 +38,22 @@ }, { "__id__": 88 + }, + { + "__id__": 122 } ], "_active": true, "_components": [ { - "__id__": 122 + "__id__": 128 }, { - "__id__": 124 + "__id__": 130 } ], "_prefab": { - "__id__": 126 + "__id__": 132 }, "_lpos": { "__type__": "cc.Vec3", @@ -875,7 +878,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": -730.03, + "y": -754.45, "z": 0 }, "_lrot": { @@ -1250,7 +1253,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": -561.958, + "y": -588.057, "z": 0 }, "_lrot": { @@ -2065,7 +2068,7 @@ "node": { "__id__": 68 }, - "_enabled": true, + "_enabled": false, "__prefab": { "__id__": 84 }, @@ -2933,7 +2936,7 @@ }, "clickEvents": [], "_interactable": true, - "_transition": 0, + "_transition": 3, "_normalColor": { "__type__": "cc.Color", "r": 255, @@ -2988,6 +2991,165 @@ "targetOverrides": null, "nestedPrefabInstanceRoots": null }, + { + "__type__": "cc.Node", + "_name": "SelectedLabel", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 123 + }, + { + "__id__": 125 + } + ], + "_prefab": { + "__id__": 127 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -330.984, + "y": -503.184, + "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__": 122 + }, + "_enabled": true, + "__prefab": { + "__id__": 124 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 127.572265625, + "height": 50.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "daK8L6+JFAgYoLC0pXgvHl" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 122 + }, + "_enabled": true, + "__prefab": { + "__id__": 126 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_string": "请选择6关", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 28, + "_fontSize": 28, + "_fontFamily": "Arial", + "_lineHeight": 40, + "_overflow": 0, + "_enableWrapText": true, + "_font": null, + "_isSystemFontUsed": true, + "_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": "6dSEpB9SdA56LwZVP7Ldvd" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "20QMEOOT1Dhb91nKMWbNy/", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, { "__type__": "d186e8ImsZEVoLE1rP4kkAX", "_name": "", @@ -2998,7 +3160,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 123 + "__id__": 129 }, "backBtn": { "__id__": 10 @@ -3012,6 +3174,18 @@ "listTemplate": { "__id__": 88 }, + "selectedLabel": { + "__id__": 122 + }, + "completeBtn": { + "__id__": 20 + }, + "previewBtn": { + "__id__": 34 + }, + "shareTitleEditBox": { + "__id__": 48 + }, "_id": "" }, { @@ -3028,7 +3202,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 125 + "__id__": 131 }, "_contentSize": { "__type__": "cc.Size", diff --git a/assets/prefabs/PageWriteLevels.ts b/assets/prefabs/PageWriteLevels.ts index 70f90b0..eea8a67 100644 --- a/assets/prefabs/PageWriteLevels.ts +++ b/assets/prefabs/PageWriteLevels.ts @@ -1,7 +1,8 @@ -import { _decorator, Node, Button, Sprite, Label, Toggle, ScrollView, instantiate, UITransform, Vec2, EventTouch } from 'cc'; +import { _decorator, Node, Button, Sprite, Label, Toggle, ScrollView, EditBox, instantiate, UITransform, Vec2, EventTouch } from 'cc'; import { BaseView } from 'db://assets/scripts/core/BaseView'; import { ViewManager } from 'db://assets/scripts/core/ViewManager'; import { LevelDataManager } from 'db://assets/scripts/utils/LevelDataManager'; +import { ToastManager } from 'db://assets/scripts/utils/ToastManager'; const { ccclass, property } = _decorator; /** @@ -26,6 +27,9 @@ const LAYOUT_CONFIG = { VIEW_HEIGHT: 1300, }; +/** 必须选择的关卡数量 */ +const MAX_SELECTION = 6; + const PAGE_CONFIG = { /** 滑动距离超过页宽的这个比例就翻页 */ SWIPE_THRESHOLD: 0.2, @@ -49,6 +53,18 @@ export class PageWriteLevels extends BaseView { @property({ type: Node, tooltip: '列表项模板' }) listTemplate: Node | null = null; + @property({ type: Node, tooltip: '已选关卡提示Label节点' }) + selectedLabel: Node | null = null; + + @property({ type: Node, tooltip: '完成按钮节点' }) + completeBtn: Node | null = null; + + @property({ type: Node, tooltip: '预览按钮节点' }) + previewBtn: Node | null = null; + + @property({ type: Node, tooltip: '分享标题输入框节点' }) + shareTitleEditBox: Node | null = null; + private _selectedIndices: Set = new Set(); private _currentPage: number = 0; private _totalPages: number = 0; @@ -66,12 +82,16 @@ export class PageWriteLevels extends BaseView { console.log('[PageWriteLevels] onViewLoad'); this._initButtons(); this._initScrollView(); + this._updateSelectionUI(); } private _initButtons(): void { if (this.backBtn) { this.backBtn.on(Button.EventType.CLICK, this._onBackClick, this); } + if (this.previewBtn) { + this.previewBtn.on(Button.EventType.CLICK, this._onPreviewClick, this); + } } private _initScrollView(): void { @@ -291,16 +311,7 @@ export class PageWriteLevels extends BaseView { } private _setupItemClick(item: Node, index: number): void { - const isSelected = item.getChildByName('IsSelected'); - if (isSelected) { - const toggle = isSelected.getComponent(Toggle); - if (toggle) { - toggle.node.on('toggle', () => { - this._onItemToggle(index, toggle.isChecked); - }, this); - } - } - + // 只用 Button click 统一处理选中/取消,避免 Toggle 事件与 Button 事件同时触发导致双重调用 const button = item.getComponent(Button); if (button) { button.node.on(Button.EventType.CLICK, () => { @@ -325,13 +336,34 @@ export class PageWriteLevels extends BaseView { } private _onItemToggle(index: number, selected: boolean): void { + // 如果要选中但已达上限,阻止选中 + if (selected && this._selectedIndices.size >= MAX_SELECTION) { + // 恢复 toggle 的视觉状态为未选中 + const item = this._itemNodes[index]; + if (item) { + const isSelected = item.getChildByName('IsSelected'); + if (isSelected) { + const toggle = isSelected.getComponent(Toggle); + if (toggle) { + toggle.isChecked = false; + } + const checkmark = isSelected.getChildByName('Checkmark'); + if (checkmark) { + checkmark.active = false; + } + } + } + console.log(`[PageWriteLevels] 已达最大选择数量 ${MAX_SELECTION},无法继续选择`); + return; + } + if (selected) { this._selectedIndices.add(index); } else { this._selectedIndices.delete(index); } - console.log('[PageWriteLevels] item切换选中:', index, selected); + console.log('[PageWriteLevels] item切换选中:', index, selected, '当前已选:', this._selectedIndices.size); const item = this._itemNodes[index]; if (item) { @@ -347,6 +379,48 @@ export class PageWriteLevels extends BaseView { } } } + + this._updateSelectionUI(); + } + + /** + * 根据当前选中数量更新 SelectedLabel 文本和按钮可用状态。 + * - 未选择任何关卡时:显示 "请选择6关" + * - 已选但不足6关时:显示 "已选 x 关,还差 y 关" + * - 恰好选满6关时:显示 "已选满6关",启用按钮 + */ + private _updateSelectionUI(): void { + const count = this._selectedIndices.size; + const remaining = MAX_SELECTION - count; + const isFull = remaining <= 0; + + // 更新 SelectedLabel 文本 + if (this.selectedLabel) { + const label = this.selectedLabel.getComponent(Label); + if (label) { + if (count === 0) { + label.string = `请选择${MAX_SELECTION}关`; + } else if (isFull) { + label.string = `已选满${MAX_SELECTION}关`; + } else { + label.string = `已选${count}关,还差${remaining}关`; + } + } + } + + // 更新 CompleteButton 和 PreviewButton 的可用状态 + if (this.completeBtn) { + const btn = this.completeBtn.getComponent(Button); + if (btn) { + btn.interactable = isFull; + } + } + if (this.previewBtn) { + const btn = this.previewBtn.getComponent(Button); + if (btn) { + btn.interactable = true; + } + } } private _onBackClick(): void { @@ -354,6 +428,22 @@ export class PageWriteLevels extends BaseView { ViewManager.instance.back(); } + private _onPreviewClick(): void { + if (this._selectedIndices.size < MAX_SELECTION) { + const remaining = MAX_SELECTION - this._selectedIndices.size; + ToastManager.instance.show(`还需选择${remaining}个关卡`); + return; + } + const shareTitle = this.shareTitleEditBox?.getComponent(EditBox)?.string?.trim() || ''; + console.log('[PageWriteLevels] 预览按钮点击,标题:', shareTitle, '已选关卡:', Array.from(this._selectedIndices)); + ViewManager.instance.open('PagePreviewLevels', { + params: { + selectedIndices: Array.from(this._selectedIndices), + shareTitle: shareTitle + } + }); + } + onViewHide(): void { console.log('[PageWriteLevels] onViewHide'); } @@ -363,6 +453,9 @@ export class PageWriteLevels extends BaseView { if (this.backBtn) { this.backBtn.off(Button.EventType.CLICK, this._onBackClick, this); } + if (this.previewBtn) { + this.previewBtn.off(Button.EventType.CLICK, this._onPreviewClick, this); + } if (this.scrollView) { this.scrollView.off(Node.EventType.TOUCH_START, this._onTouchStart, this); this.scrollView.off(Node.EventType.TOUCH_END, this._onTouchEnd, this);