Commit 0759f9a6 authored by 李维's avatar 李维

添加数据转换

parent 2d447dd5
......@@ -17,19 +17,19 @@
"__id__": 2
},
{
"__id__": 75
"__id__": 78
},
{
"__id__": 77
"__id__": 80
},
{
"__id__": 87
"__id__": 90
},
{
"__id__": 94
"__id__": 97
},
{
"__id__": 107
"__id__": 110
}
],
"_active": false,
......@@ -93,13 +93,13 @@
"_active": true,
"_components": [
{
"__id__": 72
"__id__": 75
},
{
"__id__": 73
"__id__": 76
},
{
"__id__": 74
"__id__": 77
}
],
"_prefab": null,
......@@ -278,28 +278,31 @@
"__id__": 40
},
{
"__id__": 44
"__id__": 43
},
{
"__id__": 46
"__id__": 47
},
{
"__id__": 48
"__id__": 49
},
{
"__id__": 57
"__id__": 51
},
{
"__id__": 66
"__id__": 60
},
{
"__id__": 69
}
],
"_active": true,
"_components": [
{
"__id__": 70
"__id__": 73
},
{
"__id__": 71
"__id__": 74
}
],
"_prefab": null,
......@@ -1543,7 +1546,7 @@
"__id__": 31
},
"_children": [],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 33
......@@ -1705,6 +1708,165 @@
"_originalHeight": 370,
"_id": "0elGlLM2ZDSJ0DSSOHWt2p"
},
{
"__type__": "cc.Node",
"_name": "textMiddle",
"_objFlags": 0,
"_parent": {
"__id__": 5
},
"_children": [
{
"__id__": 38
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
140,
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": "91FfIQYqRGkIW0sMKtqWxH"
},
{
"__type__": "cc.Node",
"_name": "Label",
"_objFlags": 0,
"_parent": {
"__id__": 37
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 39
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 102,
"g": 101,
"b": 157,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 85.68
},
"_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": "05nIuZeg1I26ru28nP9LHu"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 38
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "",
"_N$string": "",
"_fontSize": 68,
"_lineHeight": 68,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "4d2ba530-5d89-440c-85c3-3ace9ec1df97"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 1,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "11yKBhvtNJJJCOcRCcXZe3"
},
{
"__type__": "cc.Node",
"_name": "ImgCar",
......@@ -1716,10 +1878,10 @@
"_active": true,
"_components": [
{
"__id__": 38
"__id__": 41
},
{
"__id__": 39
"__id__": 42
}
],
"_prefab": null,
......@@ -1775,7 +1937,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 37
"__id__": 40
},
"_enabled": true,
"_materials": [
......@@ -1807,7 +1969,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 37
"__id__": 40
},
"_enabled": true,
"alignMode": 1,
......@@ -1838,13 +2000,13 @@
},
"_children": [
{
"__id__": 41
"__id__": 44
}
],
"_active": true,
"_components": [
{
"__id__": 43
"__id__": 46
}
],
"_prefab": null,
......@@ -1900,13 +2062,13 @@
"_name": "Label",
"_objFlags": 0,
"_parent": {
"__id__": 40
"__id__": 43
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 42
"__id__": 45
}
],
"_prefab": null,
......@@ -1962,7 +2124,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 41
"__id__": 44
},
"_enabled": true,
"_materials": [
......@@ -1997,7 +2159,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 40
"__id__": 43
},
"_enabled": true,
"_materials": [
......@@ -2035,7 +2197,7 @@
"_active": true,
"_components": [
{
"__id__": 45
"__id__": 48
}
],
"_prefab": null,
......@@ -2091,7 +2253,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 44
"__id__": 47
},
"_enabled": true,
"_layoutSize": {
......@@ -2129,7 +2291,7 @@
"_active": true,
"_components": [
{
"__id__": 47
"__id__": 50
}
],
"_prefab": null,
......@@ -2185,7 +2347,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 46
"__id__": 49
},
"_enabled": true,
"_layoutSize": {
......@@ -2221,22 +2383,22 @@
},
"_children": [
{
"__id__": 49
"__id__": 52
},
{
"__id__": 51
"__id__": 54
},
{
"__id__": 53
"__id__": 56
}
],
"_active": true,
"_components": [
{
"__id__": 55
"__id__": 58
},
{
"__id__": 56
"__id__": 59
}
],
"_prefab": null,
......@@ -2292,13 +2454,13 @@
"_name": "oval-10",
"_objFlags": 0,
"_parent": {
"__id__": 48
"__id__": 51
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 50
"__id__": 53
}
],
"_prefab": null,
......@@ -2354,7 +2516,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 49
"__id__": 52
},
"_enabled": true,
"_materials": [
......@@ -2386,13 +2548,13 @@
"_name": "oval-10_2",
"_objFlags": 0,
"_parent": {
"__id__": 48
"__id__": 51
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 52
"__id__": 55
}
],
"_prefab": null,
......@@ -2448,7 +2610,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 51
"__id__": 54
},
"_enabled": true,
"_materials": [
......@@ -2480,13 +2642,13 @@
"_name": "combined-shape_2",
"_objFlags": 0,
"_parent": {
"__id__": 48
"__id__": 51
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 54
"__id__": 57
}
],
"_prefab": null,
......@@ -2542,7 +2704,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 53
"__id__": 56
},
"_enabled": true,
"_materials": [
......@@ -2574,7 +2736,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 48
"__id__": 51
},
"_enabled": true,
"alignMode": 1,
......@@ -2601,7 +2763,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 48
"__id__": 51
},
"_enabled": true,
"_normalMaterial": null,
......@@ -2673,22 +2835,22 @@
},
"_children": [
{
"__id__": 58
"__id__": 61
},
{
"__id__": 60
"__id__": 63
},
{
"__id__": 62
"__id__": 65
}
],
"_active": true,
"_components": [
{
"__id__": 64
"__id__": 67
},
{
"__id__": 65
"__id__": 68
}
],
"_prefab": null,
......@@ -2744,13 +2906,13 @@
"_name": "oval-10",
"_objFlags": 0,
"_parent": {
"__id__": 57
"__id__": 60
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 59
"__id__": 62
}
],
"_prefab": null,
......@@ -2806,7 +2968,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 58
"__id__": 61
},
"_enabled": true,
"_materials": [
......@@ -2838,13 +3000,13 @@
"_name": "oval-10_2",
"_objFlags": 0,
"_parent": {
"__id__": 57
"__id__": 60
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 61
"__id__": 64
}
],
"_prefab": null,
......@@ -2900,7 +3062,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 60
"__id__": 63
},
"_enabled": true,
"_materials": [
......@@ -2932,13 +3094,13 @@
"_name": "combined-shape_2",
"_objFlags": 0,
"_parent": {
"__id__": 57
"__id__": 60
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 63
"__id__": 66
}
],
"_prefab": null,
......@@ -2994,7 +3156,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 62
"__id__": 65
},
"_enabled": true,
"_materials": [
......@@ -3026,7 +3188,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 57
"__id__": 60
},
"_enabled": true,
"alignMode": 1,
......@@ -3053,7 +3215,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 57
"__id__": 60
},
"_enabled": true,
"_normalMaterial": null,
......@@ -3127,13 +3289,13 @@
"_active": true,
"_components": [
{
"__id__": 67
"__id__": 70
},
{
"__id__": 68
"__id__": 71
},
{
"__id__": 69
"__id__": 72
}
],
"_prefab": null,
......@@ -3189,7 +3351,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 66
"__id__": 69
},
"_enabled": true,
"_materials": [
......@@ -3221,7 +3383,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 66
"__id__": 69
},
"_enabled": true,
"alignMode": 1,
......@@ -3248,7 +3410,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 66
"__id__": 69
},
"_enabled": true,
"_normalMaterial": null,
......@@ -3435,7 +3597,7 @@
"_active": true,
"_components": [
{
"__id__": 76
"__id__": 79
}
],
"_prefab": null,
......@@ -3491,7 +3653,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 75
"__id__": 78
},
"_enabled": true,
"_materials": [
......@@ -3527,16 +3689,16 @@
},
"_children": [
{
"__id__": 78
"__id__": 81
},
{
"__id__": 81
"__id__": 84
}
],
"_active": true,
"_components": [
{
"__id__": 86
"__id__": 89
}
],
"_prefab": null,
......@@ -3592,16 +3754,16 @@
"_name": "OptionBrown",
"_objFlags": 0,
"_parent": {
"__id__": 77
"__id__": 80
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 79
"__id__": 82
},
{
"__id__": 80
"__id__": 83
}
],
"_prefab": null,
......@@ -3657,7 +3819,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 78
"__id__": 81
},
"_enabled": true,
"_materials": [
......@@ -3689,7 +3851,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 78
"__id__": 81
},
"_enabled": true,
"alignMode": 2,
......@@ -3716,20 +3878,20 @@
"_name": "OptionBlue",
"_objFlags": 0,
"_parent": {
"__id__": 77
"__id__": 80
},
"_children": [
{
"__id__": 82
"__id__": 85
}
],
"_active": true,
"_components": [
{
"__id__": 84
"__id__": 87
},
{
"__id__": 85
"__id__": 88
}
],
"_prefab": null,
......@@ -3785,13 +3947,13 @@
"_name": "Label",
"_objFlags": 0,
"_parent": {
"__id__": 81
"__id__": 84
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 83
"__id__": 86
}
],
"_prefab": null,
......@@ -3847,7 +4009,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 82
"__id__": 85
},
"_enabled": true,
"_materials": [
......@@ -3882,7 +4044,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 81
"__id__": 84
},
"_enabled": true,
"_materials": [
......@@ -3914,7 +4076,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 81
"__id__": 84
},
"_enabled": true,
"alignMode": 2,
......@@ -3941,7 +4103,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 77
"__id__": 80
},
"_enabled": true,
"_normalMaterial": null,
......@@ -4013,7 +4175,7 @@
},
"_children": [
{
"__id__": 88
"__id__": 91
}
],
"_active": true,
......@@ -4071,23 +4233,23 @@
"_name": "OptionWhite",
"_objFlags": 0,
"_parent": {
"__id__": 87
"__id__": 90
},
"_children": [
{
"__id__": 89
"__id__": 92
}
],
"_active": true,
"_components": [
{
"__id__": 91
"__id__": 94
},
{
"__id__": 92
"__id__": 95
},
{
"__id__": 93
"__id__": 96
}
],
"_prefab": null,
......@@ -4143,13 +4305,13 @@
"_name": "Label",
"_objFlags": 0,
"_parent": {
"__id__": 88
"__id__": 91
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 90
"__id__": 93
}
],
"_prefab": null,
......@@ -4205,7 +4367,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 89
"__id__": 92
},
"_enabled": true,
"_materials": [
......@@ -4240,7 +4402,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 88
"__id__": 91
},
"_enabled": true,
"_materials": [
......@@ -4272,7 +4434,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 88
"__id__": 91
},
"_enabled": true,
"_normalMaterial": null,
......@@ -4340,7 +4502,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 88
"__id__": 91
},
"_enabled": true,
"alignMode": 2,
......@@ -4371,22 +4533,22 @@
},
"_children": [
{
"__id__": 95
"__id__": 98
},
{
"__id__": 97
"__id__": 100
},
{
"__id__": 99
"__id__": 102
},
{
"__id__": 101
"__id__": 104
},
{
"__id__": 103
"__id__": 106
},
{
"__id__": 105
"__id__": 108
}
],
"_active": true,
......@@ -4444,13 +4606,13 @@
"_name": "button",
"_objFlags": 0,
"_parent": {
"__id__": 94
"__id__": 97
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 96
"__id__": 99
}
],
"_prefab": null,
......@@ -4506,7 +4668,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 95
"__id__": 98
},
"_enabled": true,
"_clip": {
......@@ -4525,13 +4687,13 @@
"_name": "wrong",
"_objFlags": 0,
"_parent": {
"__id__": 94
"__id__": 97
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 98
"__id__": 101
}
],
"_prefab": null,
......@@ -4587,7 +4749,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 97
"__id__": 100
},
"_enabled": true,
"_clip": {
......@@ -4606,13 +4768,13 @@
"_name": "complete",
"_objFlags": 0,
"_parent": {
"__id__": 94
"__id__": 97
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 100
"__id__": 103
}
],
"_prefab": null,
......@@ -4668,7 +4830,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 99
"__id__": 102
},
"_enabled": true,
"_clip": {
......@@ -4687,13 +4849,13 @@
"_name": "replay",
"_objFlags": 0,
"_parent": {
"__id__": 94
"__id__": 97
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 102
"__id__": 105
}
],
"_prefab": null,
......@@ -4749,7 +4911,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 101
"__id__": 104
},
"_enabled": true,
"_clip": {
......@@ -4768,13 +4930,13 @@
"_name": "right",
"_objFlags": 0,
"_parent": {
"__id__": 94
"__id__": 97
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 104
"__id__": 107
}
],
"_prefab": null,
......@@ -4830,7 +4992,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 103
"__id__": 106
},
"_enabled": true,
"_clip": {
......@@ -4849,13 +5011,13 @@
"_name": "flower",
"_objFlags": 0,
"_parent": {
"__id__": 94
"__id__": 97
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 106
"__id__": 109
}
],
"_prefab": null,
......@@ -4911,7 +5073,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 105
"__id__": 108
},
"_enabled": true,
"_clip": {
......@@ -4934,19 +5096,19 @@
},
"_children": [
{
"__id__": 108
"__id__": 111
},
{
"__id__": 112
"__id__": 115
},
{
"__id__": 116
"__id__": 119
},
{
"__id__": 120
"__id__": 123
},
{
"__id__": 124
"__id__": 127
}
],
"_active": true,
......@@ -5004,11 +5166,11 @@
"_name": "quadBase",
"_objFlags": 0,
"_parent": {
"__id__": 107
"__id__": 110
},
"_children": [
{
"__id__": 109
"__id__": 112
}
],
"_active": true,
......@@ -5066,11 +5228,11 @@
"_name": "quad",
"_objFlags": 0,
"_parent": {
"__id__": 108
"__id__": 111
},
"_children": [
{
"__id__": 110
"__id__": 113
}
],
"_active": true,
......@@ -5128,13 +5290,13 @@
"_name": "paper",
"_objFlags": 0,
"_parent": {
"__id__": 109
"__id__": 112
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 111
"__id__": 114
}
],
"_prefab": null,
......@@ -5190,7 +5352,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 110
"__id__": 113
},
"_enabled": true,
"_materials": [
......@@ -5222,11 +5384,11 @@
"_name": "quadBase",
"_objFlags": 0,
"_parent": {
"__id__": 107
"__id__": 110
},
"_children": [
{
"__id__": 113
"__id__": 116
}
],
"_active": true,
......@@ -5284,11 +5446,11 @@
"_name": "quad",
"_objFlags": 0,
"_parent": {
"__id__": 112
"__id__": 115
},
"_children": [
{
"__id__": 114
"__id__": 117
}
],
"_active": true,
......@@ -5346,13 +5508,13 @@
"_name": "paper",
"_objFlags": 0,
"_parent": {
"__id__": 113
"__id__": 116
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 115
"__id__": 118
}
],
"_prefab": null,
......@@ -5408,7 +5570,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 114
"__id__": 117
},
"_enabled": true,
"_materials": [
......@@ -5440,11 +5602,11 @@
"_name": "quadBase",
"_objFlags": 0,
"_parent": {
"__id__": 107
"__id__": 110
},
"_children": [
{
"__id__": 117
"__id__": 120
}
],
"_active": true,
......@@ -5502,11 +5664,11 @@
"_name": "quad",
"_objFlags": 0,
"_parent": {
"__id__": 116
"__id__": 119
},
"_children": [
{
"__id__": 118
"__id__": 121
}
],
"_active": true,
......@@ -5564,13 +5726,13 @@
"_name": "paper",
"_objFlags": 0,
"_parent": {
"__id__": 117
"__id__": 120
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 119
"__id__": 122
}
],
"_prefab": null,
......@@ -5626,7 +5788,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 118
"__id__": 121
},
"_enabled": true,
"_materials": [
......@@ -5658,11 +5820,11 @@
"_name": "quadBase",
"_objFlags": 0,
"_parent": {
"__id__": 107
"__id__": 110
},
"_children": [
{
"__id__": 121
"__id__": 124
}
],
"_active": true,
......@@ -5720,11 +5882,11 @@
"_name": "quad",
"_objFlags": 0,
"_parent": {
"__id__": 120
"__id__": 123
},
"_children": [
{
"__id__": 122
"__id__": 125
}
],
"_active": true,
......@@ -5782,13 +5944,13 @@
"_name": "paper",
"_objFlags": 0,
"_parent": {
"__id__": 121
"__id__": 124
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 123
"__id__": 126
}
],
"_prefab": null,
......@@ -5844,7 +6006,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 122
"__id__": 125
},
"_enabled": true,
"_materials": [
......@@ -5876,11 +6038,11 @@
"_name": "quadBase",
"_objFlags": 0,
"_parent": {
"__id__": 107
"__id__": 110
},
"_children": [
{
"__id__": 125
"__id__": 128
}
],
"_active": true,
......@@ -5938,11 +6100,11 @@
"_name": "quad",
"_objFlags": 0,
"_parent": {
"__id__": 124
"__id__": 127
},
"_children": [
{
"__id__": 126
"__id__": 129
}
],
"_active": true,
......@@ -6000,13 +6162,13 @@
"_name": "paper",
"_objFlags": 0,
"_parent": {
"__id__": 125
"__id__": 128
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 127
"__id__": 130
}
],
"_prefab": null,
......@@ -6062,7 +6224,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 126
"__id__": 129
},
"_enabled": true,
"_materials": [
......
......@@ -60,9 +60,9 @@ cc.Class({
}
getData((data) => {
console.log('data:', data);
this.data = data || this.getDefaultData();
this.data = JSON.parse(JSON.stringify(this.data))
this.data = this.translateData(this.data)
console.log('data:', data);
this.preloadItem()
})
},
......@@ -87,6 +87,44 @@ cc.Class({
return defaultData;
},
// 数据转换 - 把听写助手传进来的数据转换成这个模板需要的游戏数据
translateData(data) {
// 组装题目数据
function getQuestionData(itemData, index) {
const qItems = [];
const letters = itemData.text_en.split("");
const arrText = [];
letters.forEach(item=>{
arrText.push(item)
qItems.push({
"audio": "",
"word": item
})
})
return {
"auido": itemData.audio_url,
"image": "",
"showText": itemData.text_cn,
"text": arrText.join(" "),
"words": qItems
}
}
// data = [ { "id": 20, "pid": 19, "text_en": "what", "text_cn": "什么", "audio_url": "http://teach.cdn.ireadabc.com/36b5e5d9a5240bff453e95e2d74cece0.mp3", "audio_cn_url": "http://teach.cdn.ireadabc.com/27a5b4d9525a299e3806ccd991a8e5f9.mp3", "image_url": "[\"http://teach.cdn.ireadabc.com/b9b759a25cafbadc3130201e50cf4f85.jpeg\"]", "phonetic": "[wɒt]", "description": null, "mlk": null, "data": null, "seq": 1, "has_child": 0, "depth": 4, "created_date": "2023-02-01T10:07:13.000Z", "updated_date": "2023-02-10T03:31:34.000Z", "del": 0 }, { "id": 21, "pid": 19, "text_en": "is", "text_cn": "是", "audio_url": "http://teach.cdn.ireadabc.com/d7f9276c7ff13b734c74358d7580a193.mp3", "audio_cn_url": "http://teach.cdn.ireadabc.com/45100afa502326955d0f03cac87f1a5b.mp3", "image_url": null, "phonetic": "[ɪz]", "description": null, "mlk": null, "data": null, "seq": 2, "has_child": 0, "depth": 4, "created_date": "2023-02-01T10:07:13.000Z", "updated_date": "2023-02-10T03:31:34.000Z", "del": 0 }, { "id": 22, "pid": 19, "text_en": "what’s", "text_cn": "是什么", "audio_url": "http://teach.cdn.ireadabc.com/383082bc329464ae1580fffcd5e85d54.mp3", "audio_cn_url": "http://teach.cdn.ireadabc.com/244d88fbd98972865959d1c0fe50bdac.mp3", "image_url": null, "phonetic": "[wɒts]", "description": null, "mlk": null, "data": null, "seq": 3, "has_child": 0, "depth": 4, "created_date": "2023-02-01T10:07:13.000Z", "updated_date": "2023-02-10T03:31:34.000Z", "del": 0 }, { "id": 23, "pid": 19, "text_en": "your", "text_cn": "你的", "audio_url": "http://teach.cdn.ireadabc.com/09b268cd4e201e12f4f8af377308689b.mp3", "audio_cn_url": "http://teach.cdn.ireadabc.com/f723a8c809b4c910b416a9a6c9e34eb8.mp3", "image_url": "[\"http://teach.cdn.ireadabc.com/808504438919f5d2849dff97f7fb0ffd.jpg\",\"http://teach.cdn.ireadabc.com/fc9d5a0d4eba960aecae0d88b0c39acd.jpg\"]", "phonetic": "[jɔː(r)]", "description": null, "mlk": null, "data": null, "seq": 4, "has_child": 0, "depth": 4, "created_date": "2023-02-01T10:07:13.000Z", "updated_date": "2023-02-14T01:48:59.000Z", "del": 0 }, { "id": 24, "pid": 19, "text_en": "name", "text_cn": "名字", "audio_url": "http://teach.cdn.ireadabc.com/60bf983a10741a0796a3a71d1c0b5907.mp3", "audio_cn_url": "http://teach.cdn.ireadabc.com/0fa9f2cc4c971d870889d7b80976654f.mp3", "image_url": "[\"http://teach.cdn.ireadabc.com/a0d9907a44d617784b533dc920647dee.jpg\"]", "phonetic": "[neɪm]", "description": null, "mlk": null, "data": null, "seq": 5, "has_child": 0, "depth": 4, "created_date": "2023-02-01T10:07:13.000Z", "updated_date": "2023-02-10T03:31:34.000Z", "del": 0 }, { "id": 25, "pid": 19, "text_en": "please", "text_cn": "请", "audio_url": "http://teach.cdn.ireadabc.com/ee1c7821c46b49ba850ebefc598cdb5b.mp3", "audio_cn_url": "http://teach.cdn.ireadabc.com/ac372008acb6236b6a1428a334c7f0a5.mp3", "image_url": "[\"http://teach.cdn.ireadabc.com/a42594ef6c4fc5b1987d2b073ae675dd.webp\",\"http://teach.cdn.ireadabc.com/7fc1972331756f74dbcf7ae0215a809b.png\"]", "phonetic": "[pliːz]", "description": null, "mlk": null, "data": null, "seq": 6, "has_child": 0, "depth": 4, "created_date": "2023-02-01T10:07:13.000Z", "updated_date": "2023-02-10T03:31:34.000Z", "del": 0 }, { "id": 26, "pid": 19, "text_en": "good", "text_cn": "好的", "audio_url": "http://teach.cdn.ireadabc.com/3aeaf5c3884ad3f00a92900ed478c77e.mp3", "audio_cn_url": "http://teach.cdn.ireadabc.com/403ba0be9e118b5325e3ae8acbdd3743.mp3", "image_url": "[\"http://teach.cdn.ireadabc.com/42946cef3972cc2ddaded63ba0fc20c1.webp\"]", "phonetic": "[ɡʊd]", "description": null, "mlk": null, "data": null, "seq": 7, "has_child": 0, "depth": 4, "created_date": "2023-02-01T10:07:13.000Z", "updated_date": "2023-02-14T01:49:00.000Z", "del": 0 }, { "id": 27, "pid": 19, "text_en": "morning", "text_cn": "早晨,上午", "audio_url": "http://teach.cdn.ireadabc.com/382d219f6339f5e0980cb9b716dbac8d.mp3", "audio_cn_url": "http://teach.cdn.ireadabc.com/2c9c57ed86a6ca438c486543bc8bcb88.mp3", "image_url": "[\"http://teach.cdn.ireadabc.com/ffbf1f05334754e42deff6f8f2f96d3e.jpg\",\"http://teach.cdn.ireadabc.com/b8e68519a23841f248a09293a879ffe9.jpg\",\"http://teach.cdn.ireadabc.com/d72d4b2d838e91570a3e777eaa5f9420.jpg\"]", "phonetic": "['mɔːnɪŋ]", "description": null, "mlk": null, "data": null, "seq": 8, "has_child": 0, "depth": 4, "created_date": "2023-02-01T10:07:13.000Z", "updated_date": "2023-02-14T01:49:00.000Z", "del": 0 }, { "id": 28, "pid": 19, "text_en": "Ms.", "text_cn": "女士", "audio_url": "http://teach.cdn.ireadabc.com/81c51b5b602e3687c6b220727c5e5f55.mp3", "audio_cn_url": "http://teach.cdn.ireadabc.com/5476bff8440fc49bebad504a0bd86eba.mp3", "image_url": null, "phonetic": "[miz]", "description": null, "mlk": "Ms", "data": null, "seq": 9, "has_child": 0, "depth": 4, "created_date": "2023-02-01T10:07:13.000Z", "updated_date": "2023-02-14T07:46:34.000Z", "del": 0 }, { "id": 29, "pid": 19, "text_en": "my", "text_cn": "我的", "audio_url": "http://teach.cdn.ireadabc.com/d4463b448d966353c3c19ae9b9e6ca71.mp3", "audio_cn_url": "http://teach.cdn.ireadabc.com/cfbc278fb514c0bc9ca690f1c4df0950.mp3", "image_url": "[\"http://teach.cdn.ireadabc.com/a2c2888111d4c18015a7d01d55fe93fb.jpg\",\"http://teach.cdn.ireadabc.com/98aa7a0d3243e8a361fd2973e4563f93.jpg\",\"http://teach.cdn.ireadabc.com/8a8b042372a3304b66495039eb7a92ff.jpg\",\"http://teach.cdn.ireadabc.com/da793b5cf93ae8915574f42d837dbae3.jpg\",\"http://teach.cdn.ireadabc.com/56857caeabb7b5bd49fa3054b2e45a52.webp\"]", "phonetic": "[maɪ]", "description": null, "mlk": null, "data": null, "seq": 10, "has_child": 0, "depth": 4, "created_date": "2023-02-01T10:07:13.000Z", "updated_date": "2023-02-10T03:31:34.000Z", "del": 0 }, { "id": 30, "pid": 19, "text_en": "bird", "text_cn": "鸟", "audio_url": "http://teach.cdn.ireadabc.com/1ef04de98ddc59957edbc709901c60c7.mp3", "audio_cn_url": "http://teach.cdn.ireadabc.com/fae76ae6e1bcb53d63d6f38838587ae0.mp3", "image_url": "[\"http://teach.cdn.ireadabc.com/7cf3efe3d56e7fe69d6a1809b567d1ae.jpeg\",\"http://teach.cdn.ireadabc.com/64b0eb3286053f0bf7672f61f9e5565a.jpeg\",\"http://teach.cdn.ireadabc.com/deb296c3696ee0940dc91ee18eb68d27.webp\"]", "phonetic": "[bɜːd]", "description": null, "mlk": null, "data": null, "seq": 11, "has_child": 0, "depth": 4, "created_date": "2023-02-01T10:07:13.000Z", "updated_date": "2023-02-10T03:31:34.000Z", "del": 0 }, { "id": 31, "pid": 19, "text_en": "tweet", "text_cn": "小鸟啼叫", "audio_url": "http://teach.cdn.ireadabc.com/db4b0511e318b0725532aeba6181bd51.mp3", "audio_cn_url": "http://teach.cdn.ireadabc.com/867865f1650f3512adba56c83bcb9f3e.mp3", "image_url": null, "phonetic": "[twi:t]", "description": null, "mlk": null, "data": null, "seq": 12, "has_child": 0, "depth": 4, "created_date": "2023-02-01T10:07:13.000Z", "updated_date": "2023-02-10T03:31:34.000Z", "del": 0 }, { "id": 32, "pid": 19, "text_en": "a(n)", "text_cn": "一个", "audio_url": "http://teach.cdn.ireadabc.com/81eec7df521de5f8b0704fa114bc0aff.mp3", "audio_cn_url": "http://teach.cdn.ireadabc.com/618b7d333097f2e96b35bb9135231918.mp3", "image_url": null, "phonetic": "[ə][ən]", "description": null, "mlk": null, "data": null, "seq": 13, "has_child": 0, "depth": 4, "created_date": "2023-02-01T10:07:13.000Z", "updated_date": "2023-02-10T03:31:34.000Z", "del": 0 }, { "id": 33, "pid": 19, "text_en": "boy", "text_cn": "男孩", "audio_url": "http://teach.cdn.ireadabc.com/6c60ff7775afbb0b454f23151719e9d0.mp3", "audio_cn_url": "http://teach.cdn.ireadabc.com/e27330597469d5e81f0037c5846aca48.mp3", "image_url": "[\"http://teach.cdn.ireadabc.com/1f042535eef57f88054d46f903d87e80.jpeg\"]", "phonetic": "[bɔɪ]", "description": null, "mlk": null, "data": null, "seq": 14, "has_child": 0, "depth": 4, "created_date": "2023-02-01T10:07:13.000Z", "updated_date": "2023-02-10T03:31:34.000Z", "del": 0 }, { "id": 34, "pid": 19, "text_en": "girl", "text_cn": "女孩", "audio_url": "http://teach.cdn.ireadabc.com/d038b562b0c7781e718eb08550849143.mp3", "audio_cn_url": "http://teach.cdn.ireadabc.com/9ad553f6e10ddc1bfeb851082f9f1d25.mp3", "image_url": "[\"http://teach.cdn.ireadabc.com/896d19830863cfc1561553ebf3b6ecbe.webp\",\"http://teach.cdn.ireadabc.com/92354ec729582b3bb2ea05851e9d0806.webp\"]", "phonetic": "[ɡɜːl]", "description": null, "mlk": null, "data": null, "seq": 15, "has_child": 0, "depth": 4, "created_date": "2023-02-01T10:07:13.000Z", "updated_date": "2023-02-10T03:31:34.000Z", "del": 0 }, { "id": 35, "pid": 19, "text_en": "afternoon", "text_cn": "下午", "audio_url": "http://teach.cdn.ireadabc.com/1f70fe441cdca82832cdf7bc286796f7.mp3", "audio_cn_url": "http://teach.cdn.ireadabc.com/0ab162e708e2ba9991398f10107504ab.mp3", "image_url": "[\"http://teach.cdn.ireadabc.com/e4b9c73c31c47a7441bb6ac04d558c02.jpg\",\"http://teach.cdn.ireadabc.com/d2914aad9ce834ebb057b04400609a17.jpg\",\"http://teach.cdn.ireadabc.com/0ad04d2a371a51af723a2fae92ebbf10.jpg\"]", "phonetic": "[ˌɑːftə'nuːn]", "description": null, "mlk": null, "data": null, "seq": 16, "has_child": 0, "depth": 4, "created_date": "2023-02-01T10:07:13.000Z", "updated_date": "2023-02-10T03:31:34.000Z", "del": 0 }, { "id": 36, "pid": 19, "text_en": "panda", "text_cn": "熊猫", "audio_url": "http://teach.cdn.ireadabc.com/99b59a21ea78955c7e593c2f38ef31de.mp3", "audio_cn_url": "http://teach.cdn.ireadabc.com/a30d8dc936cbe5e1324b293faaa6e3ce.mp3", "image_url": "[\"http://teach.cdn.ireadabc.com/e32c4771a53e118e25fc0c16de7deccb.jpg\",\"http://teach.cdn.ireadabc.com/e79e9d8a7b391b55aabeb54281ccf5a7.jpg\"]", "phonetic": "['pændə]", "description": null, "mlk": null, "data": null, "seq": 17, "has_child": 0, "depth": 4, "created_date": "2023-02-01T10:07:13.000Z", "updated_date": "2023-02-10T03:31:34.000Z", "del": 0 } ];
// 按照需要的结构进行组装
const tData = {
"title": "Let''s Match",
"titleAudio": "",
"questionList": []
}
data.forEach((item, gIndex)=>{
tData.questionList.push(getQuestionData(item));
})
return tData;
},
preloadItem() {
this.addPreloadImage();
this.addPreloadAudio();
......@@ -250,7 +288,8 @@ cc.Class({
this.initTargets();
this.initResult();
this.initButtons();
this.initImage();
// this.initImage();
this.initMiddleText();
},
initImage() {
......@@ -272,6 +311,13 @@ cc.Class({
}
},
initMiddleText() {
const textLabel = cc.find("Canvas/bg/textMiddle/Label").getComponent(cc.Label);
const idx = this._status.currentQuestionIdx;
const text = this.data.questionList[idx].showText;
textLabel.string = text;
},
initBg() {
const bgNode = cc.find('Canvas/bg');
// bgNode.scale = this._mapScaleMax;
......@@ -539,7 +585,17 @@ cc.Class({
const starList = this.createShiningStarsRoundNode(resultNode);
await asyncTweenTo(resultNode, 0.2, { opacity: 255 });
this.playAudioByName('complete');
this.playAudioByName('complete').then(res=>{
const idx = this._status.currentQuestionIdx;
const url = this.data.questionList[idx].auido;
if(url) {
playAudioByUrl(url, ()=>{
this.showButtons();
});
} else {
this.showButtons();
}
});
const car = cc.find('Canvas/bg/ImgCar');
await asyncTweenTo(car, 2, { x: -cc.find('Canvas/bg').width }, { easing: 'quadInOut' });
......@@ -551,7 +607,7 @@ cc.Class({
.start();
});
this.showButtons();
if (this._status.currentQuestionIdx == this.data.questionList.length - 1) {
this.showFlowers();
......
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