Commit 34343ce8 authored by liujiangnan's avatar liujiangnan

feat: 初始项目

parent 9f5f5457
...@@ -73,24 +73,18 @@ ...@@ -73,24 +73,18 @@
}, },
{ {
"__id__": 5 "__id__": 5
},
{
"__id__": 7
},
{
"__id__": 14
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 24 "__id__": 29
}, },
{ {
"__id__": 25 "__id__": 30
}, },
{ {
"__id__": 26 "__id__": 31
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -246,11 +240,36 @@ ...@@ -246,11 +240,36 @@
"_parent": { "_parent": {
"__id__": 2 "__id__": 2
}, },
"_children": [], "_children": [
{
"__id__": 6
},
{
"__id__": 9
},
{
"__id__": 12
},
{
"__id__": 15
},
{
"__id__": 18
},
{
"__id__": 21
},
{
"__id__": 24
}
],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 6 "__id__": 27
},
{
"__id__": 28
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -301,55 +320,23 @@ ...@@ -301,55 +320,23 @@
"groupIndex": 0, "groupIndex": 0,
"_id": "32MJMZ2HRGF4BOf533Avyi" "_id": "32MJMZ2HRGF4BOf533Avyi"
}, },
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "8288e3d4-4c75-4b27-8f01-f7014417f4dd"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "97/S6HDq9MeqgmV1Zwnhbb"
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "bottomPart", "_name": "L1",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 2 "__id__": 5
}, },
"_children": [ "_children": [],
"_active": true,
"_components": [
{ {
"__id__": 8 "__id__": 7
}, },
{ {
"__id__": 11 "__id__": 8
} }
], ],
"_active": true,
"_components": [],
"_prefab": null, "_prefab": null,
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
...@@ -361,8 +348,8 @@ ...@@ -361,8 +348,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 0, "width": 758,
"height": 0 "height": 658
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -373,8 +360,8 @@ ...@@ -373,8 +360,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
635.132, 0,
-356.326, 25,
0, 0,
0, 0,
0, 0,
...@@ -396,23 +383,82 @@ ...@@ -396,23 +383,82 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "8c7k8ep/ZFNpO263+1QHz9" "_id": "fdy94CGuJJebL0i6UN62s7"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "73ee82cc-cc95-4a87-aaeb-1b23510cd553"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "484ut7LpdAwb1xQR7W/dxt"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 44,
"_left": 261,
"_right": 261,
"_top": 5.783999999999992,
"_bottom": 56,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 758,
"_originalHeight": 658,
"_id": "07THWDGGZAipiEgNUBeRP+"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "btn_left", "_name": "L2",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 7 "__id__": 5
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 9 "__id__": 10
}, },
{ {
"__id__": 10 "__id__": 11
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -426,8 +472,8 @@ ...@@ -426,8 +472,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 61, "width": 758,
"height": 67 "height": 654
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -438,8 +484,8 @@ ...@@ -438,8 +484,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-148.464, 4000,
34, 25,
0, 0,
0, 0,
0, 0,
...@@ -461,14 +507,14 @@ ...@@ -461,14 +507,14 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "5ad2wLQLxIN5Eg7OHecSH6" "_id": "f4lt3B7w1KS6z0pujvvqW8"
}, },
{ {
"__type__": "cc.Sprite", "__type__": "cc.Sprite",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 8 "__id__": 9
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -479,7 +525,7 @@ ...@@ -479,7 +525,7 @@
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "ce19457d-e8f3-4c38-ae3e-d4b99208ddb5" "__uuid__": "c05bf4f2-9a22-42bb-b96a-2c42af2bff94"
}, },
"_type": 0, "_type": 0,
"_sizeMode": 1, "_sizeMode": 1,
...@@ -493,91 +539,50 @@ ...@@ -493,91 +539,50 @@
"_fillRange": 0, "_fillRange": 0,
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_atlas": null, "_atlas": null,
"_id": "84mqOgJ3JNqZrYVTEU8CjE" "_id": "e8/bKe8khIm5owbGqKU2SM"
}, },
{ {
"__type__": "cc.Button", "__type__": "cc.Widget",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 8 "__id__": 9
}, },
"_enabled": true, "_enabled": true,
"_normalMaterial": null, "alignMode": 1,
"_grayMaterial": null, "_target": null,
"duration": 0.1, "_alignFlags": 44,
"zoomScale": 1.2, "_left": 4261,
"clickEvents": [], "_right": -3739,
"_N$interactable": true, "_top": 0,
"_N$enableAutoGrayEffect": false, "_bottom": 58,
"_N$transition": 0, "_verticalCenter": 0,
"transition": 0, "_horizontalCenter": 0,
"_N$normalColor": { "_isAbsLeft": true,
"__type__": "cc.Color", "_isAbsRight": true,
"r": 255, "_isAbsTop": true,
"g": 255, "_isAbsBottom": true,
"b": 255, "_isAbsHorizontalCenter": true,
"a": 255 "_isAbsVerticalCenter": true,
}, "_originalWidth": 758,
"_N$pressedColor": { "_originalHeight": 0,
"__type__": "cc.Color", "_id": "0fEyIAf7xC15e3sRmX1PQY"
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "bcYN/4EKBJhbIAfovo9Ah1"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "btn_right", "_name": "L3",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 7 "__id__": 5
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 12 "__id__": 13
}, },
{ {
"__id__": 13 "__id__": 14
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -591,8 +596,8 @@ ...@@ -591,8 +596,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 60, "width": 758,
"height": 66 "height": 663
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -603,8 +608,8 @@ ...@@ -603,8 +608,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-47.164, 4000,
34, 25,
0, 0,
0, 0,
0, 0,
...@@ -626,14 +631,14 @@ ...@@ -626,14 +631,14 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "46i3stdzpHX6zQHTGnRsNE" "_id": "bcUe2b05pJpZ/iWGCwATKw"
}, },
{ {
"__type__": "cc.Sprite", "__type__": "cc.Sprite",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 11 "__id__": 12
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -644,7 +649,7 @@ ...@@ -644,7 +649,7 @@
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "e5a2dbaa-a677-4a32-90d7-a1b057d7fb59" "__uuid__": "c7f0e5e8-9863-4a07-bc17-728bc32aa3aa"
}, },
"_type": 0, "_type": 0,
"_sizeMode": 1, "_sizeMode": 1,
...@@ -658,96 +663,52 @@ ...@@ -658,96 +663,52 @@
"_fillRange": 0, "_fillRange": 0,
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_atlas": null, "_atlas": null,
"_id": "42Sh8QS/BHn4WiGyPQPKPt" "_id": "beHq9/TI9GdYQp5+HfdCLb"
}, },
{ {
"__type__": "cc.Button", "__type__": "cc.Widget",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 11 "__id__": 12
}, },
"_enabled": true, "_enabled": true,
"_normalMaterial": null, "alignMode": 1,
"_grayMaterial": null, "_target": null,
"duration": 0.1, "_alignFlags": 44,
"zoomScale": 1.2, "_left": 4261,
"clickEvents": [], "_right": -3739,
"_N$interactable": true, "_top": 0,
"_N$enableAutoGrayEffect": false, "_bottom": 53.5,
"_N$transition": 0, "_verticalCenter": 0,
"transition": 0, "_horizontalCenter": 0,
"_N$normalColor": { "_isAbsLeft": true,
"__type__": "cc.Color", "_isAbsRight": true,
"r": 255, "_isAbsTop": true,
"g": 255, "_isAbsBottom": true,
"b": 255, "_isAbsHorizontalCenter": true,
"a": 255 "_isAbsVerticalCenter": true,
}, "_originalWidth": 758,
"_N$pressedColor": { "_originalHeight": 0,
"__type__": "cc.Color", "_id": "d4lSBj2OVKq7de9EJc/vXX"
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "1aj32fYY1IxLesa77E70Qu"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "res", "_name": "L4",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 2 "__id__": 5
}, },
"_children": [ "_children": [],
{ "_active": true,
"__id__": 15 "_components": [
},
{ {
"__id__": 18 "__id__": 16
}, },
{ {
"__id__": 21 "__id__": 17
} }
], ],
"_active": false,
"_components": [],
"_prefab": null, "_prefab": null,
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
...@@ -759,8 +720,8 @@ ...@@ -759,8 +720,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 0, "width": 758,
"height": 0 "height": 652
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -771,8 +732,8 @@ ...@@ -771,8 +732,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 4000,
0, 25.100000000000023,
0, 0,
0, 0,
0, 0,
...@@ -794,82 +755,82 @@ ...@@ -794,82 +755,82 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "0aAzbH6R1E+6AmGRrkKa5O" "_id": "79X54yKPpPJImkq7+/+nIt"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Sprite",
"_name": "font", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "node": {
"__id__": 14 "__id__": 15
}, },
"_children": [ "_enabled": true,
"_materials": [
{ {
"__id__": 16 "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
} }
], ],
"_active": true, "_srcBlendFactor": 770,
"_components": [], "_dstBlendFactor": 771,
"_prefab": null, "_spriteFrame": {
"_opacity": 255, "__uuid__": "6151ff0a-a839-42c0-a350-799d435d48e1"
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
}, },
"_anchorPoint": { "_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2", "__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, "x": 0,
"y": 0, "y": 0
"z": 0
}, },
"_skewX": 0, "_fillStart": 0,
"_skewY": 0, "_fillRange": 0,
"_is3DNode": false, "_isTrimmedMode": true,
"_groupIndex": 0, "_atlas": null,
"groupIndex": 0, "_id": "7ap36dY3xGNpWw5UUzsTt/"
"_id": "9bLfcYeeNKrr524vzWchiM" },
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 15
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 44,
"_left": 4261,
"_right": -3739,
"_top": 0,
"_bottom": 59.10000000000002,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 758,
"_originalHeight": 0,
"_id": "6bADrYUGhKGqLkqvUeg1To"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "BRLNSDB", "_name": "L5",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 15 "__id__": 5
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 17 "__id__": 19
},
{
"__id__": 20
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -883,8 +844,8 @@ ...@@ -883,8 +844,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 0, "width": 758,
"height": 0 "height": 651
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -895,8 +856,8 @@ ...@@ -895,8 +856,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 4000,
0, 21.5,
0, 0,
0, 0,
0, 0,
...@@ -918,113 +879,82 @@ ...@@ -918,113 +879,82 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "cfMLGsq0BMhJARv+ySMAxS" "_id": "4fc7tUSV9FF6SK45Eaw8DM"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Sprite",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 16 "__id__": 18
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "",
"_N$string": "",
"_fontSize": 40,
"_lineHeight": 40,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "c551970e-b095-45f3-9f1d-25cde8b8deb1"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 0,
"_N$verticalAlign": 0,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "9bNHNPu5lC7rQYyr8ai/sY"
},
{
"__type__": "cc.Node",
"_name": "img",
"_objFlags": 0,
"_parent": {
"__id__": 14
},
"_children": [
{ {
"__id__": 19 "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
} }
], ],
"_active": true, "_srcBlendFactor": 770,
"_components": [], "_dstBlendFactor": 771,
"_prefab": null, "_spriteFrame": {
"_opacity": 255, "__uuid__": "6784fe91-2825-4714-93a4-17fdf3136770"
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
}, },
"_anchorPoint": { "_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2", "__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, "x": 0,
"y": 0, "y": 0
"z": 0
}, },
"_skewX": 0, "_fillStart": 0,
"_skewY": 0, "_fillRange": 0,
"_is3DNode": false, "_isTrimmedMode": true,
"_groupIndex": 0, "_atlas": null,
"groupIndex": 0, "_id": "aa946bn2lEqZo267Nqperc"
"_id": "53LUHHG2pEr79fyrvazXJs" },
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 18
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 44,
"_left": 4261,
"_right": -3739,
"_top": 0,
"_bottom": 56,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 758,
"_originalHeight": 0,
"_id": "96t8kRxu1CVqkSs7uNhULW"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "icon", "_name": "left",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 18 "__id__": 5
}, },
"_children": [], "_children": [],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 20 "__id__": 22
},
{
"__id__": 23
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1038,8 +968,8 @@ ...@@ -1038,8 +968,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 138, "width": 97,
"height": 141 "height": 83
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -1050,8 +980,8 @@ ...@@ -1050,8 +980,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, -495,
0, 35,
0, 0,
0, 0,
0, 0,
...@@ -1073,21 +1003,25 @@ ...@@ -1073,21 +1003,25 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "1blU2OArJIfoC9XfupGxJG" "_id": "eeEy3oiwZCnq6hGOreHlWY"
}, },
{ {
"__type__": "cc.Sprite", "__type__": "cc.Sprite",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 19 "__id__": 21
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "6fbc30a8-3c49-44ae-8ba4-7f56f385b78a" "__uuid__": "b54dc5ad-f87a-4546-902a-7489f01aefab"
}, },
"_type": 0, "_type": 0,
"_sizeMode": 1, "_sizeMode": 1,
...@@ -1101,22 +1035,52 @@ ...@@ -1101,22 +1035,52 @@
"_fillRange": 0, "_fillRange": 0,
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_atlas": null, "_atlas": null,
"_id": "03GEWUEZJGyKormWgIWCtM" "_id": "04frnoIpRMNZ6B26DyGhav"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 21
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 12,
"_left": 96.5,
"_right": 0,
"_top": 283.5,
"_bottom": 353.5,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 83,
"_id": "bckqPuJrlNW4z66BNltLcH"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "audio", "_name": "right",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 14 "__id__": 5
}, },
"_children": [ "_children": [],
"_active": true,
"_components": [
{ {
"__id__": 22 "__id__": 25
},
{
"__id__": 26
} }
], ],
"_active": true,
"_components": [],
"_prefab": null, "_prefab": null,
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
...@@ -1128,8 +1092,8 @@ ...@@ -1128,8 +1092,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 0, "width": 98,
"height": 0 "height": 84
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -1140,8 +1104,8 @@ ...@@ -1140,8 +1104,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 475,
0, 35,
0, 0,
0, 0,
0, 0,
...@@ -1163,88 +1127,125 @@ ...@@ -1163,88 +1127,125 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "d9f+b0lmZGSJJae6zrADhp" "_id": "28bCD+ru1Jd6lxFHiEBmmR"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Sprite",
"_name": "btn", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "node": {
"__id__": 21 "__id__": 24
}, },
"_children": [], "_enabled": true,
"_active": true, "_materials": [
"_components": [
{ {
"__id__": 23 "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
} }
], ],
"_prefab": null, "_srcBlendFactor": 770,
"_opacity": 255, "_dstBlendFactor": 771,
"_color": { "_spriteFrame": {
"__type__": "cc.Color", "__uuid__": "a0e0bf64-61fd-4600-8e32-40232e778401"
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
}, },
"_anchorPoint": { "_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0.5, "x": 0,
"y": 0.5 "y": 0
}, },
"_trs": { "_fillStart": 0,
"__type__": "TypedArray", "_fillRange": 0,
"ctor": "Float64Array", "_isTrimmedMode": true,
"array": [ "_atlas": null,
0, "_id": "81h5tyJo5OvI2doq/H6aN3"
0, },
0, {
0, "__type__": "cc.Widget",
0, "_name": "",
0, "_objFlags": 0,
1, "node": {
1, "__id__": 24
1,
1
]
}, },
"_eulerAngles": { "_enabled": true,
"__type__": "cc.Vec3", "alignMode": 1,
"_target": null,
"_alignFlags": 36,
"_left": 0,
"_right": 116,
"_top": 283,
"_bottom": 353,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 84,
"_id": "970IOH5qhBBoOe8jBaFZ8/"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "8c9ac73a-70de-4fdf-a921-c6860553d77c"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0, "x": 0,
"y": 0, "y": 0
"z": 0
}, },
"_skewX": 0, "_fillStart": 0,
"_skewY": 0, "_fillRange": 0,
"_is3DNode": false, "_isTrimmedMode": true,
"_groupIndex": 0, "_atlas": null,
"groupIndex": 0, "_id": "97/S6HDq9MeqgmV1Zwnhbb"
"_id": "e87DSaFCVJfb2PAUkf4/o7"
}, },
{ {
"__type__": "cc.AudioSource", "__type__": "cc.Widget",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 22 "__id__": 5
}, },
"_enabled": true, "_enabled": true,
"_clip": { "alignMode": 1,
"__uuid__": "f0680ae0-c079-45ef-abd7-9e63d90b982b" "_target": null,
}, "_alignFlags": 45,
"_volume": 1, "_left": 0,
"_mute": false, "_right": 0,
"_loop": false, "_top": 0,
"_firstlyEnabled": true, "_bottom": 0,
"playOnLoad": false, "_verticalCenter": 0,
"preload": false, "_horizontalCenter": 0,
"_id": "dey05oKrBIspvsDa6pOIQz" "_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 1280,
"_originalHeight": 720,
"_id": "2cQO3mFh9Hc5lEGQg/wNaF"
}, },
{ {
"__type__": "cc.Canvas", "__type__": "cc.Canvas",
......
import { asyncDelay, onHomeworkFinish } from "../script/util";
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent";
const { ccclass, property } = cc._decorator;
@ccclass
export default class SceneComponent extends MyCocosSceneComponent {
addPreloadImage() {
// TODO 根据自己的配置预加载图片资源
}
addPreloadAudio() {
// TODO 根据自己的配置预加载音频资源
}
addPreloadAnima() {
}
onLoadEnd() {
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.initData();
this.initView();
this.initListener();
}
_cantouch = null;
initData() {
// 所有全局变量 默认都是null
this._cantouch = true;
}
initView() {
this.initBg();
this.initBtn();
}
initBg() {
}
initBtn() {
}
currentIndex = 0;
leftMove() {
const node = cc.find(`Canvas/bg/L${this.currentIndex+1}`);
const nextNode = cc.find(`Canvas/bg/L${this.currentIndex+2}`);
this._cantouch = false;
cc.tween(node)
.to(.3, { x: -4000 }, { easing: 'cubicInOut' })
.call(() => {
cc.tween(nextNode)
.to(.3, { x: 0 }, { easing: 'cubicInOut' })
.call(() => {
this.currentIndex ++;
cc.find(`Canvas/bg/right`).active = this.currentIndex<4;
cc.find(`Canvas/bg/left`).active = this.currentIndex>0;
this._cantouch = true;
})
.start();
})
.start();
}
rightMove() {
const node = cc.find(`Canvas/bg/L${this.currentIndex+1}`);
const beforeNode = cc.find(`Canvas/bg/L${this.currentIndex}`);
this._cantouch = false;
cc.tween(node)
.to(.3, { x: 4000 }, { easing: 'cubicInOut' })
.call(() => {
cc.tween(beforeNode)
.to(.3, { x: 0 }, { easing: 'cubicInOut' })
.call(() => {
this.currentIndex --;
cc.find(`Canvas/bg/right`).active = this.currentIndex<4;
cc.find(`Canvas/bg/left`).active = this.currentIndex>0;
this._cantouch = true;
})
.start();
})
.start();
}
// update (dt) {},
initListener() {
this.node.on('touchstart', this.onEventStart, this);
this.node.on('touchend', this.onEventEnd, this);
}
touchX;
onEventStart(event) {
const worldPoint = event.getLocation();
this.touchX = worldPoint.x;
}
onEventEnd(event) {
const worldPoint = event.getLocation();
const x = worldPoint.x;
if (x > this.touchX + 100) {
if (this.currentIndex<=0) {
// 已经是第一个了
return;
}
console.log("======向右滑动=======");
this.rightMove();
}
if (x < this.touchX - 100) {
if (this.currentIndex>=4) {
// 已经是最后一个了
return;
}
console.log("======向左滑动=======");
this.leftMove()
}
}
playLocalAudio(audioName) {
const audio = cc.find(`Canvas/res/audio/${audioName}`).getComponent(cc.AudioSource);
return new Promise((resolve, reject) => {
const id = cc.audioEngine.playEffect(audio.clip, false);
cc.audioEngine.setFinishCallback(id, () => {
resolve(id);
});
})
}
}
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "9a79969a-0506-48d4-bc98-3c05d109b027", "uuid": "9df40926-be62-47be-a750-e209f78947c0",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 61, "width": 758,
"height": 67, "height": 658,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"btn_left": { "L1": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "ce19457d-e8f3-4c38-ae3e-d4b99208ddb5", "uuid": "73ee82cc-cc95-4a87-aaeb-1b23510cd553",
"rawTextureUuid": "9a79969a-0506-48d4-bc98-3c05d109b027", "rawTextureUuid": "9df40926-be62-47be-a750-e209f78947c0",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 61, "width": 758,
"height": 67, "height": 658,
"rawWidth": 61, "rawWidth": 758,
"rawHeight": 67, "rawHeight": 658,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "d582359e-924e-4ee9-9964-1fc4bb417e71", "uuid": "d230e42b-c737-4231-a7ae-073885a0ae63",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 61, "width": 758,
"height": 67, "height": 654,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"btn_right": { "L2": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "e5a2dbaa-a677-4a32-90d7-a1b057d7fb59", "uuid": "c05bf4f2-9a22-42bb-b96a-2c42af2bff94",
"rawTextureUuid": "d582359e-924e-4ee9-9964-1fc4bb417e71", "rawTextureUuid": "d230e42b-c737-4231-a7ae-073885a0ae63",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
"offsetX": -0.5, "offsetX": 0,
"offsetY": 0.5, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 60, "width": 758,
"height": 66, "height": 654,
"rawWidth": 61, "rawWidth": 758,
"rawHeight": 67, "rawHeight": 654,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "b133c27e-5317-437c-82f6-2d9cdd3c11c6",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 758,
"height": 663,
"platformSettings": {},
"subMetas": {
"L3": {
"ver": "1.0.4",
"uuid": "c7f0e5e8-9863-4a07-bc17-728bc32aa3aa",
"rawTextureUuid": "b133c27e-5317-437c-82f6-2d9cdd3c11c6",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 758,
"height": 663,
"rawWidth": 758,
"rawHeight": 663,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "12cf0f42-2b29-4cda-96a4-15a86335a179",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 758,
"height": 652,
"platformSettings": {},
"subMetas": {
"L4": {
"ver": "1.0.4",
"uuid": "6151ff0a-a839-42c0-a350-799d435d48e1",
"rawTextureUuid": "12cf0f42-2b29-4cda-96a4-15a86335a179",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 758,
"height": 652,
"rawWidth": 758,
"rawHeight": 652,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f", "uuid": "45a3d188-f98d-46cc-84b5-af7ff11a9e38",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 366, "width": 758,
"height": 336, "height": 652,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"1orange": { "L5": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "43d1e79d-6de8-4dcb-b8ce-d767df7913aa", "uuid": "6784fe91-2825-4714-93a4-17fdf3136770",
"rawTextureUuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f", "rawTextureUuid": "45a3d188-f98d-46cc-84b5-af7ff11a9e38",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
"offsetY": -0.5, "offsetY": -0.5,
"trimX": 0, "trimX": 0,
"trimY": 1, "trimY": 1,
"width": 366, "width": 758,
"height": 335, "height": 651,
"rawWidth": 366, "rawWidth": 758,
"rawHeight": 336, "rawHeight": 652,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "e1b4d971-9876-4832-803a-5a321964a78b", "uuid": "80a4149e-47cd-4fd6-8bec-787cfcb609e9",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
"subMetas": { "subMetas": {
"bg": { "bg": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "8288e3d4-4c75-4b27-8f01-f7014417f4dd", "uuid": "8c9ac73a-70de-4fdf-a921-c6860553d77c",
"rawTextureUuid": "e1b4d971-9876-4832-803a-5a321964a78b", "rawTextureUuid": "80a4149e-47cd-4fd6-8bec-787cfcb609e9",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
......
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "18d07592-51a9-421e-8972-0f67b68d29e1", "uuid": "1d0314fb-3ff8-4f1e-b151-86a4c3ac00a2",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 144, "width": 222,
"height": 144, "height": 178,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"icon": { "left": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "6fbc30a8-3c49-44ae-8ba4-7f56f385b78a", "uuid": "b54dc5ad-f87a-4546-902a-7489f01aefab",
"rawTextureUuid": "18d07592-51a9-421e-8972-0f67b68d29e1", "rawTextureUuid": "1d0314fb-3ff8-4f1e-b151-86a4c3ac00a2",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
"offsetX": 0, "offsetX": -4.5,
"offsetY": -0.5, "offsetY": -0.5,
"trimX": 3, "trimX": 58,
"trimY": 2, "trimY": 48,
"width": 138, "width": 97,
"height": 141, "height": 83,
"rawWidth": 144, "rawWidth": 222,
"rawHeight": 144, "rawHeight": 178,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "fa0d1106-f300-4760-bd44-cae8963f3997",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 222,
"height": 178,
"platformSettings": {},
"subMetas": {
"right": {
"ver": "1.0.4",
"uuid": "a0e0bf64-61fd-4600-8e32-40232e778401",
"rawTextureUuid": "fa0d1106-f300-4760-bd44-cae8963f3997",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -5,
"offsetY": 0,
"trimX": 57,
"trimY": 47,
"width": 98,
"height": 84,
"rawWidth": 222,
"rawHeight": 178,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
import { asyncDelay, onHomeworkFinish } from "../script/util";
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent";
const { ccclass, property } = cc._decorator;
@ccclass
export default class SceneComponent extends MyCocosSceneComponent {
addPreloadImage() {
// TODO 根据自己的配置预加载图片资源
this._imageResList.push({ url: this.data.pic_url });
this._imageResList.push({ url: this.data.pic_url_2 });
}
addPreloadAudio() {
// TODO 根据自己的配置预加载音频资源
this._audioResList.push({ url: this.data.audio_url });
}
addPreloadAnima() {
}
onLoadEnd() {
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.initData();
this.initView();
this.initListener();
}
_cantouch = null;
initData() {
// 所有全局变量 默认都是null
this._cantouch = true;
}
initView() {
this.initBg();
this.initPic();
this.initBtn();
this.initIcon();
}
initBg() {
const bgNode = cc.find('Canvas/bg');
bgNode.scale = this._mapScaleMax;
}
pic1 = null;
pic2 = null;
initPic() {
const canvas = cc.find('Canvas');
const maxW = canvas.width * 0.7;
this.getSprNodeByUrl(this.data.pic_url, (sprNode) => {
const picNode1 = sprNode;
picNode1.scale = maxW / picNode1.width;
picNode1.baseX = picNode1.x;
canvas.addChild(picNode1);
this.pic1 = picNode1;
const labelNode = new cc.Node();
labelNode.color = cc.Color.YELLOW;
const label = labelNode.addComponent(cc.Label);
label.string = this.data.text;
label.fontSize = 60;
label.lineHeight = 60;
label.font = cc.find('Canvas/res/font/BRLNSDB').getComponent('cc.Label').font;
picNode1.addChild(labelNode);
});
this.getSprNodeByUrl(this.data.pic_url_2, (sprNode) => {
const picNode2 = sprNode;
picNode2.scale = maxW / picNode2.width;
canvas.addChild(picNode2);
picNode2.x = canvas.width;
picNode2.baseX = picNode2.x;
this.pic2 = picNode2;
const labelNode = new cc.Node();
const label = labelNode.addComponent(cc.RichText);
const size = 60
label.font = cc.find('Canvas/res/font/BRLNSDB').getComponent(cc.Label).font;
label.string = `<outline color=#751e00 width=4><size=${size}><color=#ffffff>${this.data.text}</color></size></outline>`
label.lineHeight = size;
picNode2.addChild(labelNode);
});
}
initIcon() {
const iconNode = this.getSprNode('icon');
iconNode.zIndex = 5;
iconNode.anchorX = 1;
iconNode.anchorY = 1;
iconNode.parent = cc.find('Canvas');
iconNode.x = iconNode.parent.width / 2 - 10;
iconNode.y = iconNode.parent.height / 2 - 10;
iconNode.on(cc.Node.EventType.TOUCH_START, () => {
this.playAudioByUrl(this.data.audio_url);
})
}
curPage = null;
initBtn() {
this.curPage = 0;
const bottomPart = cc.find('Canvas/bottomPart');
bottomPart.zIndex = 5; // 提高层级
bottomPart.x = bottomPart.parent.width / 2;
bottomPart.y = -bottomPart.parent.height / 2;
const leftBtnNode = bottomPart.getChildByName('btn_left');
//节点中添加了button组件 则可以添加click事件监听
leftBtnNode.on('click', () => {
if (!this._cantouch) {
return;
}
if (this.curPage == 0) {
return;
}
this.curPage = 0
this.leftMove();
this.playLocalAudio('btn');
})
const rightBtnNode = bottomPart.getChildByName('btn_right');
//节点中添加了button组件 则可以添加click事件监听
rightBtnNode.on('click', () => {
if (!this._cantouch) {
return;
}
if (this.curPage == 1) {
return;
}
this.curPage = 1
this.rightMove();
// 游戏结束时需要调用这个方法通知系统作业完成
onHomeworkFinish();
this.playLocalAudio('btn');
})
}
leftMove() {
this._cantouch = false;
const len = this.pic1.parent.width;
cc.tween(this.pic1)
.to(1, { x: this.pic1.baseX }, { easing: 'cubicInOut' })
.start();
cc.tween(this.pic2)
.to(1, { x: this.pic2.baseX }, { easing: 'cubicInOut' })
.call(() => {
this._cantouch = true;
})
.start();
}
rightMove() {
this._cantouch = false;
const len = this.pic1.parent.width;
cc.tween(this.pic1)
.to(1, { x: this.pic1.baseX - len }, { easing: 'cubicInOut' })
.start();
cc.tween(this.pic2)
.to(1, { x: this.pic2.baseX - len }, { easing: 'cubicInOut' })
.call(() => {
this._cantouch = true;
})
.start();
}
// update (dt) {},
initListener() {
}
playLocalAudio(audioName) {
const audio = cc.find(`Canvas/res/audio/${audioName}`).getComponent(cc.AudioSource);
return new Promise((resolve, reject) => {
const id = cc.audioEngine.playEffect(audio.clip, false);
cc.audioEngine.setFinishCallback(id, () => {
resolve(id);
});
})
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment