diff --git a/assets/PageLoading.prefab b/assets/PageLoading.prefab index 5ba4529..63144d0 100644 --- a/assets/PageLoading.prefab +++ b/assets/PageLoading.prefab @@ -32,10 +32,13 @@ }, { "__id__": 26 + }, + { + "__id__": 28 } ], "_prefab": { - "__id__": 28 + "__id__": 30 }, "_lpos": { "__type__": "cc.Vec3", @@ -567,12 +570,51 @@ "__prefab": { "__id__": 27 }, + "progressBar": { + "__id__": 21 + }, "_id": "" }, { "__type__": "cc.CompPrefabInfo", "fileId": "035jtIcBFAXpr+rMnkwU6G" }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 29 + }, + "_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": 1080, + "_originalHeight": 2160, + "_alignMode": 2, + "_lockFlags": 0, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "08Ke4fRRVPz6x9lHDiuWL/" + }, { "__type__": "cc.PrefabInfo", "root": { diff --git a/assets/PageLoading.ts b/assets/PageLoading.ts index 50f2d4e..d4d59f5 100644 --- a/assets/PageLoading.ts +++ b/assets/PageLoading.ts @@ -1,14 +1,62 @@ -import { _decorator, Component, Node } from 'cc'; +import { _decorator, Component, ProgressBar } from 'cc'; +import { ViewManager } from './scripts/core/ViewManager'; const { ccclass, property } = _decorator; +/** + * 页面加载组件 + * 负责预加载资源并显示加载进度 + */ @ccclass('PageLoading') export class PageLoading extends Component { - start() { + @property(ProgressBar) + progressBar: ProgressBar | null = null; + start() { + this._startPreload(); } - update(deltaTime: number) { - + /** + * 开始预加载 + */ + private _startPreload(): void { + // 初始化进度条 + if (this.progressBar) { + this.progressBar.progress = 0; + } + + // 预加载 PageHome + ViewManager.instance.preload('PageHome', + (progress) => { + this._updateProgress(progress); + }, + () => { + this._onPreloadComplete(); + } + ); + } + + /** + * 更新进度条 + */ + private _updateProgress(progress: number): void { + if (this.progressBar) { + this.progressBar.progress = progress; + } + } + + /** + * 预加载完成回调 + */ + private _onPreloadComplete(): void { + // 确保进度条显示完成 + this._updateProgress(1); + + // 打开 PageHome + ViewManager.instance.open('PageHome', { + onComplete: () => { + // PageHome 打开成功后,销毁自身 + this.node.destroy(); + } + }); } } - diff --git a/assets/main.scene b/assets/main.scene index aae4503..015452c 100644 --- a/assets/main.scene +++ b/assets/main.scene @@ -3,6 +3,7 @@ "__type__": "cc.SceneAsset", "_name": "main", "_objFlags": 0, + "__editorExtras__": {}, "_native": "", "scene": { "__id__": 1 @@ -10,8 +11,9 @@ }, { "__type__": "cc.Scene", - "_name": "scene-2d", + "_name": "main", "_objFlags": 0, + "__editorExtras__": {}, "_parent": null, "_children": [ { @@ -20,42 +22,13 @@ ], "_active": true, "_components": [], - "_prefab": null, - "autoReleaseAssets": false, - "_globals": { - "__id__": 8 + "_prefab": { + "__id__": 17 }, - "_id": "d60530e8-06be-4ac4-8613-9cc604c77f32" - }, - { - "__type__": "cc.Node", - "_name": "Canvas", - "_objFlags": 0, - "_parent": { - "__id__": 1 - }, - "_children": [ - { - "__id__": 3 - } - ], - "_active": true, - "_components": [ - { - "__id__": 5 - }, - { - "__id__": 6 - }, - { - "__id__": 7 - } - ], - "_prefab": null, "_lpos": { "__type__": "cc.Vec3", - "x": 480, - "y": 320.00000000000006, + "x": 0, + "y": 0, "z": 0 }, "_lrot": { @@ -71,6 +44,72 @@ "y": 1, "z": 1 }, + "_mobility": 0, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "autoReleaseAssets": false, + "_globals": { + "__id__": 18 + }, + "_id": "d60530e8-06be-4ac4-8613-9cc604c77f32" + }, + { + "__type__": "cc.Node", + "_name": "Canvas", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 3 + }, + { + "__id__": 5 + } + ], + "_active": true, + "_components": [ + { + "__id__": 13 + }, + { + "__id__": 14 + }, + { + "__id__": 15 + }, + { + "__id__": 16 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 540, + "y": 1080, + "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": 33554432, "_euler": { "__type__": "cc.Vec3", @@ -84,6 +123,7 @@ "__type__": "cc.Node", "_name": "Camera", "_objFlags": 0, + "__editorExtras__": {}, "_parent": { "__id__": 2 }, @@ -99,7 +139,7 @@ "__type__": "cc.Vec3", "x": 0, "y": 0, - "z": 0 + "z": 1000 }, "_lrot": { "__type__": "cc.Quat", @@ -114,6 +154,7 @@ "y": 1, "z": 1 }, + "_mobility": 0, "_layer": 1073741824, "_euler": { "__type__": "cc.Vec3", @@ -127,6 +168,7 @@ "__type__": "cc.Camera", "_name": "", "_objFlags": 0, + "__editorExtras__": {}, "node": { "__id__": 3 }, @@ -136,7 +178,7 @@ "_priority": 0, "_fov": 45, "_fovAxis": 0, - "_orthoHeight": 10, + "_orthoHeight": 1080, "_near": 0, "_far": 2000, "_color": { @@ -162,12 +204,128 @@ "_screenScale": 1, "_visibility": 1108344832, "_targetTexture": null, + "_postProcess": null, + "_usePostProcess": false, + "_cameraType": -1, + "_trackingType": 0, "_id": "63WIch3o5BEYRlXzTT0oWc" }, + { + "__type__": "cc.Node", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_prefab": { + "__id__": 6 + }, + "__editorExtras__": {} + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 5 + }, + "asset": { + "__uuid__": "79949d26-c169-4e68-ad10-a1242a9679a8", + "__expectedType__": "cc.Prefab" + }, + "fileId": "c46/YsCPVOJYA4mWEpNYRx", + "instance": { + "__id__": 7 + }, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.PrefabInstance", + "fileId": "895CV8V5xCQYBK4UFRhlwD", + "prefabRootNode": null, + "mountedChildren": [], + "mountedComponents": [], + "propertyOverrides": [ + { + "__id__": 8 + }, + { + "__id__": 10 + }, + { + "__id__": 11 + }, + { + "__id__": 12 + } + ], + "removedComponents": [] + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 9 + }, + "propertyPath": [ + "_name" + ], + "value": "PageLoading" + }, + { + "__type__": "cc.TargetInfo", + "localID": [ + "c46/YsCPVOJYA4mWEpNYRx" + ] + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 9 + }, + "propertyPath": [ + "_lpos" + ], + "value": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 9 + }, + "propertyPath": [ + "_lrot" + ], + "value": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + } + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 9 + }, + "propertyPath": [ + "_euler" + ], + "value": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + } + }, { "__type__": "cc.UITransform", "_name": "", "_objFlags": 0, + "__editorExtras__": {}, "node": { "__id__": 2 }, @@ -175,8 +333,8 @@ "__prefab": null, "_contentSize": { "__type__": "cc.Size", - "width": 960, - "height": 640 + "width": 1080, + "height": 2160 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -189,6 +347,7 @@ "__type__": "cc.Canvas", "_name": "", "_objFlags": 0, + "__editorExtras__": {}, "node": { "__id__": 2 }, @@ -204,6 +363,7 @@ "__type__": "cc.Widget", "_name": "", "_objFlags": 0, + "__editorExtras__": {}, "node": { "__id__": 2 }, @@ -229,26 +389,59 @@ "_lockFlags": 0, "_id": "c5V1EV8IpMtrIvY1OE9t2u" }, + { + "__type__": "66d6c15rzdAT4lpaFk0+5gx", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": null, + "_id": "c2b3nbzv9JuZmP2jxQyN72" + }, + { + "__type__": "cc.PrefabInfo", + "root": null, + "asset": null, + "fileId": "d60530e8-06be-4ac4-8613-9cc604c77f32", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": [ + { + "__id__": 5 + } + ] + }, { "__type__": "cc.SceneGlobals", "ambient": { - "__id__": 9 + "__id__": 19 }, "shadows": { - "__id__": 10 + "__id__": 20 }, "_skybox": { - "__id__": 11 + "__id__": 21 }, "fog": { - "__id__": 12 + "__id__": 22 }, "octree": { - "__id__": 13 + "__id__": 23 }, "skin": { - "__id__": 14 - } + "__id__": 24 + }, + "lightProbeInfo": { + "__id__": 25 + }, + "postSettings": { + "__id__": 26 + }, + "bakedWithStationaryMainLight": false, + "bakedWithHighpLightmap": false }, { "__type__": "cc.AmbientInfo", @@ -309,6 +502,7 @@ "z": 0 }, "_distance": 0, + "_planeBias": 1, "_shadowColor": { "__type__": "cc.Color", "r": 76, @@ -332,7 +526,11 @@ "_diffuseMapHDR": null, "_diffuseMapLDR": null, "_enabled": false, - "_useHDR": true + "_useHDR": true, + "_editableMaterial": null, + "_reflectionHDR": null, + "_reflectionLDR": null, + "_rotationAngle": 0 }, { "__type__": "cc.FogInfo", @@ -373,6 +571,23 @@ { "__type__": "cc.SkinInfo", "_enabled": false, - "_scale": 5 + "_blurRadius": 0.01, + "_sssIntensity": 3 + }, + { + "__type__": "cc.LightProbeInfo", + "_giScale": 1, + "_giSamples": 1024, + "_bounces": 2, + "_reduceRinging": 0, + "_showProbe": true, + "_showWireframe": true, + "_showConvex": false, + "_data": null, + "_lightProbeSphereVolume": 1 + }, + { + "__type__": "cc.PostSettingsInfo", + "_toneMappingType": 0 } ] \ No newline at end of file diff --git a/assets/main.ts b/assets/main.ts index fd10bc4..bcca8ff 100644 --- a/assets/main.ts +++ b/assets/main.ts @@ -1,14 +1,40 @@ -import { _decorator, Component, Node } from 'cc'; -const { ccclass, property } = _decorator; +import { _decorator, Component } from 'cc'; +import { ViewManager } from './scripts/core/ViewManager'; +const { ccclass } = _decorator; +/** + * 主入口脚本 + * 负责初始化 ViewManager 并注册页面 + */ @ccclass('main') export class main extends Component { - start() { - + /** + * onLoad 比 start 更早执行 + * 确保 ViewManager 在 PageLoading.start() 之前初始化 + */ + onLoad() { + this._initViewManager(); } - update(deltaTime: number) { - + /** + * 初始化页面管理器 + */ + private _initViewManager(): void { + // 初始化 ViewManager,绑定 Canvas 作为页面容器 + ViewManager.instance.init(this.node); + + // 注册页面配置 + ViewManager.instance.register('PageHome', { + prefabPath: 'prefabs/PageHome', + cache: true, + zIndex: 0 + }); + + // 注册关卡页面 + ViewManager.instance.register('PageLevel', { + prefabPath: 'prefabs/PageLevel', + cache: true, + zIndex: 1 + }); } } - diff --git a/assets/resources/images/IconSetting.png b/assets/resources/images/IconSetting.png new file mode 100644 index 0000000..02a8337 Binary files /dev/null and b/assets/resources/images/IconSetting.png differ diff --git a/assets/resources/images/IconSetting.png.meta b/assets/resources/images/IconSetting.png.meta new file mode 100644 index 0000000..dda4e62 --- /dev/null +++ b/assets/resources/images/IconSetting.png.meta @@ -0,0 +1,134 @@ +{ + "ver": "1.0.27", + "importer": "image", + "imported": true, + "uuid": "9c27734d-854f-476b-961d-d1b92c75f8c0", + "files": [ + ".json", + ".png" + ], + "subMetas": { + "6c48a": { + "importer": "texture", + "uuid": "9c27734d-854f-476b-961d-d1b92c75f8c0@6c48a", + "displayName": "IconSetting", + "id": "6c48a", + "name": "texture", + "userData": { + "wrapModeS": "clamp-to-edge", + "wrapModeT": "clamp-to-edge", + "imageUuidOrDatabaseUri": "9c27734d-854f-476b-961d-d1b92c75f8c0", + "isUuid": true, + "visible": false, + "minfilter": "linear", + "magfilter": "linear", + "mipfilter": "none", + "anisotropy": 0 + }, + "ver": "1.0.22", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + }, + "f9941": { + "importer": "sprite-frame", + "uuid": "9c27734d-854f-476b-961d-d1b92c75f8c0@f9941", + "displayName": "IconSetting", + "id": "f9941", + "name": "spriteFrame", + "userData": { + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 108, + "height": 108, + "rawWidth": 108, + "rawHeight": 108, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "packable": true, + "pixelsToUnit": 100, + "pivotX": 0.5, + "pivotY": 0.5, + "meshType": 0, + "vertices": { + "rawPosition": [ + -54, + -54, + 0, + 54, + -54, + 0, + -54, + 54, + 0, + 54, + 54, + 0 + ], + "indexes": [ + 0, + 1, + 2, + 2, + 1, + 3 + ], + "uv": [ + 0, + 108, + 108, + 108, + 0, + 0, + 108, + 0 + ], + "nuv": [ + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1 + ], + "minPos": [ + -54, + -54, + 0 + ], + "maxPos": [ + 54, + 54, + 0 + ] + }, + "isUuid": true, + "imageUuidOrDatabaseUri": "9c27734d-854f-476b-961d-d1b92c75f8c0@6c48a", + "atlasUuid": "", + "trimType": "auto" + }, + "ver": "1.0.12", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + } + }, + "userData": { + "type": "sprite-frame", + "fixAlphaTransparencyArtifacts": false, + "hasAlpha": true, + "redirect": "9c27734d-854f-476b-961d-d1b92c75f8c0@6c48a" + } +} diff --git a/assets/resources/images/pageHome.meta b/assets/resources/images/pageHome.meta new file mode 100644 index 0000000..8b63ed3 --- /dev/null +++ b/assets/resources/images/pageHome.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "aa456c3f-1dcf-4937-a285-c5a9562d0ea1", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/resources/images/pageHome/startGame.png b/assets/resources/images/pageHome/startGame.png new file mode 100644 index 0000000..cb47767 Binary files /dev/null and b/assets/resources/images/pageHome/startGame.png differ diff --git a/assets/resources/images/pageHome/startGame.png.meta b/assets/resources/images/pageHome/startGame.png.meta new file mode 100644 index 0000000..ef27e2a --- /dev/null +++ b/assets/resources/images/pageHome/startGame.png.meta @@ -0,0 +1,134 @@ +{ + "ver": "1.0.27", + "importer": "image", + "imported": true, + "uuid": "010e6809-3636-4c23-8403-1424c771f0f8", + "files": [ + ".json", + ".png" + ], + "subMetas": { + "6c48a": { + "importer": "texture", + "uuid": "010e6809-3636-4c23-8403-1424c771f0f8@6c48a", + "displayName": "startGame", + "id": "6c48a", + "name": "texture", + "userData": { + "wrapModeS": "clamp-to-edge", + "wrapModeT": "clamp-to-edge", + "imageUuidOrDatabaseUri": "010e6809-3636-4c23-8403-1424c771f0f8", + "isUuid": true, + "visible": false, + "minfilter": "linear", + "magfilter": "linear", + "mipfilter": "none", + "anisotropy": 0 + }, + "ver": "1.0.22", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + }, + "f9941": { + "importer": "sprite-frame", + "uuid": "010e6809-3636-4c23-8403-1424c771f0f8@f9941", + "displayName": "startGame", + "id": "f9941", + "name": "spriteFrame", + "userData": { + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 216, + "height": 107, + "rawWidth": 216, + "rawHeight": 107, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "packable": true, + "pixelsToUnit": 100, + "pivotX": 0.5, + "pivotY": 0.5, + "meshType": 0, + "vertices": { + "rawPosition": [ + -108, + -53.5, + 0, + 108, + -53.5, + 0, + -108, + 53.5, + 0, + 108, + 53.5, + 0 + ], + "indexes": [ + 0, + 1, + 2, + 2, + 1, + 3 + ], + "uv": [ + 0, + 107, + 216, + 107, + 0, + 0, + 216, + 0 + ], + "nuv": [ + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1 + ], + "minPos": [ + -108, + -53.5, + 0 + ], + "maxPos": [ + 108, + 53.5, + 0 + ] + }, + "isUuid": true, + "imageUuidOrDatabaseUri": "010e6809-3636-4c23-8403-1424c771f0f8@6c48a", + "atlasUuid": "", + "trimType": "auto" + }, + "ver": "1.0.12", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + } + }, + "userData": { + "type": "sprite-frame", + "fixAlphaTransparencyArtifacts": false, + "hasAlpha": true, + "redirect": "010e6809-3636-4c23-8403-1424c771f0f8@6c48a" + } +} diff --git a/assets/resources/images/pageHome/test.png b/assets/resources/images/pageHome/test.png new file mode 100644 index 0000000..b0f6326 Binary files /dev/null and b/assets/resources/images/pageHome/test.png differ diff --git a/assets/resources/images/pageHome/test.png.meta b/assets/resources/images/pageHome/test.png.meta new file mode 100644 index 0000000..f057def --- /dev/null +++ b/assets/resources/images/pageHome/test.png.meta @@ -0,0 +1,134 @@ +{ + "ver": "1.0.27", + "importer": "image", + "imported": true, + "uuid": "fa1861ef-84d3-4347-9bf0-7627f54b05de", + "files": [ + ".json", + ".png" + ], + "subMetas": { + "6c48a": { + "importer": "texture", + "uuid": "fa1861ef-84d3-4347-9bf0-7627f54b05de@6c48a", + "displayName": "test", + "id": "6c48a", + "name": "texture", + "userData": { + "wrapModeS": "clamp-to-edge", + "wrapModeT": "clamp-to-edge", + "imageUuidOrDatabaseUri": "fa1861ef-84d3-4347-9bf0-7627f54b05de", + "isUuid": true, + "visible": false, + "minfilter": "linear", + "magfilter": "linear", + "mipfilter": "none", + "anisotropy": 0 + }, + "ver": "1.0.22", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + }, + "f9941": { + "importer": "sprite-frame", + "uuid": "fa1861ef-84d3-4347-9bf0-7627f54b05de@f9941", + "displayName": "test", + "id": "f9941", + "name": "spriteFrame", + "userData": { + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 352, + "height": 776, + "rawWidth": 352, + "rawHeight": 776, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "packable": true, + "pixelsToUnit": 100, + "pivotX": 0.5, + "pivotY": 0.5, + "meshType": 0, + "vertices": { + "rawPosition": [ + -176, + -388, + 0, + 176, + -388, + 0, + -176, + 388, + 0, + 176, + 388, + 0 + ], + "indexes": [ + 0, + 1, + 2, + 2, + 1, + 3 + ], + "uv": [ + 0, + 776, + 352, + 776, + 0, + 0, + 352, + 0 + ], + "nuv": [ + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1 + ], + "minPos": [ + -176, + -388, + 0 + ], + "maxPos": [ + 176, + 388, + 0 + ] + }, + "isUuid": true, + "imageUuidOrDatabaseUri": "fa1861ef-84d3-4347-9bf0-7627f54b05de@6c48a", + "atlasUuid": "", + "trimType": "auto" + }, + "ver": "1.0.12", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + } + }, + "userData": { + "type": "sprite-frame", + "fixAlphaTransparencyArtifacts": false, + "hasAlpha": true, + "redirect": "fa1861ef-84d3-4347-9bf0-7627f54b05de@6c48a" + } +} diff --git a/assets/resources/images/pageLevel.meta b/assets/resources/images/pageLevel.meta new file mode 100644 index 0000000..098f562 --- /dev/null +++ b/assets/resources/images/pageLevel.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "6e13548b-e5a3-4b8d-b6c0-2a5f394f1487", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/resources/images/pageLevel/AdButton.png b/assets/resources/images/pageLevel/AdButton.png new file mode 100644 index 0000000..34271c6 Binary files /dev/null and b/assets/resources/images/pageLevel/AdButton.png differ diff --git a/assets/resources/images/pageLevel/AdButton.png.meta b/assets/resources/images/pageLevel/AdButton.png.meta new file mode 100644 index 0000000..9c5c5c3 --- /dev/null +++ b/assets/resources/images/pageLevel/AdButton.png.meta @@ -0,0 +1,134 @@ +{ + "ver": "1.0.27", + "importer": "image", + "imported": true, + "uuid": "d264bb8e-0d8c-48a5-a720-31c10e358a7d", + "files": [ + ".json", + ".png" + ], + "subMetas": { + "6c48a": { + "importer": "texture", + "uuid": "d264bb8e-0d8c-48a5-a720-31c10e358a7d@6c48a", + "displayName": "AdButton", + "id": "6c48a", + "name": "texture", + "userData": { + "wrapModeS": "clamp-to-edge", + "wrapModeT": "clamp-to-edge", + "imageUuidOrDatabaseUri": "d264bb8e-0d8c-48a5-a720-31c10e358a7d", + "isUuid": true, + "visible": false, + "minfilter": "linear", + "magfilter": "linear", + "mipfilter": "none", + "anisotropy": 0 + }, + "ver": "1.0.22", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + }, + "f9941": { + "importer": "sprite-frame", + "uuid": "d264bb8e-0d8c-48a5-a720-31c10e358a7d@f9941", + "displayName": "AdButton", + "id": "f9941", + "name": "spriteFrame", + "userData": { + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 417, + "height": 142, + "rawWidth": 417, + "rawHeight": 142, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "packable": true, + "pixelsToUnit": 100, + "pivotX": 0.5, + "pivotY": 0.5, + "meshType": 0, + "vertices": { + "rawPosition": [ + -208.5, + -71, + 0, + 208.5, + -71, + 0, + -208.5, + 71, + 0, + 208.5, + 71, + 0 + ], + "indexes": [ + 0, + 1, + 2, + 2, + 1, + 3 + ], + "uv": [ + 0, + 142, + 417, + 142, + 0, + 0, + 417, + 0 + ], + "nuv": [ + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1 + ], + "minPos": [ + -208.5, + -71, + 0 + ], + "maxPos": [ + 208.5, + 71, + 0 + ] + }, + "isUuid": true, + "imageUuidOrDatabaseUri": "d264bb8e-0d8c-48a5-a720-31c10e358a7d@6c48a", + "atlasUuid": "", + "trimType": "auto" + }, + "ver": "1.0.12", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + } + }, + "userData": { + "type": "sprite-frame", + "fixAlphaTransparencyArtifacts": false, + "hasAlpha": true, + "redirect": "d264bb8e-0d8c-48a5-a720-31c10e358a7d@6c48a" + } +} diff --git a/assets/resources/prefabs.meta b/assets/resources/prefabs.meta new file mode 100644 index 0000000..c959b27 --- /dev/null +++ b/assets/resources/prefabs.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "8c0aeae3-2147-4c02-a1d2-2694fbe4aacf", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/resources/prefabs/PageHome.prefab b/assets/resources/prefabs/PageHome.prefab new file mode 100644 index 0000000..873b604 --- /dev/null +++ b/assets/resources/prefabs/PageHome.prefab @@ -0,0 +1,560 @@ +[ + { + "__type__": "cc.Prefab", + "_name": "PageHome", + "_objFlags": 0, + "__editorExtras__": {}, + "_native": "", + "data": { + "__id__": 1 + }, + "optimizationPolicy": 0, + "persistent": false + }, + { + "__type__": "cc.Node", + "_name": "PageHome", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": null, + "_children": [ + { + "__id__": 2 + }, + { + "__id__": 10 + } + ], + "_active": true, + "_components": [ + { + "__id__": 20 + }, + { + "__id__": 22 + }, + { + "__id__": 24 + } + ], + "_prefab": { + "__id__": 26 + }, + "_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": "516nXwOy1HyILEPLAixt3+" + }, + { + "__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": "caSJymhl1EjYDJB5ONQknn" + }, + { + "__type__": "d33b0ZrKQJEaKZYN2Peg+C/", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": { + "__id__": 8 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "5fvoDQhtZHSaQ4OjsBm2R+" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "34DqITevxDppujuUM+M3Ep", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "startGame", + "_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": 0, + "y": -800.532, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1.583, + "y": 1.583, + "z": 1.583 + }, + "_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": 216, + "height": 107 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "35asQ5bFtJOr9Onmy9xZov" + }, + { + "__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__": "010e6809-3636-4c23-8403-1424c771f0f8@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": "bbY0DIwZZE564mJcuIqyL2" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 10 + }, + "_enabled": true, + "__prefab": { + "__id__": 16 + }, + "_alignFlags": 4, + "_target": null, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 194.77749999999992, + "_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": "daRisiwm1PEKRk63d1ICPO" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 10 + }, + "_enabled": true, + "__prefab": { + "__id__": 18 + }, + "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": "29dh3pT0tGe4UqoNypQFFz" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "24z1aCS5BGUoUcLzSowxMh", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 21 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1080, + "height": 2160 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "3fh/GQw5BFtaWjY2iRXZNj" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 23 + }, + "_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": 1080, + "_originalHeight": 2160, + "_alignMode": 2, + "_lockFlags": 0, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "adez9PYBlO+o5jJaEuv12a" + }, + { + "__type__": "ada67C1KJZGrIrj62ihFzBE", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 25 + }, + "startGameBtn": { + "__id__": 10 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "59sKvUi4BJY43S8yX+l4bC" + }, + { + "__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/resources/prefabs/PageHome.prefab.meta b/assets/resources/prefabs/PageHome.prefab.meta new file mode 100644 index 0000000..0760d52 --- /dev/null +++ b/assets/resources/prefabs/PageHome.prefab.meta @@ -0,0 +1,13 @@ +{ + "ver": "1.1.50", + "importer": "prefab", + "imported": true, + "uuid": "ae6e1ab4-19be-4cb3-90e4-9a1f3204a0fd", + "files": [ + ".json" + ], + "subMetas": {}, + "userData": { + "syncNodeName": "PageHome" + } +} diff --git a/assets/resources/prefabs/PageHome.ts b/assets/resources/prefabs/PageHome.ts new file mode 100644 index 0000000..0e0db3b --- /dev/null +++ b/assets/resources/prefabs/PageHome.ts @@ -0,0 +1,64 @@ +import { _decorator, Node, Button } from 'cc'; +import { BaseView } from '../../scripts/core/BaseView'; +import { ViewManager } from '../../scripts/core/ViewManager'; +const { ccclass, property } = _decorator; + +/** + * 首页组件 + * 继承 BaseView,实现页面生命周期 + */ +@ccclass('PageHome') +export class PageHome extends BaseView { + @property({ type: Node, tooltip: '开始游戏按钮' }) + startGameBtn: Node | null = null; + + /** + * 页面首次加载时调用 + */ + onViewLoad(): void { + console.log('[PageHome] onViewLoad'); + this._initButtons(); + } + + /** + * 初始化按钮事件 + */ + private _initButtons(): void { + if (this.startGameBtn) { + this.startGameBtn.on(Button.EventType.CLICK, this._onStartGameClick, this); + } + } + + /** + * 开始游戏按钮点击回调 + */ + private _onStartGameClick(): void { + console.log('[PageHome] 开始游戏按钮点击'); + ViewManager.instance.open('PageLevel'); + } + + /** + * 页面每次显示时调用 + */ + onViewShow(): void { + console.log('[PageHome] onViewShow'); + } + + /** + * 页面隐藏时调用 + */ + onViewHide(): void { + console.log('[PageHome] onViewHide'); + } + + /** + * 页面销毁时调用 + */ + onViewDestroy(): void { + console.log('[PageHome] onViewDestroy'); + // 移除按钮事件监听 + if (this.startGameBtn) { + this.startGameBtn.off(Button.EventType.CLICK, this._onStartGameClick, this); + } + } +} diff --git a/assets/resources/prefabs/PageHome.ts.meta b/assets/resources/prefabs/PageHome.ts.meta new file mode 100644 index 0000000..443136d --- /dev/null +++ b/assets/resources/prefabs/PageHome.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "ada670b5-2896-46ac-8ae3-eb68a1173044", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/resources/prefabs/PageLevel.prefab b/assets/resources/prefabs/PageLevel.prefab new file mode 100644 index 0000000..5046212 --- /dev/null +++ b/assets/resources/prefabs/PageLevel.prefab @@ -0,0 +1,3276 @@ +[ + { + "__type__": "cc.Prefab", + "_name": "PageLevel", + "_objFlags": 0, + "__editorExtras__": {}, + "_native": "", + "data": { + "__id__": 1 + }, + "optimizationPolicy": 0, + "persistent": false + }, + { + "__type__": "cc.Node", + "_name": "PageLevel", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": null, + "_children": [ + { + "__id__": 2 + }, + { + "__id__": 10 + }, + { + "__id__": 18 + }, + { + "__id__": 118 + } + ], + "_active": true, + "_components": [ + { + "__id__": 132 + }, + { + "__id__": 134 + }, + { + "__id__": 136 + } + ], + "_prefab": { + "__id__": 138 + }, + "_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": "80WdxIr5tNCKAmMxTr9arK" + }, + { + "__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": "802e0GRj5OlZPWDkNAsqX9" + }, + { + "__type__": "d33b0ZrKQJEaKZYN2Peg+C/", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": { + "__id__": 8 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "dbhrI91MhPLYyyyP0uS5SE" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "70xAyWU9FPCaGEl4+7MCvL", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "IconSetting", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 11 + }, + { + "__id__": 13 + }, + { + "__id__": 15 + } + ], + "_prefab": { + "__id__": 17 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -420.451, + "y": 794.699, + "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": "1clsImNMZCq4gjWNYIOUFq" + }, + { + "__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": "fbQJvXkAVI95f2IOcKw2nx" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 10 + }, + "_enabled": true, + "__prefab": { + "__id__": 16 + }, + "_alignFlags": 9, + "_target": null, + "_left": 65.54899999999998, + "_right": 0, + "_top": 231.30100000000004, + "_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": "7fSph66PxCzKzewaKLPszT" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "b8AbrhFbFNAIT6XkLOpIN7", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "Main", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 19 + }, + { + "__id__": 25 + } + ], + "_active": true, + "_components": [ + { + "__id__": 113 + }, + { + "__id__": 115 + } + ], + "_prefab": { + "__id__": 117 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 194.34000000000003, + "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": "test", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 18 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 20 + }, + { + "__id__": 22 + } + ], + "_prefab": { + "__id__": 24 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 41.11, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1.474, + "y": 1.474, + "z": 1.474 + }, + "_mobility": 0, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 19 + }, + "_enabled": true, + "__prefab": { + "__id__": 21 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 352, + "height": 776 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "cf0c0/QO9FHIXbYgVpVPk9" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 19 + }, + "_enabled": true, + "__prefab": { + "__id__": 23 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "fa1861ef-84d3-4347-9bf0-7627f54b05de@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": "4cl8JkJR9Hxa1OR+kOT88O" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "f9HqkaQLBLlKIG0QTieYtd", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "Action", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 18 + }, + "_children": [ + { + "__id__": 26 + }, + { + "__id__": 32 + }, + { + "__id__": 98 + } + ], + "_active": true, + "_components": [ + { + "__id__": 108 + }, + { + "__id__": 110 + } + ], + "_prefab": { + "__id__": 112 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 46.913, + "y": -680.19, + "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__": 25 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 27 + }, + { + "__id__": 29 + } + ], + "_prefab": { + "__id__": 31 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -200, + "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__": 26 + }, + "_enabled": true, + "__prefab": { + "__id__": 28 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 200, + "height": 126 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "ebbxJ4aVNJwb+rk+mgyChW" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 26 + }, + "_enabled": true, + "__prefab": { + "__id__": 30 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_string": "这是", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 100, + "_fontSize": 100, + "_fontFamily": "Arial", + "_lineHeight": 100, + "_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": "cdH29+tiBJqI3ELNCvXXWE" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "2ehdui305FJ7xM7Ya2xfC0", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "InputLayout", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 25 + }, + "_children": [ + { + "__id__": 33 + }, + { + "__id__": 53 + }, + { + "__id__": 73 + } + ], + "_active": true, + "_components": [ + { + "__id__": 93 + }, + { + "__id__": 95 + } + ], + "_prefab": { + "__id__": 97 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 47.531, + "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": "Input1", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 32 + }, + "_children": [ + { + "__id__": 34 + }, + { + "__id__": 40 + } + ], + "_active": true, + "_components": [ + { + "__id__": 46 + }, + { + "__id__": 48 + }, + { + "__id__": 50 + } + ], + "_prefab": { + "__id__": 52 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -60, + "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": "TEXT_LABEL", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 33 + }, + "_children": [], + "_active": false, + "_components": [ + { + "__id__": 35 + }, + { + "__id__": 37 + } + ], + "_prefab": { + "__id__": 39 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -48, + "y": 50, + "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": 98, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0, + "y": 1 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "eeaYFpgkxERoSIe3de28dr" + }, + { + "__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": 0, + "_verticalAlign": 1, + "_actualFontSize": 40, + "_fontSize": 20, + "_fontFamily": "Arial", + "_lineHeight": 40, + "_overflow": 1, + "_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": "e7XibgTnNCf5UOhz5xM8vP" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "11XPpIPmVJ25+/thbDYLUc", + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "PLACEHOLDER_LABEL", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 33 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 41 + }, + { + "__id__": 43 + } + ], + "_prefab": { + "__id__": 45 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -48, + "y": 50, + "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__": 40 + }, + "_enabled": true, + "__prefab": { + "__id__": 42 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 98, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0, + "y": 1 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "4c/wKO2pRB269pKlCEU185" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 40 + }, + "_enabled": true, + "__prefab": { + "__id__": 44 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 187, + "g": 187, + "b": 187, + "a": 255 + }, + "_string": "填写答案", + "_horizontalAlign": 0, + "_verticalAlign": 1, + "_actualFontSize": 20, + "_fontSize": 20, + "_fontFamily": "Arial", + "_lineHeight": 40, + "_overflow": 1, + "_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": "c4dTAqLbRLsIeauyg0OV8p" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "43UTUNAwdO7rFB4vGsaZ5a", + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 33 + }, + "_enabled": true, + "__prefab": { + "__id__": 47 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "1eHld/ifFGaY6fliU8LFfi" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 33 + }, + "_enabled": true, + "__prefab": { + "__id__": 49 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": null, + "_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": "feEHEaYGNJK75ldcFa8HYg" + }, + { + "__type__": "cc.EditBox", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 33 + }, + "_enabled": true, + "__prefab": { + "__id__": 51 + }, + "editingDidBegan": [], + "textChanged": [], + "editingDidEnded": [], + "editingReturn": [], + "_textLabel": { + "__id__": 37 + }, + "_placeholderLabel": { + "__id__": 43 + }, + "_returnType": 0, + "_string": "", + "_tabIndex": 0, + "_backgroundImage": null, + "_inputFlag": 5, + "_inputMode": 6, + "_maxLength": 8, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "02xu7B+GtJCoWV6l3iQuzJ" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "03pU7//sxEcI//olaHgI0r", + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "Input2", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 32 + }, + "_children": [ + { + "__id__": 54 + }, + { + "__id__": 60 + } + ], + "_active": true, + "_components": [ + { + "__id__": 66 + }, + { + "__id__": 68 + }, + { + "__id__": 70 + } + ], + "_prefab": { + "__id__": 72 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 60, + "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": "TEXT_LABEL", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 53 + }, + "_children": [], + "_active": false, + "_components": [ + { + "__id__": 55 + }, + { + "__id__": 57 + } + ], + "_prefab": { + "__id__": 59 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -48, + "y": 50, + "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__": 54 + }, + "_enabled": true, + "__prefab": { + "__id__": 56 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 98, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0, + "y": 1 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "8ep3HVkdRGxowmhF7imA3+" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 54 + }, + "_enabled": true, + "__prefab": { + "__id__": 58 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_string": "", + "_horizontalAlign": 0, + "_verticalAlign": 1, + "_actualFontSize": 40, + "_fontSize": 20, + "_fontFamily": "Arial", + "_lineHeight": 40, + "_overflow": 1, + "_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": "73MAjHjkNBJKJw2EoP8iBd" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "0bNl8aXhlNlorMlDBrCNNC", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "PLACEHOLDER_LABEL", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 53 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 61 + }, + { + "__id__": 63 + } + ], + "_prefab": { + "__id__": 65 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -48, + "y": 50, + "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__": 60 + }, + "_enabled": true, + "__prefab": { + "__id__": 62 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 98, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0, + "y": 1 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "fdwNN+6AlL07Rr4wZt/TSk" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 60 + }, + "_enabled": true, + "__prefab": { + "__id__": 64 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 187, + "g": 187, + "b": 187, + "a": 255 + }, + "_string": "填写答案", + "_horizontalAlign": 0, + "_verticalAlign": 1, + "_actualFontSize": 20, + "_fontSize": 20, + "_fontFamily": "Arial", + "_lineHeight": 40, + "_overflow": 1, + "_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": "7ag14s9FNN77mV/3gC0ZKM" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "d5EEQOf05AdJZAgE65UlOM", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 53 + }, + "_enabled": true, + "__prefab": { + "__id__": 67 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "a2Qz6NHJ1GzoC9o9btFfFm" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 53 + }, + "_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": 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": "51NPvBm3RGpJIXGEU9SfJZ" + }, + { + "__type__": "cc.EditBox", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 53 + }, + "_enabled": true, + "__prefab": { + "__id__": 71 + }, + "editingDidBegan": [], + "textChanged": [], + "editingDidEnded": [], + "editingReturn": [], + "_textLabel": { + "__id__": 57 + }, + "_placeholderLabel": { + "__id__": 63 + }, + "_returnType": 0, + "_string": "", + "_tabIndex": 0, + "_backgroundImage": null, + "_inputFlag": 5, + "_inputMode": 6, + "_maxLength": 8, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "a9h+0GPnpL9rV7auDLBlob" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "12fVl35AdIarSOZmPUYuSP", + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "Input3", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 32 + }, + "_children": [ + { + "__id__": 74 + }, + { + "__id__": 80 + } + ], + "_active": false, + "_components": [ + { + "__id__": 86 + }, + { + "__id__": 88 + }, + { + "__id__": 90 + } + ], + "_prefab": { + "__id__": 92 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 120, + "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": "TEXT_LABEL", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 73 + }, + "_children": [], + "_active": false, + "_components": [ + { + "__id__": 75 + }, + { + "__id__": 77 + } + ], + "_prefab": { + "__id__": 79 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -48, + "y": 50, + "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__": 74 + }, + "_enabled": true, + "__prefab": { + "__id__": 76 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 98, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0, + "y": 1 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "9fJvmjwYNJZYGWCPp0VaB2" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 74 + }, + "_enabled": true, + "__prefab": { + "__id__": 78 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_string": "", + "_horizontalAlign": 0, + "_verticalAlign": 1, + "_actualFontSize": 40, + "_fontSize": 20, + "_fontFamily": "Arial", + "_lineHeight": 40, + "_overflow": 1, + "_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": "18BjX9dWlJxKRWba5StKvL" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "e1VUvBLRdORIDEAxRQdv+Z", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "PLACEHOLDER_LABEL", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 73 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 81 + }, + { + "__id__": 83 + } + ], + "_prefab": { + "__id__": 85 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -48, + "y": 50, + "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__": 80 + }, + "_enabled": true, + "__prefab": { + "__id__": 82 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 98, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0, + "y": 1 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "57BUFpCXhIgpUqdvaS0Wzh" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 80 + }, + "_enabled": true, + "__prefab": { + "__id__": 84 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 187, + "g": 187, + "b": 187, + "a": 255 + }, + "_string": "填写答案", + "_horizontalAlign": 0, + "_verticalAlign": 1, + "_actualFontSize": 20, + "_fontSize": 20, + "_fontFamily": "Arial", + "_lineHeight": 40, + "_overflow": 1, + "_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": "f44aRzWTJJKIRhaUNXEaDd" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "6fFJ5LbRJES5d8ZziyK+PS", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 73 + }, + "_enabled": true, + "__prefab": { + "__id__": 87 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "23nWAABipNkoYc5yt1Xs7w" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 73 + }, + "_enabled": true, + "__prefab": { + "__id__": 89 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": null, + "_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": "096dzxlopI1LxXxkQ/CY8J" + }, + { + "__type__": "cc.EditBox", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 73 + }, + "_enabled": true, + "__prefab": { + "__id__": 91 + }, + "editingDidBegan": [], + "textChanged": [], + "editingDidEnded": [], + "editingReturn": [], + "_textLabel": { + "__id__": 77 + }, + "_placeholderLabel": { + "__id__": 83 + }, + "_returnType": 0, + "_string": "", + "_tabIndex": 0, + "_backgroundImage": null, + "_inputFlag": 5, + "_inputMode": 6, + "_maxLength": 8, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "7ch0RcYPtN4ruXmvpZqwpi" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "52Mx5EqHZMbaQb541EtPhy", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 32 + }, + "_enabled": true, + "__prefab": { + "__id__": 94 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 220, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "8e8ibLSNRJYb902GGC/s9+" + }, + { + "__type__": "cc.Layout", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 32 + }, + "_enabled": true, + "__prefab": { + "__id__": 96 + }, + "_resizeMode": 1, + "_layoutType": 1, + "_cellSize": { + "__type__": "cc.Size", + "width": 40, + "height": 40 + }, + "_startAxis": 0, + "_paddingLeft": 0, + "_paddingRight": 0, + "_paddingTop": 0, + "_paddingBottom": 0, + "_spacingX": 20, + "_spacingY": 0, + "_verticalDirection": 1, + "_horizontalDirection": 0, + "_constraint": 0, + "_constraintNum": 2, + "_affectedByScale": false, + "_isAlign": true, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "2dCn7uYatBRLETBXaXbcC6" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "71gWlovDJER4gFvaCwzo/Q", + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "SubmitButton", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 25 + }, + "_children": [ + { + "__id__": 99 + } + ], + "_active": true, + "_components": [ + { + "__id__": 105 + } + ], + "_prefab": { + "__id__": 107 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 170, + "y": 41.081, + "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__": 98 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 100 + }, + { + "__id__": 102 + } + ], + "_prefab": { + "__id__": 104 + }, + "_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__": 99 + }, + "_enabled": true, + "__prefab": { + "__id__": 101 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 160, + "height": 50.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "beSIENsV9Hv7F1To7lGgtW" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 99 + }, + "_enabled": true, + "__prefab": { + "__id__": 103 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 241, + "g": 2, + "b": 2, + "a": 255 + }, + "_string": "提交答案", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 40, + "_fontSize": 40, + "_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": "62pZl7xGZO/pzOJVlIcuzO" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "a91nWCyfxNwY18KADht9KN", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 98 + }, + "_enabled": true, + "__prefab": { + "__id__": 106 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "9eoyMarC5Ox6M4yCVeS+Ds" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "f3NOFIoXFJPo/SeCtTbqDR", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 25 + }, + "_enabled": true, + "__prefab": { + "__id__": 109 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 600, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "95uEcqYPRJ/JsQWGHMXn20" + }, + { + "__type__": "cc.Layout", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 25 + }, + "_enabled": true, + "__prefab": { + "__id__": 111 + }, + "_resizeMode": 0, + "_layoutType": 1, + "_cellSize": { + "__type__": "cc.Size", + "width": 40, + "height": 40 + }, + "_startAxis": 0, + "_paddingLeft": 0, + "_paddingRight": 0, + "_paddingTop": 0, + "_paddingBottom": 0, + "_spacingX": 0, + "_spacingY": 0, + "_verticalDirection": 1, + "_horizontalDirection": 0, + "_constraint": 0, + "_constraintNum": 2, + "_affectedByScale": false, + "_isAlign": false, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "f4CxQ7laRFOp09gI0UW91w" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "4deoRli6lG4Le/Y/sMCn6i", + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 18 + }, + "_enabled": true, + "__prefab": { + "__id__": 114 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "fcDdoVyqdNrKGRQS4GWxFT" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 18 + }, + "_enabled": true, + "__prefab": { + "__id__": 116 + }, + "_alignFlags": 1, + "_target": null, + "_left": 0, + "_right": 0, + "_top": 835.66, + "_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": "bdjc5eMMRKlI7cSmDD70aq" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "f1Ufzs3/tBT7in6cA5KJBy", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "AdButton", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 119 + } + ], + "_active": true, + "_components": [ + { + "__id__": 125 + }, + { + "__id__": 127 + }, + { + "__id__": 129 + } + ], + "_prefab": { + "__id__": 131 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": -698.012, + "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__": 118 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 120 + }, + { + "__id__": 122 + } + ], + "_prefab": { + "__id__": 124 + }, + "_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__": 119 + }, + "_enabled": true, + "__prefab": { + "__id__": 121 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 120, + "height": 75.6 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "c4fxmhHPdOXZNPfCJgvkqw" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 119 + }, + "_enabled": true, + "__prefab": { + "__id__": 123 + }, + "_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": "45xft6XbBGy4B+2CX692Kx" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "d6diVKl29CVqpZ5sVJVXbX", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 118 + }, + "_enabled": true, + "__prefab": { + "__id__": 126 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 417, + "height": 142 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "1fFAHIxOJE9Y0bwlk/wokh" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 118 + }, + "_enabled": true, + "__prefab": { + "__id__": 128 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "d264bb8e-0d8c-48a5-a720-31c10e358a7d@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": "b0NixKbH9It4kI0yHfzbB8" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 118 + }, + "_enabled": true, + "__prefab": { + "__id__": 130 + }, + "_alignFlags": 4, + "_target": null, + "_left": 0, + "_right": 0, + "_top": 1707.012, + "_bottom": 310.98800000000006, + "_horizontalCenter": 0, + "_verticalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 142, + "_alignMode": 2, + "_lockFlags": 0, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "5ctGaR1hJA1r7ROWouQNte" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "f2lG4UerlKn7JYXi+DsiOJ", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 133 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1080, + "height": 2160 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "1b9lC20QBLwoZnmAJu/p6J" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 135 + }, + "_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": "36SnLYviJDJb2n5bMKjrxz" + }, + { + "__type__": "14b23Xg5klHer6xeJDbjQya", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 137 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "e2itWq4ZlL5b9D690HcX3O" + }, + { + "__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/resources/prefabs/PageLevel.prefab.meta b/assets/resources/prefabs/PageLevel.prefab.meta new file mode 100644 index 0000000..b3e97ee --- /dev/null +++ b/assets/resources/prefabs/PageLevel.prefab.meta @@ -0,0 +1,13 @@ +{ + "ver": "1.1.50", + "importer": "prefab", + "imported": true, + "uuid": "8611dbdc-4749-49f1-97ca-aedae3d16320", + "files": [ + ".json" + ], + "subMetas": {}, + "userData": { + "syncNodeName": "PageLevel" + } +} diff --git a/assets/resources/prefabs/PageLevel.ts b/assets/resources/prefabs/PageLevel.ts new file mode 100644 index 0000000..6030358 --- /dev/null +++ b/assets/resources/prefabs/PageLevel.ts @@ -0,0 +1,39 @@ +import { _decorator } from 'cc'; +import { BaseView } from '../../scripts/core/BaseView'; +const { ccclass } = _decorator; + +/** + * 关卡页面组件 + * 继承 BaseView,实现页面生命周期 + */ +@ccclass('PageLevel') +export class PageLevel extends BaseView { + /** + * 页面首次加载时调用 + */ + onViewLoad(): void { + console.log('[PageLevel] onViewLoad'); + } + + /** + * 页面每次显示时调用 + */ + onViewShow(): void { + console.log('[PageLevel] onViewShow'); + } + + /** + * 页面隐藏时调用 + */ + onViewHide(): void { + console.log('[PageLevel] onViewHide'); + } + + /** + * 页面销毁时调用 + */ + onViewDestroy(): void { + console.log('[PageLevel] onViewDestroy'); + } +} + diff --git a/assets/resources/prefabs/PageLevel.ts.meta b/assets/resources/prefabs/PageLevel.ts.meta new file mode 100644 index 0000000..dcd2c2e --- /dev/null +++ b/assets/resources/prefabs/PageLevel.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "14b235e0-e649-477a-beb1-7890db8d0c9a", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/scripts/core.meta b/assets/scripts/core.meta new file mode 100644 index 0000000..b2a288f --- /dev/null +++ b/assets/scripts/core.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/scripts/core/BaseView.ts b/assets/scripts/core/BaseView.ts new file mode 100644 index 0000000..6da6bf9 --- /dev/null +++ b/assets/scripts/core/BaseView.ts @@ -0,0 +1,131 @@ +import { _decorator, Component } from 'cc'; +const { ccclass } = _decorator; + +/** + * 页面配置接口 + */ +export interface ViewConfig { + prefabPath: string; // 相对于 resources 的路径 + cache?: boolean; // 是否缓存页面,默认 true + zIndex?: number; // 层级,默认 0 +} + +/** + * 页面打开选项 + */ +export interface ViewOptions { + params?: any; // 传递给页面的参数 + onComplete?: (view: BaseView) => void; + onError?: (err: Error) => void; +} + +/** + * 页面基类 + * 所有页面组件应继承此类,实现生命周期方法 + */ +@ccclass('BaseView') +export class BaseView extends Component { + /** 页面唯一标识 */ + viewId: string = ''; + + /** 页面配置 */ + config: ViewConfig | null = null; + + /** 是否正在显示 */ + isShowing: boolean = false; + + /** 传递给页面的参数 */ + protected _params: any = null; + + /** + * 设置页面参数 + */ + setParams(params: any): void { + this._params = params; + } + + /** + * 获取页面参数 + */ + getParams(): any { + return this._params; + } + + /** + * 页面加载时调用(首次创建时) + * 子类应重写此方法 + */ + onViewLoad(): void { + // 子类实现 + } + + /** + * 页面显示时调用(每次打开时) + * 子类应重写此方法 + */ + onViewShow(): void { + // 子类实现 + } + + /** + * 页面隐藏时调用(关闭或被其他页面覆盖时) + * 子类应重写此方法 + */ + onViewHide(): void { + // 子类实现 + } + + /** + * 页面销毁时调用 + * 子类应重写此方法 + */ + onViewDestroy(): void { + // 子类实现 + } + + // ========== 内部方法,由 ViewManager 调用 ========== + + /** + * 内部方法:执行显示逻辑 + */ + _doShow(): void { + if (this.isShowing) return; + this.isShowing = true; + this.node.active = true; + this.onViewShow(); + } + + /** + * 内部方法:执行隐藏逻辑 + */ + _doHide(): void { + if (!this.isShowing) return; + this.isShowing = false; + this.onViewHide(); + this.node.active = false; + } + + /** + * 内部方法:执行销毁逻辑 + */ + _doDestroy(): void { + // 标记已销毁,防止 onDestroy 中重复调用 + this._destroyed = true; + this.node.destroy(); + } + + /** 是否已标记销毁 */ + private _destroyed: boolean = false; + + // ========== Cocos 生命周期 ========== + + protected onDestroy(): void { + // 仅在未被 _doDestroy 调用时执行生命周期 + if (!this._destroyed) { + if (this.isShowing) { + this.onViewHide(); + } + } + this.onViewDestroy(); + } +} diff --git a/assets/scripts/core/BaseView.ts.meta b/assets/scripts/core/BaseView.ts.meta new file mode 100644 index 0000000..b4cbae3 --- /dev/null +++ b/assets/scripts/core/BaseView.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "b1c2d3e4-f5a6-7890-bcde-f12345678901", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/scripts/core/ViewManager.ts b/assets/scripts/core/ViewManager.ts new file mode 100644 index 0000000..6f67cb3 --- /dev/null +++ b/assets/scripts/core/ViewManager.ts @@ -0,0 +1,350 @@ +import { _decorator, Node, resources, Prefab, instantiate, error } from 'cc'; +import { BaseView, ViewConfig, ViewOptions } from './BaseView'; +const { ccclass } = _decorator; + +/** + * 已注册的页面配置映射 + */ +interface RegisteredView { + config: ViewConfig; + prefab: Prefab | null; // 缓存的预制体 +} + +/** + * 页面管理器 + * 单例模式,统一管理页面的注册、打开、关闭、返回等操作 + */ +@ccclass('ViewManager') +export class ViewManager { + /** 单例实例 */ + private static _instance: ViewManager | null = null; + + /** 获取单例 */ + public static get instance(): ViewManager { + if (!ViewManager._instance) { + ViewManager._instance = new ViewManager(); + } + return ViewManager._instance; + } + + /** 页面容器节点 */ + private _container: Node | null = null; + + /** 已注册的页面配置 */ + private _registeredViews: Map = new Map(); + + /** 页面栈 */ + private _viewStack: BaseView[] = []; + + /** 页面实例缓存(用于缓存模式的页面) */ + private _viewCache: Map = new Map(); + + /** + * 初始化管理器 + * @param container 页面容器节点(通常是 Canvas) + */ + init(container: Node): void { + this._container = container; + } + + /** + * 获取当前容器 + */ + getContainer(): Node | null { + return this._container; + } + + /** + * 注册页面 + * @param viewId 页面唯一标识 + * @param config 页面配置 + */ + register(viewId: string, config: ViewConfig): void { + if (this._registeredViews.has(viewId)) { + error(`ViewManager: 页面 "${viewId}" 已注册`); + return; + } + + this._registeredViews.set(viewId, { + config: { + cache: true, // 默认缓存 + zIndex: 0, // 默认层级 + ...config + }, + prefab: null + }); + } + + /** + * 批量注册页面 + * @param views 页面配置映射 + */ + registerAll(views: Record): void { + for (const [viewId, config] of Object.entries(views)) { + this.register(viewId, config); + } + } + + /** + * 打开页面 + * @param viewId 页面唯一标识 + * @param options 打开选项 + */ + open(viewId: string, options?: ViewOptions): void { + if (!this._container) { + const err = new Error('ViewManager: 未初始化,请先调用 init()'); + options?.onError?.(err); + return; + } + + const registered = this._registeredViews.get(viewId); + if (!registered) { + const err = new Error(`ViewManager: 页面 "${viewId}" 未注册`); + options?.onError?.(err); + return; + } + + // 检查是否有缓存的实例 + const cachedView = this._viewCache.get(viewId); + if (cachedView && cachedView.node.isValid) { + this._showView(cachedView, options); + return; + } + + // 检查是否有缓存的预制体 + if (registered.prefab) { + this._instantiateView(viewId, registered.prefab, options); + return; + } + + // 动态加载预制体 + resources.load(registered.config.prefabPath, Prefab, (err, prefab) => { + if (err) { + error(`ViewManager: 加载预制体失败 "${registered.config.prefabPath}"`, err); + options?.onError?.(err); + return; + } + + // 缓存预制体 + registered.prefab = prefab; + this._instantiateView(viewId, prefab!, options); + }); + } + + /** + * 实例化视图 + */ + private _instantiateView(viewId: string, prefab: Prefab, options?: ViewOptions): void { + if (!this._container) return; + + const registered = this._registeredViews.get(viewId); + if (!registered) return; + + const node = instantiate(prefab); + const view = node.getComponent(BaseView); + + if (!view) { + error(`ViewManager: 预制体 "${registered.config.prefabPath}" 缺少 BaseView 组件`); + node.destroy(); + options?.onError?.(new Error('缺少 BaseView 组件')); + return; + } + + // 设置视图属性 + view.viewId = viewId; + view.config = registered.config; + view.setParams(options?.params); + + // 设置层级 + node.setSiblingIndex(registered.config.zIndex || 0); + + // 添加到容器 + this._container.addChild(node); + + // 调用加载回调 + view.onViewLoad(); + + // 缓存视图实例 + if (registered.config.cache) { + this._viewCache.set(viewId, view); + } + + // 显示视图 + this._showView(view, options); + } + + /** + * 显示视图 + */ + private _showView(view: BaseView, options?: ViewOptions): void { + // 隐藏当前页面 + const currentView = this.getCurrentView(); + if (currentView && currentView !== view) { + currentView._doHide(); + } + + // 设置参数 + if (options?.params !== undefined) { + view.setParams(options?.params); + } + + // 入栈 + if (!this._viewStack.includes(view)) { + this._viewStack.push(view); + } + + // 显示 + view._doShow(); + + // 回调 + options?.onComplete?.(view); + } + + /** + * 关闭当前页面 + * @param options 关闭选项 + */ + close(options?: { destroy?: boolean }): void { + const currentView = this._viewStack.pop(); + if (!currentView) return; + + const shouldDestroy = options?.destroy ?? !currentView.config?.cache; + this._hideAndDestroyView(currentView, shouldDestroy); + + // 显示上一页 + const prevView = this.getCurrentView(); + if (prevView) { + prevView._doShow(); + } + } + + /** + * 返回上一页(close 的别名) + */ + back(): void { + this.close(); + } + + /** + * 替换当前页面 + * @param viewId 新页面标识 + * @param options 打开选项 + */ + replace(viewId: string, options?: ViewOptions): void { + const currentView = this.getCurrentView(); + if (currentView) { + this._viewStack.pop(); + const shouldDestroy = !currentView.config?.cache; + this._hideAndDestroyView(currentView, shouldDestroy); + } + + this.open(viewId, options); + } + + /** + * 隐藏并销毁视图(内部方法) + */ + private _hideAndDestroyView(view: BaseView, shouldDestroy: boolean): void { + view._doHide(); + if (shouldDestroy) { + this._viewCache.delete(view.viewId); + view._doDestroy(); + } + } + + /** + * 获取当前页面 + */ + getCurrentView(): BaseView | null { + return this._viewStack.length > 0 + ? this._viewStack[this._viewStack.length - 1] + : null; + } + + /** + * 获取页面栈 + */ + getViewStack(): BaseView[] { + return [...this._viewStack]; + } + + /** + * 清空所有页面 + */ + clearAll(): void { + // 从栈顶开始销毁 + while (this._viewStack.length > 0) { + const view = this._viewStack.pop()!; + const shouldDestroy = !view.config?.cache; + this._hideAndDestroyView(view, shouldDestroy); + } + + // 销毁缓存的页面 + for (const view of this._viewCache.values()) { + if (view.node.isValid) { + view._doDestroy(); + } + } + + this._viewCache.clear(); + } + + /** + * 预加载页面预制体 + * @param viewId 页面标识 + * @param onProgress 进度回调 + * @param onComplete 完成回调 + */ + preload(viewId: string, onProgress?: (progress: number) => void, onComplete?: () => void): void { + const registered = this._registeredViews.get(viewId); + if (!registered) { + error(`ViewManager: 页面 "${viewId}" 未注册`); + onComplete?.(); + return; + } + + // 已缓存 + if (registered.prefab) { + onProgress?.(1); + onComplete?.(); + return; + } + + resources.load(registered.config.prefabPath, Prefab, (err, prefab) => { + if (err) { + error(`ViewManager: 预加载失败 "${registered.config.prefabPath}"`, err); + } else { + registered.prefab = prefab; + onProgress?.(1); + } + onComplete?.(); + }); + } + + /** + * 批量预加载页面 + * @param viewIds 页面标识数组 + * @param onProgress 总进度回调 (0-1) + * @param onComplete 完成回调 + */ + preloadAll(viewIds: string[], onProgress?: (progress: number) => void, onComplete?: () => void): void { + if (viewIds.length === 0) { + onProgress?.(1); + onComplete?.(); + return; + } + + let completed = 0; + const total = viewIds.length; + + for (const viewId of viewIds) { + this.preload(viewId, () => { + completed++; + onProgress?.(completed / total); + if (completed === total) { + onComplete?.(); + } + }); + } + } +} diff --git a/assets/scripts/core/ViewManager.ts.meta b/assets/scripts/core/ViewManager.ts.meta new file mode 100644 index 0000000..10a8466 --- /dev/null +++ b/assets/scripts/core/ViewManager.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "c2d3e4f5-a6b7-7890-cdef-123456789012", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/tsconfig.json b/tsconfig.json index 7dc649a..da71375 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,6 +4,16 @@ /* Add your custom configuration here. */ "compilerOptions": { - "strict": false + "strict": false, + "allowSyntheticDefaultImports": true, + "types": [ + "minigame-api-typings" + ], + "lib": ["es2018", "dom"], + "module": "es2020", + "moduleResolution": "node", + "noUnusedLocals": true, + "noUnusedParameters": true, + "resolveJsonModule": true } }