diff --git a/assets/Scene/Home/Home.fire b/assets/Scene/Home/Home.fire index 8a3767c..3d14bcd 100755 --- a/assets/Scene/Home/Home.fire +++ b/assets/Scene/Home/Home.fire @@ -17,7 +17,7 @@ "__id__": 2 }, { - "__id__": 25 + "__id__": 46 } ], "_active": true, @@ -79,18 +79,27 @@ }, { "__id__": 8 + }, + { + "__id__": 22 + }, + { + "__id__": 25 + }, + { + "__id__": 28 } ], "_active": true, "_components": [ { - "__id__": 22 + "__id__": 43 }, { - "__id__": 23 + "__id__": 44 }, { - "__id__": 24 + "__id__": 45 } ], "_prefab": null, @@ -180,7 +189,7 @@ "array": [ 0, 0, - 452.9632127266895, + 443.4050067376326, 0, 0, 0, @@ -413,7 +422,7 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - 0, + 114.353, 0, 0, 0, @@ -941,7 +950,7 @@ "_top": 0, "_bottom": 0, "_verticalCenter": 0, - "_horizontalCenter": 0, + "_horizontalCenter": 114.353, "_isAbsLeft": true, "_isAbsRight": true, "_isAbsTop": true, @@ -952,6 +961,878 @@ "_originalHeight": 0, "_id": "4dfeszqQhHFJ2XKq0g+0is" }, + { + "__type__": "cc.Node", + "_name": "ewm", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 23 + }, + { + "__id__": 24 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 200, + "height": 200 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -464.317, + 80.029, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "c2jhg/G6RBRIuYfkhFSEw6" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 22 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "802b4004-09af-4e51-9f68-21dbc96a0e02" + }, + "_type": 0, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "2dsaZEuT5M86kPEqmrYvS4" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 22 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 18, + "_left": 0, + "_right": 20, + "_top": 20, + "_bottom": 0, + "_verticalCenter": 80.029, + "_horizontalCenter": -464.317, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "11idPMH5tOeIz+U2My+MDU" + }, + { + "__type__": "cc.Node", + "_name": "slogan", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 26 + }, + { + "__id__": 27 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 168, + "height": 90.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -462.767, + -88.825, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "3fn6Z6u9FBn7PBJ0sKUvlq" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 25 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_useOriginalSize": false, + "_string": "我是 异名\n用代码实现想法", + "_N$string": "我是 异名\n用代码实现想法", + "_fontSize": 24, + "_lineHeight": 40, + "_enableWrapText": true, + "_N$file": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_batchAsBitmap": false, + "_styleFlags": 0, + "_underlineHeight": 0, + "_N$horizontalAlign": 1, + "_N$verticalAlign": 1, + "_N$fontFamily": "Arial", + "_N$overflow": 0, + "_N$cacheMode": 0, + "_id": "7bNe62jc9BnYCtWdSGdBwN" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 25 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 18, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_verticalCenter": -88.825, + "_horizontalCenter": -462.767, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "86F1BIRH5Ey4q0zmYyRxPi" + }, + { + "__type__": "cc.Node", + "_name": "loading", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_children": [ + { + "__id__": 29 + }, + { + "__id__": 32 + }, + { + "__id__": 35 + } + ], + "_active": false, + "_components": [ + { + "__id__": 41 + }, + { + "__id__": 42 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 27, + "g": 38, + "b": 46, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1334, + "height": 750 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "e6ZcnD2JhJQpZ1Uu9ZuEYe" + }, + { + "__type__": "cc.Node", + "_name": "avatar", + "_objFlags": 0, + "_parent": { + "__id__": 28 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 30 + }, + { + "__id__": 31 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 200, + "height": 200 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 75.872, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "9as7ycfpNMQpO0/LvBFXAh" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 29 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "ee4860e7-78d7-4f1a-a1e2-e2c9201ef1b0" + }, + "_type": 0, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "abmamrQsBJ04UImjb4L/aa" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 29 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 18, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_verticalCenter": 75.872, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "2fFGze64dJ4oVsUZz+uo26" + }, + { + "__type__": "cc.Node", + "_name": "slogan", + "_objFlags": 0, + "_parent": { + "__id__": 28 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 33 + }, + { + "__id__": 34 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 168, + "height": 90.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + -93.547, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "bcYJrMovFEqI/p8qw9SuCt" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 32 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_useOriginalSize": false, + "_string": "我是 异名\n用代码实现想法", + "_N$string": "我是 异名\n用代码实现想法", + "_fontSize": 24, + "_lineHeight": 40, + "_enableWrapText": true, + "_N$file": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_batchAsBitmap": false, + "_styleFlags": 0, + "_underlineHeight": 0, + "_N$horizontalAlign": 1, + "_N$verticalAlign": 1, + "_N$fontFamily": "Arial", + "_N$overflow": 0, + "_N$cacheMode": 0, + "_id": "97ZJ3W+stEQJHYx1lnl08n" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 32 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 18, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_verticalCenter": -93.547, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "51y0r2IjtC06ZJNQ5xGP+/" + }, + { + "__type__": "cc.Node", + "_name": "progressBar", + "_objFlags": 0, + "_parent": { + "__id__": 28 + }, + "_children": [ + { + "__id__": 36 + } + ], + "_active": true, + "_components": [ + { + "__id__": 38 + }, + { + "__id__": 39 + }, + { + "__id__": 40 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 700, + "height": 15 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + -194.252, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "0aa3CKn0BBcqxkc0JsCMTP" + }, + { + "__type__": "cc.Node", + "_name": "bar", + "_objFlags": 0, + "_parent": { + "__id__": 35 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 37 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 0, + "height": 15 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -350, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "c9ly+OPO9MRbht8uE4Zn00" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 36 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "67e68bc9-dad5-4ad9-a2d8-7e03d458e32f" + }, + "_type": 1, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "9ewv5bNHNEiLcRl2sjGxEp" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 35 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "88e79fd5-96b4-4a77-a1f4-312467171014" + }, + "_type": 1, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "7aYUYOvYdIi4EaV7EQkKxK" + }, + { + "__type__": "cc.ProgressBar", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 35 + }, + "_enabled": true, + "_N$totalLength": 700, + "_N$barSprite": { + "__id__": 37 + }, + "_N$mode": 0, + "_N$progress": 0, + "_N$reverse": false, + "_id": "77TnqzgktDqJAIt23Hj70D" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 35 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 18, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_verticalCenter": -194.252, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "6dXiEsUVtPuZt7YdgOo6qW" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 28 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 45, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "4aluLI0nFMXqnkuF7ZdfZT" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 28 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "0f531716-c3f6-47e8-be65-4248dfca78d8" + }, + "_type": 0, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "26gf4c5phCmrF/37lBZvG/" + }, { "__type__": "cc.Canvas", "_name": "", @@ -1004,6 +1885,12 @@ "__id__": 2 }, "_enabled": true, + "loadingNode": { + "__id__": 28 + }, + "loadingProgress": { + "__id__": 39 + }, "scrollContent": { "__id__": 14 }, @@ -1023,16 +1910,16 @@ "_active": true, "_components": [ { - "__id__": 26 + "__id__": 47 }, { - "__id__": 27 + "__id__": 48 }, { - "__id__": 28 + "__id__": 49 }, { - "__id__": 30 + "__id__": 51 } ], "_prefab": null, @@ -1088,7 +1975,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 25 + "__id__": 46 }, "_enabled": true, "_materials": [ @@ -1120,7 +2007,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 25 + "__id__": 46 }, "_enabled": true, "alignMode": 1, @@ -1147,7 +2034,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 25 + "__id__": 46 }, "_enabled": true, "_normalMaterial": { @@ -1158,7 +2045,7 @@ "zoomScale": 1.1, "clickEvents": [ { - "__id__": 29 + "__id__": 50 } ], "_N$interactable": true, @@ -1219,7 +2106,7 @@ { "__type__": "cc.ClickEvent", "target": { - "__id__": 25 + "__id__": 46 }, "component": "", "_componentId": "f673bb9HWxERKP4rUNhzg42", @@ -1231,7 +2118,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 25 + "__id__": 46 }, "_enabled": true, "_id": "f1IGHg+lpP16AlzNEKM60q" diff --git a/assets/Scene/Home/Home.ts b/assets/Scene/Home/Home.ts index 58cc871..108d434 100644 --- a/assets/Scene/Home/Home.ts +++ b/assets/Scene/Home/Home.ts @@ -1,14 +1,19 @@ -import BackHomeBtn from "./BackHomeBtn"; -const {ccclass, property} = cc._decorator; +import BackHomeBtn from './BackHomeBtn'; +const { ccclass, property } = cc._decorator; +const LOAD_SCENE_MIN_SEC: number = 1.2; enum sceneList { - "Infinite_bg_scroll" = "背景无限滚动", - "Joystick" = "遥控杆", - "Coin_fly_to_wallet" = "金币落袋", - "Magnifying_mirror" = "放大镜" + 'Infinite_bg_scroll' = '背景无限滚动', + 'Joystick' = '遥控杆', + 'Coin_fly_to_wallet' = '金币落袋', + 'Magnifying_mirror' = '放大镜' } @ccclass export default class Home extends cc.Component { + @property(cc.Node) + loadingNode: cc.Node = null; + @property(cc.ProgressBar) + loadingProgress: cc.ProgressBar = null; @property(cc.Node) scrollContent: cc.Node = null; @property(cc.Prefab) @@ -23,42 +28,83 @@ export default class Home extends cc.Component { } judgeJump() { - const sceneName = this.getQueryStringByName("sceneName"); - const isSameVisit = window["isSameVisit"]; + const sceneName = this.getQueryStringByName('sceneName'); + const isSameVisit = window['isSameVisit']; if (!sceneName) return; if (isSameVisit) return; if (sceneList[sceneName]) { - window["isSameVisit"] = true; + window['isSameVisit'] = true; this.loadScene(sceneName); } } getQueryStringByName(name) { - let result = window.location.search.match(new RegExp("[\?\&]" + name+ "=([^\&]+)","i")); - return result == null || result.length < 1 ? "" : result[1]; + let result = window.location.search.match(new RegExp('[?&]' + name + '=([^&]+)', 'i')); + return result == null || result.length < 1 ? '' : result[1]; } initScrollItem() { for (let key in sceneList) { let scrollItem = cc.instantiate(this.scrollItemPrefab); - scrollItem.getChildByName("label").getComponent(cc.Label).string = sceneList[key]; - scrollItem.on(cc.Node.EventType.TOUCH_END, () => { - cc.tween(scrollItem) - .to(0.1, { scale: 1.05 }) - .to(0.1, { scale: 1 }) - .start(); - this.loadScene(key); - }, this); + scrollItem.getChildByName('label').getComponent(cc.Label).string = sceneList[key]; + scrollItem.on( + cc.Node.EventType.TOUCH_END, + () => { + cc.tween(scrollItem) + .to(0.1, { scale: 1.05 }) + .to(0.1, { scale: 1 }) + .start(); + this.loadScene(key); + }, + this + ); this.scrollContent.addChild(scrollItem); } } + beginLoad: boolean = false; + finishLoadFlag: boolean = false; + loadTime: number = 0; + loadSceneName: string = ''; loadScene(key) { - cc.director.loadScene(key); - BackHomeBtn.instance.toggleActive(true); + if (this.beginLoad) return; + this.loadingProgress.progress = 0; + this.loadingNode.active = true; + this.beginLoad = true; + this.loadSceneName = key; + + cc.director.preloadScene( + key, + (completedCount, totalCount) => { + // 还是做假进度条吧,缓存之后太快了,一闪而过的体验不好 + // this.loadingProgress.progress = completedCount / totalCount; + }, + (error, asset) => { + if (!error) { + this.finishLoadFlag = true; + } else { + this.loadingNode.active = false; + this.beginLoad = false; + this.loadTime = 0; + } + } + ); + } + + update(dt) { + if (!this.beginLoad) return; + + if (this.loadTime >= LOAD_SCENE_MIN_SEC && this.finishLoadFlag) { + this.loadingProgress.progress = 1; + BackHomeBtn.instance.toggleActive(true); + cc.director.loadScene(this.loadSceneName); + } else { + this.loadTime += dt; + this.loadingProgress.progress = Math.min(this.loadTime / LOAD_SCENE_MIN_SEC, this.finishLoadFlag ? 1 : 0.9); + } } } diff --git a/assets/Texture.meta b/assets/Scene/Home/Texture.meta similarity index 100% rename from assets/Texture.meta rename to assets/Scene/Home/Texture.meta diff --git a/assets/Scene/Home/Texture/avatar.png b/assets/Scene/Home/Texture/avatar.png new file mode 100644 index 0000000..ee804bc Binary files /dev/null and b/assets/Scene/Home/Texture/avatar.png differ diff --git a/assets/Texture/th.jpeg.meta b/assets/Scene/Home/Texture/avatar.png.meta similarity index 61% rename from assets/Texture/th.jpeg.meta rename to assets/Scene/Home/Texture/avatar.png.meta index c489282..2d75145 100644 --- a/assets/Texture/th.jpeg.meta +++ b/assets/Scene/Home/Texture/avatar.png.meta @@ -1,20 +1,20 @@ { "ver": "2.3.4", - "uuid": "1c14c2d0-c971-4bca-a2be-8458a3083f70", + "uuid": "faefe167-15a3-45f1-8281-920ba11dd0f6", "type": "sprite", "wrapMode": "clamp", "filterMode": "bilinear", "premultiplyAlpha": false, "genMipmaps": false, "packable": true, - "width": 474, - "height": 316, + "width": 1350, + "height": 1350, "platformSettings": {}, "subMetas": { - "th": { + "avatar": { "ver": "1.0.4", - "uuid": "c569c4d9-3ae8-496d-ac64-40c32782c594", - "rawTextureUuid": "1c14c2d0-c971-4bca-a2be-8458a3083f70", + "uuid": "ee4860e7-78d7-4f1a-a1e2-e2c9201ef1b0", + "rawTextureUuid": "faefe167-15a3-45f1-8281-920ba11dd0f6", "trimType": "auto", "trimThreshold": 1, "rotated": false, @@ -22,10 +22,10 @@ "offsetY": 0, "trimX": 0, "trimY": 0, - "width": 474, - "height": 316, - "rawWidth": 474, - "rawHeight": 316, + "width": 1350, + "height": 1350, + "rawWidth": 1350, + "rawHeight": 1350, "borderTop": 0, "borderBottom": 0, "borderLeft": 0, diff --git a/assets/Texture/back.png b/assets/Scene/Home/Texture/back.png similarity index 100% rename from assets/Texture/back.png rename to assets/Scene/Home/Texture/back.png diff --git a/assets/Texture/back.png.meta b/assets/Scene/Home/Texture/back.png.meta similarity index 100% rename from assets/Texture/back.png.meta rename to assets/Scene/Home/Texture/back.png.meta diff --git a/assets/Texture/btn.png b/assets/Scene/Home/Texture/btn.png similarity index 100% rename from assets/Texture/btn.png rename to assets/Scene/Home/Texture/btn.png diff --git a/assets/Texture/btn.png.meta b/assets/Scene/Home/Texture/btn.png.meta similarity index 100% rename from assets/Texture/btn.png.meta rename to assets/Scene/Home/Texture/btn.png.meta diff --git a/assets/Scene/Home/Texture/ewm.jpg b/assets/Scene/Home/Texture/ewm.jpg new file mode 100644 index 0000000..ef2d642 Binary files /dev/null and b/assets/Scene/Home/Texture/ewm.jpg differ diff --git a/assets/Texture/npm_1.png.meta b/assets/Scene/Home/Texture/ewm.jpg.meta similarity index 62% rename from assets/Texture/npm_1.png.meta rename to assets/Scene/Home/Texture/ewm.jpg.meta index 9405849..bd442db 100644 --- a/assets/Texture/npm_1.png.meta +++ b/assets/Scene/Home/Texture/ewm.jpg.meta @@ -1,20 +1,20 @@ { "ver": "2.3.4", - "uuid": "3f716868-44f8-4ff2-9f85-72917cc049da", + "uuid": "b7a2debd-36ee-4af0-abf4-1fbde3a8cb9a", "type": "sprite", "wrapMode": "clamp", "filterMode": "bilinear", "premultiplyAlpha": false, "genMipmaps": false, "packable": true, - "width": 78, - "height": 67, + "width": 258, + "height": 258, "platformSettings": {}, "subMetas": { - "npm_1": { + "ewm": { "ver": "1.0.4", - "uuid": "d4d6a44a-040e-442d-ab8f-1fa461cafd87", - "rawTextureUuid": "3f716868-44f8-4ff2-9f85-72917cc049da", + "uuid": "802b4004-09af-4e51-9f68-21dbc96a0e02", + "rawTextureUuid": "b7a2debd-36ee-4af0-abf4-1fbde3a8cb9a", "trimType": "auto", "trimThreshold": 1, "rotated": false, @@ -22,10 +22,10 @@ "offsetY": 0, "trimX": 0, "trimY": 0, - "width": 78, - "height": 67, - "rawWidth": 78, - "rawHeight": 67, + "width": 258, + "height": 258, + "rawWidth": 258, + "rawHeight": 258, "borderTop": 0, "borderBottom": 0, "borderLeft": 0, diff --git a/assets/Texture/singleColor.png b/assets/Scene/Home/Texture/singleColor.png similarity index 100% rename from assets/Texture/singleColor.png rename to assets/Scene/Home/Texture/singleColor.png diff --git a/assets/Texture/singleColor.png.meta b/assets/Scene/Home/Texture/singleColor.png.meta similarity index 100% rename from assets/Texture/singleColor.png.meta rename to assets/Scene/Home/Texture/singleColor.png.meta diff --git a/assets/Texture/npm_1.png b/assets/Texture/npm_1.png deleted file mode 100755 index be142b5..0000000 Binary files a/assets/Texture/npm_1.png and /dev/null differ diff --git a/assets/Texture/th.jpeg b/assets/Texture/th.jpeg deleted file mode 100644 index 089d997..0000000 Binary files a/assets/Texture/th.jpeg and /dev/null differ diff --git a/settings/builder.json b/settings/builder.json index b2dbd4e..64ace0a 100755 --- a/settings/builder.json +++ b/settings/builder.json @@ -13,7 +13,7 @@ "includeSDKBox": false, "inlineSpriteFrames": true, "inlineSpriteFrames_native": true, - "mergeStartScene": false, + "mergeStartScene": true, "optimizeHotUpdate": false, "md5Cache": true, "encryptJs": true, diff --git a/tsconfig.json b/tsconfig.json index 8eb39c7..4ade440 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,4 +14,4 @@ "build", "settings" ] -} \ No newline at end of file +}