diff --git a/AGENTS.md b/AGENTS.md index 7eddf0a..99c960c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -40,7 +40,7 @@ Git 历史采用 Conventional Commits,且摘要多为中文,例如 `feat: # Memory Context -# $CMEM mp-xieyingeng 2026-05-10 10:19pm GMT+8 +# $CMEM mp-xieyingeng 2026-05-11 9:03am GMT+8 Legend: 🎯session 🔴bugfix 🟣feature 🔄refactor ✅change 🔵discovery ⚖️decision Format: ID TIME TYPE TITLE diff --git a/assets/prefabs/CommonModal.prefab b/assets/prefabs/CommonModal.prefab new file mode 100644 index 0000000..01faabf --- /dev/null +++ b/assets/prefabs/CommonModal.prefab @@ -0,0 +1,1645 @@ +[ + { + "__type__": "cc.Prefab", + "_name": "CommonModal", + "_objFlags": 0, + "__editorExtras__": {}, + "_native": "", + "data": { + "__id__": 1 + }, + "optimizationPolicy": 0, + "persistent": false + }, + { + "__type__": "cc.Node", + "_name": "CommonModal", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": null, + "_children": [ + { + "__id__": 2 + }, + { + "__id__": 10 + } + ], + "_active": true, + "_components": [ + { + "__id__": 62 + }, + { + "__id__": 64 + }, + { + "__id__": 66 + } + ], + "_prefab": { + "__id__": 68 + }, + "_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": "BgMask", + "_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": "88epfHEmhCcLE8ktlnygG1" + }, + { + "__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": 0, + "g": 0, + "b": 0, + "a": 121 + }, + "_spriteFrame": { + "__uuid__": "7d8f9b89-4fd1-4c9f-a3ab-38ec7cded7ca@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": "e4C6cPdxRB66+B4hmjydyn" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": { + "__id__": 8 + }, + "_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": 40, + "_originalHeight": 36, + "_alignMode": 2, + "_lockFlags": 0, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "61mt404VhKUq+sKTkX8CtT" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "cby61tEk5Iza0zINKbYqqt", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "dialogPanel", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 11 + }, + { + "__id__": 21 + }, + { + "__id__": 27 + }, + { + "__id__": 33 + }, + { + "__id__": 51 + } + ], + "_active": true, + "_components": [ + { + "__id__": 57 + }, + { + "__id__": 59 + } + ], + "_prefab": { + "__id__": 61 + }, + "_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.5, + "y": 0.5, + "z": 1 + }, + "_mobility": 0, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "closeBtn", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 10 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 12 + }, + { + "__id__": 14 + }, + { + "__id__": 16 + }, + { + "__id__": 18 + } + ], + "_prefab": { + "__id__": 20 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 579.972, + "y": 799.106, + "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__": 11 + }, + "_enabled": true, + "__prefab": { + "__id__": 13 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 180, + "height": 191 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "412r9fk2BHWpD2X1rSJkww" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 11 + }, + "_enabled": true, + "__prefab": { + "__id__": 15 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "540f8b6d-7cad-47e8-abae-b941c9bdd900@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": "21B0+PZ41L+5bBN0giwudm" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 11 + }, + "_enabled": true, + "__prefab": { + "__id__": 17 + }, + "_alignFlags": 33, + "_target": null, + "_left": 0, + "_right": 40.02800000000002, + "_top": 28.894000000000005, + "_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": "e6kTdMyd1C3ZK6dQGDNQYb" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 11 + }, + "_enabled": true, + "__prefab": { + "__id__": 19 + }, + "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": "3eNsK9o9tD8Zga0+Ucj722" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "d0mJX0WihMarx8vLwZSGe3", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "Title", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 10 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 22 + }, + { + "__id__": 24 + } + ], + "_prefab": { + "__id__": 26 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 770, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 2, + "y": 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__": 21 + }, + "_enabled": true, + "__prefab": { + "__id__": 23 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 286, + "height": 94.2 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "a5/UQjcmRLo7HkiHyN74nh" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 21 + }, + "_enabled": true, + "__prefab": { + "__id__": 25 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_string": "温馨提示", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 70, + "_fontSize": 70, + "_fontFamily": "Arial", + "_lineHeight": 70, + "_overflow": 0, + "_enableWrapText": true, + "_font": { + "__uuid__": "fb4acba6-6bc7-4eb3-be34-8f2ac9823a80", + "__expectedType__": "cc.TTFFont" + }, + "_isSystemFontUsed": false, + "_spacingX": 0, + "_isItalic": false, + "_isBold": true, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 0, + "_enableOutline": true, + "_outlineColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_outlineWidth": 3, + "_enableShadow": true, + "_shadowColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 98 + }, + "_shadowOffset": { + "__type__": "cc.Vec2", + "x": 0, + "y": -8 + }, + "_shadowBlur": 2, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "ceF3Bp32VCd4YbyHCYG7FU" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "f9RaZl4+JJfL6r43DgdzBa", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "Content", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 10 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 28 + }, + { + "__id__": 30 + } + ], + "_prefab": { + "__id__": 32 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": -302.5819999999999, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 2, + "y": 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__": 27 + }, + "_enabled": true, + "__prefab": { + "__id__": 29 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 450, + "height": 69.3 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "5box8ADDlF47qbQwm1zKq2" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 27 + }, + "_enabled": true, + "__prefab": { + "__id__": 31 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 56, + "g": 78, + "b": 40, + "a": 255 + }, + "_string": "哎呀,再仔细想想看?", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 45, + "_fontSize": 45, + "_fontFamily": "Arial", + "_lineHeight": 55, + "_overflow": 0, + "_enableWrapText": true, + "_font": { + "__uuid__": "fb4acba6-6bc7-4eb3-be34-8f2ac9823a80", + "__expectedType__": "cc.TTFFont" + }, + "_isSystemFontUsed": false, + "_spacingX": 0, + "_isItalic": false, + "_isBold": true, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 0, + "_enableOutline": false, + "_outlineColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_outlineWidth": 3, + "_enableShadow": false, + "_shadowColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 98 + }, + "_shadowOffset": { + "__type__": "cc.Vec2", + "x": 0, + "y": -8 + }, + "_shadowBlur": 2, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "9866guoQRJ95i2Vh5qFC9z" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "640uQ8mrJImr2TZQLmVrX4", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "ButtonHint", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 10 + }, + "_children": [ + { + "__id__": 34 + } + ], + "_active": true, + "_components": [ + { + "__id__": 42 + }, + { + "__id__": 44 + }, + { + "__id__": 46 + }, + { + "__id__": 48 + } + ], + "_prefab": { + "__id__": 50 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": -627.0459999999999, + "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__": 33 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 35 + }, + { + "__id__": 37 + }, + { + "__id__": 39 + } + ], + "_prefab": { + "__id__": 41 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 7.598, + "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__": 34 + }, + "_enabled": true, + "__prefab": { + "__id__": 36 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 330, + "height": 136 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "87mx3WaFFFL4+v/+4i8Zx2" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 34 + }, + "_enabled": true, + "__prefab": { + "__id__": 38 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_string": "继续挑战", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 80, + "_fontSize": 80, + "_fontFamily": "Arial", + "_lineHeight": 100, + "_overflow": 0, + "_enableWrapText": true, + "_font": { + "__uuid__": "fb4acba6-6bc7-4eb3-be34-8f2ac9823a80", + "__expectedType__": "cc.TTFFont" + }, + "_isSystemFontUsed": false, + "_spacingX": 0, + "_isItalic": false, + "_isBold": true, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 0, + "_enableOutline": true, + "_outlineColor": { + "__type__": "cc.Color", + "r": 72, + "g": 158, + "b": 35, + "a": 255 + }, + "_outlineWidth": 5, + "_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": "490umEN6ZMiK0QtWULiZ/P" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 34 + }, + "_enabled": true, + "__prefab": { + "__id__": 40 + }, + "_alignFlags": 18, + "_target": null, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_horizontalCenter": 0, + "_verticalCenter": 7.598, + "_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": "afYvKsXjlBwqyR370Uq1ce" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "5ej6tVa2pPSpmVfXv7Qfo+", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 33 + }, + "_enabled": true, + "__prefab": { + "__id__": 43 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 800, + "height": 234 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "c4aNcq+lZDLLhgsEqWUklR" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 33 + }, + "_enabled": true, + "__prefab": { + "__id__": 45 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "f87d228a-c520-499a-bf3a-e66cbb6def64@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": "ccrghFsT9MhKwmUxKh+xki" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 33 + }, + "_enabled": true, + "__prefab": { + "__id__": 47 + }, + "_alignFlags": 12, + "_target": null, + "_left": 310, + "_right": 0, + "_top": 0, + "_bottom": 179.45400000000006, + "_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": "566NGbzlJOyLK5JELzf1Nj" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 33 + }, + "_enabled": true, + "__prefab": { + "__id__": 49 + }, + "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": "dcsuGJKVpOcoOngimD0/cU" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "77l3F+7/dE+b92gfIk9YLK", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "sphere", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 10 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 52 + }, + { + "__id__": 54 + } + ], + "_prefab": { + "__id__": 56 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 190.8499999999999, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 2, + "y": 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__": 51 + }, + "_enabled": true, + "__prefab": { + "__id__": 53 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 350, + "height": 350 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "0b94WSuwlHfqFNRchpwmM5" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 51 + }, + "_enabled": true, + "__prefab": { + "__id__": 55 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "7a17df33-9d28-4272-9f3e-f336af8d4afb@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": "55O2cXx/FOlKsCFnViyN7H" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "fbCCd/NElI8r/gaodTgopa", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 10 + }, + "_enabled": true, + "__prefab": { + "__id__": 58 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1420, + "height": 1847 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "cbghKsLQpLtYZP8mDTgn11" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 10 + }, + "_enabled": true, + "__prefab": { + "__id__": 60 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "10f211a7-5580-4da3-94d2-2d285d63ac28@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": "fe9hjaoTZOZLr/00McCFgI" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "a0jedATEhFaqJKhCFKlm8G", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 63 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1080, + "height": 2160 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "61F6RIyuhAgbmtMPXXVPb6" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 65 + }, + "_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": "a29RxiIzdCmb3+pvtytcYa" + }, + { + "__type__": "ef212waz9VJXLLRle63VGWK", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 67 + }, + "animationNodes": [], + "backdropNode": null, + "openAnimationEnabled": true, + "openAnimationDuration": 0.36, + "titleLabel": { + "__id__": 24 + }, + "contentLabel": { + "__id__": 30 + }, + "buttonHintLabel": { + "__id__": 37 + }, + "closeBtn": { + "__id__": 11 + }, + "buttonHint": { + "__id__": 33 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "b4zIbNB+NAd7bHgFBojNEk" + }, + { + "__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/CommonModal.prefab.meta b/assets/prefabs/CommonModal.prefab.meta new file mode 100644 index 0000000..c7662b2 --- /dev/null +++ b/assets/prefabs/CommonModal.prefab.meta @@ -0,0 +1,13 @@ +{ + "ver": "1.1.50", + "importer": "prefab", + "imported": true, + "uuid": "5379669e-7cd7-45b6-9dd3-4a021730b23e", + "files": [ + ".json" + ], + "subMetas": {}, + "userData": { + "syncNodeName": "CommonModal" + } +} diff --git a/assets/prefabs/CommonModal.ts b/assets/prefabs/CommonModal.ts new file mode 100644 index 0000000..08bdff9 --- /dev/null +++ b/assets/prefabs/CommonModal.ts @@ -0,0 +1,280 @@ +import { _decorator, error, instantiate, Label, Node, Prefab, Size, UITransform, Vec3, view } from 'cc'; +import { BaseModal } from 'db://assets/scripts/core/BaseModal'; +import { ViewManager } from 'db://assets/scripts/core/ViewManager'; +const { ccclass, property } = _decorator; + +export type CommonModalAction = () => void | boolean; + +export interface CommonModalCallbacks { + /** 点击关闭按钮回调,返回 false 可阻止默认关闭 */ + onClose?: CommonModalAction; + /** 点击主按钮回调,返回 false 可阻止默认关闭 */ + onConfirm?: CommonModalAction; +} + +export interface CommonModalParams extends CommonModalCallbacks { + /** 弹窗标题 */ + title?: string; + /** 弹窗内容 */ + content?: string; + /** 主按钮文案 */ + buttonHint?: string; + /** 主按钮文案别名,方便业务侧按 buttonText 调用 */ + buttonText?: string; + /** 点击关闭按钮后是否自动关闭弹窗,默认 true */ + closeOnClose?: boolean; + /** 点击主按钮后是否自动关闭弹窗,默认 true */ + closeOnConfirm?: boolean; + /** 关闭时是否销毁节点,默认 true */ + destroyOnClose?: boolean; + /** 弹窗层级,默认 CommonModal.MODAL_Z_INDEX */ + zIndex?: number; +} + +@ccclass('CommonModal') +export class CommonModal extends BaseModal { + public static readonly MODAL_Z_INDEX = 999; + + private static readonly DEFAULT_TITLE = '温馨提示'; + private static readonly DEFAULT_CONTENT = ''; + private static readonly DEFAULT_BUTTON_HINT = '确定'; + + @property({ type: Label, tooltip: '标题文本' }) + titleLabel: Label | null = null; + + @property({ type: Label, tooltip: '内容文本' }) + contentLabel: Label | null = null; + + @property({ type: Label, tooltip: '主按钮文本' }) + buttonHintLabel: Label | null = null; + + @property({ type: Node, tooltip: '关闭按钮节点' }) + closeBtn: Node | null = null; + + @property({ type: Node, tooltip: '主按钮节点' }) + buttonHint: Node | null = null; + + private _title: string = CommonModal.DEFAULT_TITLE; + private _content: string = CommonModal.DEFAULT_CONTENT; + private _buttonHintText: string = CommonModal.DEFAULT_BUTTON_HINT; + private _callbacks: CommonModalCallbacks = {}; + private _closeOnClose: boolean = true; + private _closeOnConfirm: boolean = true; + private _destroyOnClose: boolean = true; + private _screenSize: Size | null = null; + private _loaded: boolean = false; + + /** + * 直接弹出通用弹窗。 + * + * 使用示例: + * CommonModal.show(this.commonModalPrefab, { + * title: '提示', + * content: '是否继续?', + * buttonHint: '继续', + * onConfirm: () => this.startGame() + * }); + */ + static show(prefab: Prefab, params: CommonModalParams = {}, parent?: Node): CommonModal | null { + const container = parent ?? ViewManager.instance.getContainer(); + if (!container) { + error('[CommonModal] 缺少弹窗挂载节点'); + return null; + } + + const modalNode = instantiate(prefab); + const modal = modalNode.getComponent(CommonModal); + if (!modal) { + error('[CommonModal] 预制体缺少 CommonModal 组件'); + modalNode.destroy(); + return null; + } + + modal.setParams(params); + modalNode.setPosition(Vec3.ZERO); + modalNode.setSiblingIndex(params.zIndex ?? CommonModal.MODAL_Z_INDEX); + container.addChild(modalNode); + modal.onViewLoad(); + modal._doShow(); + + return modal; + } + + protected start(): void { + this.onViewLoad(); + + if (!this.isShowing) { + this._doShow(); + } + } + + setParams(params: CommonModalParams = {}): void { + super.setParams(params); + this.setConfig(params); + } + + setConfig(params: CommonModalParams = {}): void { + this._title = params.title ?? CommonModal.DEFAULT_TITLE; + this._content = params.content ?? CommonModal.DEFAULT_CONTENT; + this._buttonHintText = params.buttonHint ?? params.buttonText ?? CommonModal.DEFAULT_BUTTON_HINT; + this._callbacks = { + onClose: params.onClose, + onConfirm: params.onConfirm + }; + this._closeOnClose = params.closeOnClose ?? true; + this._closeOnConfirm = params.closeOnConfirm ?? true; + this._destroyOnClose = params.destroyOnClose ?? true; + this._applyContent(); + } + + setTitle(title: string): void { + this._title = title; + this._applyContent(); + } + + setContent(content: string): void { + this._content = content; + this._applyContent(); + } + + setButtonHint(buttonHint: string): void { + this._buttonHintText = buttonHint; + this._applyContent(); + } + + setCallbacks(callbacks: CommonModalCallbacks): void { + this._callbacks = callbacks; + } + + close(destroy: boolean = this._destroyOnClose): void { + if (!this.node?.isValid) { + return; + } + + if (this.isShowing) { + this._doHide(); + } + + if (destroy) { + this.node.destroy(); + } else { + this.node.active = false; + } + } + + onViewLoad(): void { + if (this._loaded) { + return; + } + + this._loaded = true; + this._resolveNodes(); + this._bindButtonEvents(); + this._applyContent(); + this._updateWidget(); + } + + onViewShow(): void { + this._resolveNodes(); + this._applyContent(); + this._updateWidget(); + super.onViewShow(); + } + + onViewDestroy(): void { + this._unbindButtonEvents(); + this._callbacks = {}; + } + + private _resolveNodes(): void { + const panelNode = this._findNode('dialogPanel'); + + this.backdropNode = this.backdropNode ?? this._findNode('BgMask'); + this.animationNodes = this.animationNodes.length > 0 ? this.animationNodes : (panelNode ? [panelNode] : []); + + this.closeBtn = this.closeBtn ?? this._findNode('dialogPanel/closeBtn'); + this.buttonHint = this.buttonHint ?? this._findNode('dialogPanel/ButtonHint'); + this.titleLabel = this.titleLabel ?? this._findNode('dialogPanel/Title')?.getComponent(Label) ?? null; + this.contentLabel = this.contentLabel ?? this._findNode('dialogPanel/Content')?.getComponent(Label) ?? null; + this.buttonHintLabel = this.buttonHintLabel + ?? this._findNode('dialogPanel/ButtonHint/Label')?.getComponent(Label) + ?? null; + } + + private _applyContent(): void { + this._resolveNodes(); + + if (this.titleLabel) { + this.titleLabel.string = this._title; + } + + if (this.contentLabel) { + this.contentLabel.string = this._content; + } + + if (this.buttonHintLabel) { + this.buttonHintLabel.string = this._buttonHintText; + } + } + + private _updateWidget(): void { + if (!this._screenSize) { + this._screenSize = view.getVisibleSize(); + } + + const uiTransform = this.node.getComponent(UITransform); + if (uiTransform) { + uiTransform.setContentSize(this._screenSize.width, this._screenSize.height); + } + } + + private _bindButtonEvents(): void { + this._unbindButtonEvents(); + + if (this.closeBtn) { + this.closeBtn.on(Node.EventType.TOUCH_END, this._onCloseClick, this); + } + + if (this.buttonHint) { + this.buttonHint.on(Node.EventType.TOUCH_END, this._onConfirmClick, this); + } + } + + private _unbindButtonEvents(): void { + if (this.closeBtn?.isValid) { + this.closeBtn.off(Node.EventType.TOUCH_END, this._onCloseClick, this); + } + + if (this.buttonHint?.isValid) { + this.buttonHint.off(Node.EventType.TOUCH_END, this._onConfirmClick, this); + } + } + + private _onCloseClick(): void { + const shouldContinue = this._callbacks.onClose?.(); + if (shouldContinue !== false && this._closeOnClose) { + this.close(); + } + } + + private _onConfirmClick(): void { + const shouldContinue = this._callbacks.onConfirm?.(); + if (shouldContinue !== false && this._closeOnConfirm) { + this.close(); + } + } + + private _findNode(path: string): Node | null { + const names = path.split('/').filter(Boolean); + let current: Node | null = this.node; + + for (const name of names) { + current = current?.getChildByName(name) ?? null; + if (!current) { + return null; + } + } + + return current; + } +} diff --git a/assets/prefabs/CommonModal.ts.meta b/assets/prefabs/CommonModal.ts.meta new file mode 100644 index 0000000..c797bdc --- /dev/null +++ b/assets/prefabs/CommonModal.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "ef212c1a-cfd5-495c-b2d1-95eeb754658a", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/prefabs/PageLevel.prefab b/assets/prefabs/PageLevel.prefab index bef5b0b..0553b59 100644 --- a/assets/prefabs/PageLevel.prefab +++ b/assets/prefabs/PageLevel.prefab @@ -8813,7 +8813,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": -777.017, + "y": -800.517, "z": 0 }, "_lrot": { @@ -9525,6 +9525,10 @@ "__uuid__": "e41c722f-f605-47f7-9ce4-abff0ed2020f", "__expectedType__": "cc.Prefab" }, + "commonModalPrefab": { + "__uuid__": "5379669e-7cd7-45b6-9dd3-4a021730b23e", + "__expectedType__": "cc.Prefab" + }, "roundedSpriteEffect": { "__uuid__": "f0080a34-1786-4547-8d81-d89cc517b63e", "__expectedType__": "cc.EffectAsset" @@ -9548,4 +9552,4 @@ "instance": null, "targetOverrides": null } -] \ No newline at end of file +] diff --git a/assets/prefabs/PageLevel.ts b/assets/prefabs/PageLevel.ts index 10b648f..06f0cef 100644 --- a/assets/prefabs/PageLevel.ts +++ b/assets/prefabs/PageLevel.ts @@ -11,6 +11,7 @@ import { ShareManager } from 'db://assets/scripts/utils/ShareManager'; import { PassModal } from 'db://assets/prefabs/PassModal'; import { WrongModal } from 'db://assets/prefabs/WrongModal'; import { TimeoutModal } from 'db://assets/prefabs/TimeoutModal'; +import { CommonModal } from 'db://assets/prefabs/CommonModal'; import { StaminaInfo, NextLevelData, SubmitShareLevel } from 'db://assets/scripts/types/ApiTypes'; import { AchievementTitleManager } from 'db://assets/scripts/utils/AchievementTitleManager'; import { applyRoundedCorner } from 'db://assets/scripts/utils/roundedMaterial.utils'; @@ -191,6 +192,9 @@ export class PageLevel extends BaseView { @property(Prefab) timeoutModalPrefab: Prefab | null = null; + @property(Prefab) + commonModalPrefab: Prefab | null = null; + /** 主图圆角材质 EffectAsset */ @property(EffectAsset) roundedSpriteEffect: EffectAsset | null = null; @@ -266,6 +270,9 @@ export class PageLevel extends BaseView { /** 超时弹窗实例 */ private _timeoutModalNode: Node | null = null; + /** 通用确认弹窗实例 */ + private _commonModalNode: Node | null = null; + /** 是否处于分享挑战模式 */ private _isShareMode: boolean = false; @@ -365,6 +372,7 @@ export class PageLevel extends BaseView { this._closePassModal(); this._closeWrongModal(); this._closeTimeoutModal(); + this._closeCommonModal(); this._stopStaminaRecoverTimer(); // 清理事件监听 @@ -501,6 +509,7 @@ export class PageLevel extends BaseView { // 显示解锁按钮(单个统一按钮) this.showUnlockButton(); + this._refreshTipsModeUI(); // 根据答案字数创建输入格 if (config.answer) { @@ -929,8 +938,10 @@ export class PageLevel extends BaseView { } this.playClickSound(); - this._recordCurrentShareSubmission(); - void this.goToNextLevel(); + this._showShareNextConfirmModal(() => { + this._recordCurrentShareSubmission(); + void this.goToNextLevel(); + }); } /** @@ -1119,9 +1130,7 @@ export class PageLevel extends BaseView { if (this.liveNode) { this.liveNode.active = !isPkMode; } - if (this.tipsLayout) { - this.tipsLayout.active = !isPkMode; - } + this._refreshTipsModeUI(); if (this.pkLevelProgressNode) { this.pkLevelProgressNode.active = isPkMode; } @@ -1136,6 +1145,29 @@ export class PageLevel extends BaseView { this.updatePkLevelProgressLabel(); } + private _refreshTipsModeUI(): void { + if (this.tipsLayout) { + this.tipsLayout.active = true; + } + + if (this._isShareMode) { + this.showClue(1); + this.hideClue(2); + this.hideClue(3); + if (this.unLockTipsBtn) { + this.unLockTipsBtn.active = false; + } + return; + } + + this.showClue(1); + this.showClue(2); + this.showClue(3); + if (this.unLockTipsBtn) { + this.unLockTipsBtn.active = true; + } + } + /** * 服务端 level 使用 sortOrder,首关可能为 0;页面展示统一转成从 1 开始的关卡序号 */ @@ -1833,8 +1865,10 @@ export class PageLevel extends BaseView { }); passModal.setCallbacks({ onNextLevel: () => { - this._closePassModal(); - this.goToNextLevel(); + this._showShareNextConfirmModal(() => { + this._closePassModal(); + void this.goToNextLevel(); + }); }, onShare: () => { // 分享后不关闭弹窗,用户可继续点击下一关 @@ -2014,9 +2048,11 @@ export class PageLevel extends BaseView { }); }, onNext: () => { - this._closeTimeoutModal(); - this._recordCurrentShareSubmission(); - void this.goToNextLevel(); + this._showShareNextConfirmModal(() => { + this._closeTimeoutModal(); + this._recordCurrentShareSubmission(); + void this.goToNextLevel(); + }); }, onHome: () => { this._closeTimeoutModal(); @@ -2046,6 +2082,47 @@ export class PageLevel extends BaseView { } } + private _closeCommonModal(): void { + if (this._commonModalNode && this._commonModalNode.isValid) { + this._commonModalNode.destroy(); + this._commonModalNode = null; + console.log('[PageLevel] 关闭通用确认弹窗'); + } + } + + private _showShareNextConfirmModal(onConfirm: () => void): void { + if (!this._isShareMode) { + onConfirm(); + return; + } + + if (this._commonModalNode && this._commonModalNode.isValid) { + return; + } + + if (!this.commonModalPrefab) { + console.warn('[PageLevel] commonModalPrefab 未设置,直接进入下一题'); + onConfirm(); + return; + } + + const modal = CommonModal.show(this.commonModalPrefab, { + title: '切换下一题', + content: '确认进入下一题吗?', + buttonHint: '确认', + zIndex: CommonModal.MODAL_Z_INDEX + 1, + onClose: () => { + this._commonModalNode = null; + }, + onConfirm: () => { + this._commonModalNode = null; + onConfirm(); + }, + }, this.node.parent ?? this.node); + + this._commonModalNode = modal?.node ?? null; + } + /** * 显示错误提示 */