Commit 1a487a13 authored by Tt's avatar Tt

代码重构

parent 19536aba
......@@ -78,28 +78,28 @@
"__id__": 14
},
{
"__id__": 85
"__id__": 86
},
{
"__id__": 109
"__id__": 110
},
{
"__id__": 131
"__id__": 132
},
{
"__id__": 170
"__id__": 171
}
],
"_active": true,
"_components": [
{
"__id__": 192
},
{
"__id__": 193
},
{
"__id__": 194
},
{
"__id__": 195
}
],
"_prefab": null,
......@@ -678,19 +678,22 @@
"__id__": 23
},
{
"__id__": 32
"__id__": 24
},
{
"__id__": 63
"__id__": 33
},
{
"__id__": 69
"__id__": 64
},
{
"__id__": 70
}
],
"_active": true,
"_components": [
{
"__id__": 84
"__id__": 85
}
],
"_prefab": null,
......@@ -801,7 +804,7 @@
},
{
"__type__": "cc.Node",
"_name": "topQuestion",
"_name": "item_question",
"_objFlags": 0,
"_parent": {
"__id__": 14
......@@ -869,7 +872,7 @@
},
{
"__type__": "cc.Node",
"_name": "roundedRectangle",
"_name": "bg",
"_objFlags": 0,
"_parent": {
"__id__": 16
......@@ -963,7 +966,7 @@
},
{
"__type__": "cc.Node",
"_name": "push",
"_name": "img",
"_objFlags": 0,
"_parent": {
"__id__": 16
......@@ -1055,7 +1058,7 @@
},
{
"__type__": "cc.Node",
"_name": "answer",
"_name": "text",
"_objFlags": 0,
"_parent": {
"__id__": 16
......@@ -1148,6 +1151,64 @@
"_N$cacheMode": 0,
"_id": "63O5OUQmpLmbO0QqiJ4OUh"
},
{
"__type__": "cc.Node",
"_name": "layout_question",
"_objFlags": 0,
"_parent": {
"__id__": 14
},
"_children": [],
"_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,
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": "b6ksNki6dNcq1AHwBcYv+J"
},
{
"__type__": "cc.Node",
"_name": "countdown",
......@@ -1157,10 +1218,10 @@
},
"_children": [
{
"__id__": 24
"__id__": 25
},
{
"__id__": 28
"__id__": 29
}
],
"_active": true,
......@@ -1218,17 +1279,17 @@
"_name": "countdown1",
"_objFlags": 0,
"_parent": {
"__id__": 23
"__id__": 24
},
"_children": [
{
"__id__": 25
"__id__": 26
}
],
"_active": false,
"_components": [
{
"__id__": 27
"__id__": 28
}
],
"_prefab": null,
......@@ -1284,13 +1345,13 @@
"_name": "countdown1",
"_objFlags": 0,
"_parent": {
"__id__": 24
"__id__": 25
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 26
"__id__": 27
}
],
"_prefab": null,
......@@ -1346,7 +1407,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 25
"__id__": 26
},
"_enabled": true,
"_materials": [
......@@ -1379,7 +1440,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 24
"__id__": 25
},
"_enabled": true,
"_materials": [
......@@ -1411,17 +1472,17 @@
"_name": "countdown2",
"_objFlags": 0,
"_parent": {
"__id__": 23
"__id__": 24
},
"_children": [
{
"__id__": 29
"__id__": 30
}
],
"_active": false,
"_components": [
{
"__id__": 31
"__id__": 32
}
],
"_prefab": null,
......@@ -1477,13 +1538,13 @@
"_name": "countdown2",
"_objFlags": 0,
"_parent": {
"__id__": 28
"__id__": 29
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 30
"__id__": 31
}
],
"_prefab": null,
......@@ -1539,7 +1600,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 29
"__id__": 30
},
"_enabled": true,
"_materials": [
......@@ -1572,7 +1633,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 28
"__id__": 29
},
"_enabled": true,
"_materials": [
......@@ -1608,13 +1669,13 @@
},
"_children": [
{
"__id__": 33
"__id__": 34
},
{
"__id__": 40
"__id__": 41
},
{
"__id__": 44
"__id__": 45
}
],
"_active": true,
......@@ -1672,23 +1733,23 @@
"_name": "ProgressBar",
"_objFlags": 0,
"_parent": {
"__id__": 32
"__id__": 33
},
"_children": [
{
"__id__": 34
"__id__": 35
},
{
"__id__": 36
"__id__": 37
}
],
"_active": true,
"_components": [
{
"__id__": 38
"__id__": 39
},
{
"__id__": 39
"__id__": 40
}
],
"_prefab": null,
......@@ -1744,13 +1805,13 @@
"_name": "bar",
"_objFlags": 0,
"_parent": {
"__id__": 33
"__id__": 34
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 35
"__id__": 36
}
],
"_prefab": null,
......@@ -1806,7 +1867,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 34
"__id__": 35
},
"_enabled": true,
"_materials": [
......@@ -1838,13 +1899,13 @@
"_name": "ColoredProgressBar",
"_objFlags": 0,
"_parent": {
"__id__": 33
"__id__": 34
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 37
"__id__": 38
}
],
"_prefab": null,
......@@ -1900,7 +1961,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 36
"__id__": 37
},
"_enabled": true,
"_materials": [
......@@ -1932,7 +1993,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 33
"__id__": 34
},
"_enabled": true,
"_materials": [
......@@ -1964,12 +2025,12 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 33
"__id__": 34
},
"_enabled": true,
"_N$totalLength": 442,
"_N$barSprite": {
"__id__": 35
"__id__": 36
},
"_N$mode": 0,
"_N$progress": 0,
......@@ -1981,17 +2042,17 @@
"_name": "star",
"_objFlags": 0,
"_parent": {
"__id__": 32
"__id__": 33
},
"_children": [
{
"__id__": 41
"__id__": 42
}
],
"_active": true,
"_components": [
{
"__id__": 43
"__id__": 44
}
],
"_prefab": null,
......@@ -2047,13 +2108,13 @@
"_name": "questionnumber",
"_objFlags": 0,
"_parent": {
"__id__": 40
"__id__": 41
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 42
"__id__": 43
}
],
"_prefab": null,
......@@ -2109,7 +2170,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 41
"__id__": 42
},
"_enabled": true,
"_materials": [
......@@ -2142,7 +2203,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 40
"__id__": 41
},
"_enabled": true,
"_materials": [
......@@ -2174,35 +2235,35 @@
"_name": "star2",
"_objFlags": 0,
"_parent": {
"__id__": 32
"__id__": 33
},
"_children": [
{
"__id__": 45
"__id__": 46
},
{
"__id__": 47
"__id__": 48
},
{
"__id__": 49
"__id__": 50
},
{
"__id__": 51
"__id__": 52
},
{
"__id__": 53
"__id__": 54
},
{
"__id__": 55
"__id__": 56
},
{
"__id__": 57
"__id__": 58
},
{
"__id__": 59
"__id__": 60
},
{
"__id__": 61
"__id__": 62
}
],
"_active": true,
......@@ -2260,13 +2321,13 @@
"_name": "star2",
"_objFlags": 0,
"_parent": {
"__id__": 44
"__id__": 45
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 46
"__id__": 47
}
],
"_prefab": null,
......@@ -2322,7 +2383,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 45
"__id__": 46
},
"_enabled": true,
"_materials": [
......@@ -2354,13 +2415,13 @@
"_name": "star2",
"_objFlags": 0,
"_parent": {
"__id__": 44
"__id__": 45
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 48
"__id__": 49
}
],
"_prefab": null,
......@@ -2416,7 +2477,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 47
"__id__": 48
},
"_enabled": true,
"_materials": [
......@@ -2448,13 +2509,13 @@
"_name": "star2",
"_objFlags": 0,
"_parent": {
"__id__": 44
"__id__": 45
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 50
"__id__": 51
}
],
"_prefab": null,
......@@ -2510,7 +2571,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 49
"__id__": 50
},
"_enabled": true,
"_materials": [
......@@ -2542,13 +2603,13 @@
"_name": "group",
"_objFlags": 0,
"_parent": {
"__id__": 44
"__id__": 45
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 52
"__id__": 53
}
],
"_prefab": null,
......@@ -2604,7 +2665,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 51
"__id__": 52
},
"_enabled": true,
"_materials": [
......@@ -2636,13 +2697,13 @@
"_name": "group",
"_objFlags": 0,
"_parent": {
"__id__": 44
"__id__": 45
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 54
"__id__": 55
}
],
"_prefab": null,
......@@ -2698,7 +2759,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 53
"__id__": 54
},
"_enabled": true,
"_materials": [
......@@ -2730,13 +2791,13 @@
"_name": "group",
"_objFlags": 0,
"_parent": {
"__id__": 44
"__id__": 45
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 56
"__id__": 57
}
],
"_prefab": null,
......@@ -2792,7 +2853,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 55
"__id__": 56
},
"_enabled": true,
"_materials": [
......@@ -2824,13 +2885,13 @@
"_name": "number",
"_objFlags": 0,
"_parent": {
"__id__": 44
"__id__": 45
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 58
"__id__": 59
}
],
"_prefab": null,
......@@ -2886,7 +2947,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 57
"__id__": 58
},
"_enabled": true,
"_materials": [
......@@ -2919,13 +2980,13 @@
"_name": "number",
"_objFlags": 0,
"_parent": {
"__id__": 44
"__id__": 45
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 60
"__id__": 61
}
],
"_prefab": null,
......@@ -2981,7 +3042,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 59
"__id__": 60
},
"_enabled": true,
"_materials": [
......@@ -3014,13 +3075,13 @@
"_name": "number",
"_objFlags": 0,
"_parent": {
"__id__": 44
"__id__": 45
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 62
"__id__": 63
}
],
"_prefab": null,
......@@ -3076,7 +3137,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 61
"__id__": 62
},
"_enabled": true,
"_materials": [
......@@ -3113,10 +3174,10 @@
},
"_children": [
{
"__id__": 64
"__id__": 65
},
{
"__id__": 66
"__id__": 67
}
],
"_active": true,
......@@ -3174,13 +3235,13 @@
"_name": "right",
"_objFlags": 0,
"_parent": {
"__id__": 63
"__id__": 64
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 65
"__id__": 66
}
],
"_prefab": null,
......@@ -3236,7 +3297,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 64
"__id__": 65
},
"_enabled": true,
"_materials": [
......@@ -3268,16 +3329,16 @@
"_name": "mistake",
"_objFlags": 0,
"_parent": {
"__id__": 63
"__id__": 64
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 67
"__id__": 68
},
{
"__id__": 68
"__id__": 69
}
],
"_prefab": null,
......@@ -3333,7 +3394,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 66
"__id__": 67
},
"_enabled": true,
"_materials": [
......@@ -3365,7 +3426,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 66
"__id__": 67
},
"_enabled": true,
"_clip": {
......@@ -3388,19 +3449,19 @@
},
"_children": [
{
"__id__": 70
"__id__": 71
},
{
"__id__": 72
"__id__": 73
},
{
"__id__": 78
"__id__": 79
}
],
"_active": false,
"_components": [
{
"__id__": 83
"__id__": 84
}
],
"_prefab": null,
......@@ -3456,13 +3517,13 @@
"_name": "bg",
"_objFlags": 0,
"_parent": {
"__id__": 69
"__id__": 70
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 71
"__id__": 72
}
],
"_prefab": null,
......@@ -3518,7 +3579,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 70
"__id__": 71
},
"_enabled": true,
"_materials": [
......@@ -3550,17 +3611,17 @@
"_name": "layout_bottom",
"_objFlags": 0,
"_parent": {
"__id__": 69
"__id__": 70
},
"_children": [
{
"__id__": 73
"__id__": 74
}
],
"_active": true,
"_components": [
{
"__id__": 77
"__id__": 78
}
],
"_prefab": null,
......@@ -3616,17 +3677,17 @@
"_name": "bottom",
"_objFlags": 0,
"_parent": {
"__id__": 72
"__id__": 73
},
"_children": [
{
"__id__": 74
"__id__": 75
}
],
"_active": true,
"_components": [
{
"__id__": 76
"__id__": 77
}
],
"_prefab": null,
......@@ -3682,13 +3743,13 @@
"_name": "prompt",
"_objFlags": 0,
"_parent": {
"__id__": 73
"__id__": 74
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 75
"__id__": 76
}
],
"_prefab": null,
......@@ -3744,7 +3805,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 74
"__id__": 75
},
"_enabled": true,
"_materials": [
......@@ -3777,7 +3838,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 73
"__id__": 74
},
"_enabled": true,
"_materials": [
......@@ -3809,7 +3870,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 72
"__id__": 73
},
"_enabled": true,
"alignMode": 1,
......@@ -3836,14 +3897,14 @@
"_name": "layout_middle",
"_objFlags": 0,
"_parent": {
"__id__": 69
"__id__": 70
},
"_children": [
{
"__id__": 79
"__id__": 80
},
{
"__id__": 81
"__id__": 82
}
],
"_active": true,
......@@ -3901,13 +3962,13 @@
"_name": "ready",
"_objFlags": 0,
"_parent": {
"__id__": 78
"__id__": 79
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 80
"__id__": 81
}
],
"_prefab": null,
......@@ -3963,7 +4024,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 79
"__id__": 80
},
"_enabled": true,
"_materials": [
......@@ -3995,13 +4056,13 @@
"_name": "go",
"_objFlags": 0,
"_parent": {
"__id__": 78
"__id__": 79
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 82
"__id__": 83
}
],
"_prefab": null,
......@@ -4057,7 +4118,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 81
"__id__": 82
},
"_enabled": true,
"_materials": [
......@@ -4089,7 +4150,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 69
"__id__": 70
},
"_enabled": true,
"alignMode": 1,
......@@ -4147,23 +4208,23 @@
},
"_children": [
{
"__id__": 86
"__id__": 87
},
{
"__id__": 91
"__id__": 92
}
],
"_active": true,
"_components": [
{
"__id__": 106
"__id__": 107
},
{
"__id__": 107
"__id__": 108
}
],
"_prefab": {
"__id__": 108
"__id__": 109
},
"_opacity": 255,
"_color": {
......@@ -4217,23 +4278,23 @@
"_name": "btn_back",
"_objFlags": 0,
"_parent": {
"__id__": 85
"__id__": 86
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 87
},
{
"__id__": 88
},
{
"__id__": 89
},
{
"__id__": 90
}
],
"_prefab": {
"__id__": 90
"__id__": 91
},
"_opacity": 255,
"_color": {
......@@ -4287,7 +4348,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 86
"__id__": 87
},
"_enabled": true,
"_materials": [
......@@ -4319,7 +4380,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 86
"__id__": 87
},
"_enabled": true,
"_normalMaterial": null,
......@@ -4387,7 +4448,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 86
"__id__": 87
},
"_enabled": true,
"alignMode": 1,
......@@ -4412,7 +4473,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 85
"__id__": 86
},
"asset": {
"__uuid__": "0b87ca13-07e1-4237-ab3b-7f27c69deb2d"
......@@ -4425,21 +4486,21 @@
"_name": "label_title",
"_objFlags": 0,
"_parent": {
"__id__": 85
"__id__": 86
},
"_children": [
{
"__id__": 92
"__id__": 93
}
],
"_active": true,
"_components": [
{
"__id__": 104
"__id__": 105
}
],
"_prefab": {
"__id__": 105
"__id__": 106
},
"_opacity": 255,
"_color": {
......@@ -4493,27 +4554,27 @@
"_name": "img_npc_voice",
"_objFlags": 0,
"_parent": {
"__id__": 91
"__id__": 92
},
"_children": [
{
"__id__": 93
"__id__": 94
},
{
"__id__": 96
"__id__": 97
},
{
"__id__": 99
"__id__": 100
}
],
"_active": true,
"_components": [
{
"__id__": 102
"__id__": 103
}
],
"_prefab": {
"__id__": 103
"__id__": 104
},
"_opacity": 255,
"_color": {
......@@ -4567,17 +4628,17 @@
"_name": "p1",
"_objFlags": 0,
"_parent": {
"__id__": 92
"__id__": 93
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 94
"__id__": 95
}
],
"_prefab": {
"__id__": 95
"__id__": 96
},
"_opacity": 255,
"_color": {
......@@ -4631,7 +4692,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 93
"__id__": 94
},
"_enabled": true,
"_materials": [
......@@ -4661,7 +4722,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 85
"__id__": 86
},
"asset": {
"__uuid__": "0b87ca13-07e1-4237-ab3b-7f27c69deb2d"
......@@ -4674,17 +4735,17 @@
"_name": "p2",
"_objFlags": 0,
"_parent": {
"__id__": 92
"__id__": 93
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 97
"__id__": 98
}
],
"_prefab": {
"__id__": 98
"__id__": 99
},
"_opacity": 255,
"_color": {
......@@ -4738,7 +4799,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 96
"__id__": 97
},
"_enabled": true,
"_materials": [
......@@ -4768,7 +4829,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 85
"__id__": 86
},
"asset": {
"__uuid__": "0b87ca13-07e1-4237-ab3b-7f27c69deb2d"
......@@ -4781,17 +4842,17 @@
"_name": "p3",
"_objFlags": 0,
"_parent": {
"__id__": 92
"__id__": 93
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 100
"__id__": 101
}
],
"_prefab": {
"__id__": 101
"__id__": 102
},
"_opacity": 255,
"_color": {
......@@ -4845,7 +4906,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 99
"__id__": 100
},
"_enabled": true,
"_materials": [
......@@ -4875,7 +4936,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 85
"__id__": 86
},
"asset": {
"__uuid__": "0b87ca13-07e1-4237-ab3b-7f27c69deb2d"
......@@ -4888,7 +4949,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 92
"__id__": 93
},
"_enabled": true,
"alignMode": 2,
......@@ -4913,7 +4974,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 85
"__id__": 86
},
"asset": {
"__uuid__": "0b87ca13-07e1-4237-ab3b-7f27c69deb2d"
......@@ -4926,7 +4987,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 91
"__id__": 92
},
"_enabled": true,
"_materials": [
......@@ -4959,7 +5020,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 85
"__id__": 86
},
"asset": {
"__uuid__": "0b87ca13-07e1-4237-ab3b-7f27c69deb2d"
......@@ -4972,7 +5033,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 85
"__id__": 86
},
"_enabled": true,
"alignMode": 1,
......@@ -4999,7 +5060,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 85
"__id__": 86
},
"_enabled": true,
"_id": "f7dxVJqg1E45KECTQA4bO5"
......@@ -5007,7 +5068,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 85
"__id__": 86
},
"asset": {
"__uuid__": "0b87ca13-07e1-4237-ab3b-7f27c69deb2d"
......@@ -5024,20 +5085,20 @@
},
"_children": [
{
"__id__": 110
"__id__": 111
},
{
"__id__": 124
"__id__": 125
}
],
"_active": true,
"_components": [
{
"__id__": 129
"__id__": 130
}
],
"_prefab": {
"__id__": 130
"__id__": 131
},
"_opacity": 255,
"_color": {
......@@ -5091,26 +5152,26 @@
"_name": "layout_center",
"_objFlags": 0,
"_parent": {
"__id__": 109
"__id__": 110
},
"_children": [
{
"__id__": 111
"__id__": 112
},
{
"__id__": 114
"__id__": 115
},
{
"__id__": 117
"__id__": 118
},
{
"__id__": 120
"__id__": 121
}
],
"_active": false,
"_components": [],
"_prefab": {
"__id__": 123
"__id__": 124
},
"_opacity": 255,
"_color": {
......@@ -5164,17 +5225,17 @@
"_name": "bg_gray",
"_objFlags": 0,
"_parent": {
"__id__": 110
"__id__": 111
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 112
"__id__": 113
}
],
"_prefab": {
"__id__": 113
"__id__": 114
},
"_opacity": 102,
"_color": {
......@@ -5228,7 +5289,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 111
"__id__": 112
},
"_enabled": true,
"_materials": [
......@@ -5258,7 +5319,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 109
"__id__": 110
},
"asset": {
"__uuid__": "a9b135f6-de46-4257-8be2-55dc863ce747"
......@@ -5271,17 +5332,17 @@
"_name": "aniNode1",
"_objFlags": 0,
"_parent": {
"__id__": 110
"__id__": 111
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 115
"__id__": 116
}
],
"_prefab": {
"__id__": 116
"__id__": 117
},
"_opacity": 255,
"_color": {
......@@ -5335,7 +5396,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 114
"__id__": 115
},
"_enabled": true,
"_materials": [
......@@ -5373,7 +5434,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 109
"__id__": 110
},
"asset": {
"__uuid__": "a9b135f6-de46-4257-8be2-55dc863ce747"
......@@ -5386,17 +5447,17 @@
"_name": "aniNode2",
"_objFlags": 0,
"_parent": {
"__id__": 110
"__id__": 111
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 118
"__id__": 119
}
],
"_prefab": {
"__id__": 119
"__id__": 120
},
"_opacity": 255,
"_color": {
......@@ -5450,7 +5511,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 117
"__id__": 118
},
"_enabled": true,
"_materials": [
......@@ -5486,7 +5547,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 109
"__id__": 110
},
"asset": {
"__uuid__": "a9b135f6-de46-4257-8be2-55dc863ce747"
......@@ -5499,17 +5560,17 @@
"_name": "aniNode3",
"_objFlags": 0,
"_parent": {
"__id__": 110
"__id__": 111
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 121
"__id__": 122
}
],
"_prefab": {
"__id__": 122
"__id__": 123
},
"_opacity": 255,
"_color": {
......@@ -5563,7 +5624,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 120
"__id__": 121
},
"_enabled": true,
"_materials": [
......@@ -5601,7 +5662,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 109
"__id__": 110
},
"asset": {
"__uuid__": "a9b135f6-de46-4257-8be2-55dc863ce747"
......@@ -5612,7 +5673,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 109
"__id__": 110
},
"asset": {
"__uuid__": "a9b135f6-de46-4257-8be2-55dc863ce747"
......@@ -5625,17 +5686,17 @@
"_name": "res",
"_objFlags": 0,
"_parent": {
"__id__": 109
"__id__": 110
},
"_children": [
{
"__id__": 125
"__id__": 126
}
],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 128
"__id__": 129
},
"_opacity": 255,
"_color": {
......@@ -5689,17 +5750,17 @@
"_name": "coin",
"_objFlags": 0,
"_parent": {
"__id__": 124
"__id__": 125
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 126
"__id__": 127
}
],
"_prefab": {
"__id__": 127
"__id__": 128
},
"_opacity": 255,
"_color": {
......@@ -5753,7 +5814,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 125
"__id__": 126
},
"_enabled": true,
"_clip": {
......@@ -5770,7 +5831,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 109
"__id__": 110
},
"asset": {
"__uuid__": "a9b135f6-de46-4257-8be2-55dc863ce747"
......@@ -5781,7 +5842,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 109
"__id__": 110
},
"asset": {
"__uuid__": "a9b135f6-de46-4257-8be2-55dc863ce747"
......@@ -5794,7 +5855,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 109
"__id__": 110
},
"_enabled": true,
"_id": "c3dOkfp8JOEIaSkCGGz9Us"
......@@ -5802,7 +5863,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 109
"__id__": 110
},
"asset": {
"__uuid__": "a9b135f6-de46-4257-8be2-55dc863ce747"
......@@ -5819,20 +5880,20 @@
},
"_children": [
{
"__id__": 132
"__id__": 133
},
{
"__id__": 163
"__id__": 164
}
],
"_active": true,
"_components": [
{
"__id__": 168
"__id__": 169
}
],
"_prefab": {
"__id__": 169
"__id__": 170
},
"_opacity": 255,
"_color": {
......@@ -5886,35 +5947,35 @@
"_name": "layer_center",
"_objFlags": 0,
"_parent": {
"__id__": 131
"__id__": 132
},
"_children": [
{
"__id__": 133
"__id__": 134
},
{
"__id__": 136
"__id__": 137
},
{
"__id__": 138
"__id__": 139
},
{
"__id__": 141
"__id__": 142
},
{
"__id__": 144
"__id__": 145
},
{
"__id__": 147
"__id__": 148
},
{
"__id__": 150
"__id__": 151
}
],
"_active": false,
"_components": [],
"_prefab": {
"__id__": 162
"__id__": 163
},
"_opacity": 255,
"_color": {
......@@ -5968,17 +6029,17 @@
"_name": "gray_cover",
"_objFlags": 0,
"_parent": {
"__id__": 132
"__id__": 133
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 134
"__id__": 135
}
],
"_prefab": {
"__id__": 135
"__id__": 136
},
"_opacity": 102,
"_color": {
......@@ -6032,7 +6093,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 133
"__id__": 134
},
"_enabled": true,
"_materials": [
......@@ -6062,7 +6123,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 131
"__id__": 132
},
"asset": {
"__uuid__": "8944c192-3675-466f-9f94-8f824c68e822"
......@@ -6075,13 +6136,13 @@
"_name": "layer_middle",
"_objFlags": 0,
"_parent": {
"__id__": 132
"__id__": 133
},
"_children": [],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 137
"__id__": 138
},
"_opacity": 255,
"_color": {
......@@ -6133,7 +6194,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 131
"__id__": 132
},
"asset": {
"__uuid__": "8944c192-3675-466f-9f94-8f824c68e822"
......@@ -6146,17 +6207,17 @@
"_name": "replay_btn",
"_objFlags": 0,
"_parent": {
"__id__": 132
"__id__": 133
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 139
"__id__": 140
}
],
"_prefab": {
"__id__": 140
"__id__": 141
},
"_opacity": 255,
"_color": {
......@@ -6210,7 +6271,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 138
"__id__": 139
},
"_enabled": true,
"_materials": [
......@@ -6240,7 +6301,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 131
"__id__": 132
},
"asset": {
"__uuid__": "8944c192-3675-466f-9f94-8f824c68e822"
......@@ -6253,17 +6314,17 @@
"_name": "bg_light",
"_objFlags": 0,
"_parent": {
"__id__": 132
"__id__": 133
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 142
"__id__": 143
}
],
"_prefab": {
"__id__": 143
"__id__": 144
},
"_opacity": 255,
"_color": {
......@@ -6317,7 +6378,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 141
"__id__": 142
},
"_enabled": true,
"_materials": [
......@@ -6347,7 +6408,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 131
"__id__": 132
},
"asset": {
"__uuid__": "8944c192-3675-466f-9f94-8f824c68e822"
......@@ -6360,17 +6421,17 @@
"_name": "finish_cat",
"_objFlags": 0,
"_parent": {
"__id__": 132
"__id__": 133
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 145
"__id__": 146
}
],
"_prefab": {
"__id__": 146
"__id__": 147
},
"_opacity": 255,
"_color": {
......@@ -6424,7 +6485,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 144
"__id__": 145
},
"_enabled": true,
"_materials": [
......@@ -6462,7 +6523,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 131
"__id__": 132
},
"asset": {
"__uuid__": "8944c192-3675-466f-9f94-8f824c68e822"
......@@ -6475,17 +6536,17 @@
"_name": "next_btn",
"_objFlags": 0,
"_parent": {
"__id__": 132
"__id__": 133
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 148
"__id__": 149
}
],
"_prefab": {
"__id__": 149
"__id__": 150
},
"_opacity": 255,
"_color": {
......@@ -6539,7 +6600,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 147
"__id__": 148
},
"_enabled": true,
"_materials": [
......@@ -6569,7 +6630,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 131
"__id__": 132
},
"asset": {
"__uuid__": "8944c192-3675-466f-9f94-8f824c68e822"
......@@ -6582,27 +6643,27 @@
"_name": "finish_box",
"_objFlags": 0,
"_parent": {
"__id__": 132
"__id__": 133
},
"_children": [
{
"__id__": 151
"__id__": 152
},
{
"__id__": 154
"__id__": 155
},
{
"__id__": 157
"__id__": 158
}
],
"_active": true,
"_components": [
{
"__id__": 160
"__id__": 161
}
],
"_prefab": {
"__id__": 161
"__id__": 162
},
"_opacity": 255,
"_color": {
......@@ -6656,17 +6717,17 @@
"_name": "result_text",
"_objFlags": 0,
"_parent": {
"__id__": 150
"__id__": 151
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 152
"__id__": 153
}
],
"_prefab": {
"__id__": 153
"__id__": 154
},
"_opacity": 255,
"_color": {
......@@ -6720,7 +6781,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 151
"__id__": 152
},
"_enabled": true,
"_materials": [
......@@ -6751,7 +6812,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 131
"__id__": 132
},
"asset": {
"__uuid__": "8944c192-3675-466f-9f94-8f824c68e822"
......@@ -6764,17 +6825,17 @@
"_name": "coin",
"_objFlags": 0,
"_parent": {
"__id__": 150
"__id__": 151
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 155
"__id__": 156
}
],
"_prefab": {
"__id__": 156
"__id__": 157
},
"_opacity": 255,
"_color": {
......@@ -6828,7 +6889,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 154
"__id__": 155
},
"_enabled": true,
"_materials": [
......@@ -6858,7 +6919,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 131
"__id__": 132
},
"asset": {
"__uuid__": "8944c192-3675-466f-9f94-8f824c68e822"
......@@ -6871,17 +6932,17 @@
"_name": "coin_num",
"_objFlags": 0,
"_parent": {
"__id__": 150
"__id__": 151
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 158
"__id__": 159
}
],
"_prefab": {
"__id__": 159
"__id__": 160
},
"_opacity": 255,
"_color": {
......@@ -6935,7 +6996,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 157
"__id__": 158
},
"_enabled": true,
"_materials": [
......@@ -6966,7 +7027,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 131
"__id__": 132
},
"asset": {
"__uuid__": "8944c192-3675-466f-9f94-8f824c68e822"
......@@ -6979,7 +7040,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 150
"__id__": 151
},
"_enabled": true,
"_materials": [
......@@ -7009,7 +7070,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 131
"__id__": 132
},
"asset": {
"__uuid__": "8944c192-3675-466f-9f94-8f824c68e822"
......@@ -7020,7 +7081,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 131
"__id__": 132
},
"asset": {
"__uuid__": "8944c192-3675-466f-9f94-8f824c68e822"
......@@ -7033,17 +7094,17 @@
"_name": "res",
"_objFlags": 0,
"_parent": {
"__id__": 131
"__id__": 132
},
"_children": [
{
"__id__": 164
"__id__": 165
}
],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 167
"__id__": 168
},
"_opacity": 255,
"_color": {
......@@ -7097,17 +7158,17 @@
"_name": "ending",
"_objFlags": 0,
"_parent": {
"__id__": 163
"__id__": 164
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 165
"__id__": 166
}
],
"_prefab": {
"__id__": 166
"__id__": 167
},
"_opacity": 255,
"_color": {
......@@ -7161,7 +7222,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 164
"__id__": 165
},
"_enabled": true,
"_clip": {
......@@ -7178,7 +7239,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 131
"__id__": 132
},
"asset": {
"__uuid__": "8944c192-3675-466f-9f94-8f824c68e822"
......@@ -7189,7 +7250,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 131
"__id__": 132
},
"asset": {
"__uuid__": "8944c192-3675-466f-9f94-8f824c68e822"
......@@ -7202,7 +7263,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 131
"__id__": 132
},
"_enabled": true,
"_id": "0eb63qoGNGaK7IkpnARXZE"
......@@ -7210,7 +7271,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 131
"__id__": 132
},
"asset": {
"__uuid__": "8944c192-3675-466f-9f94-8f824c68e822"
......@@ -7227,13 +7288,13 @@
},
"_children": [
{
"__id__": 171
"__id__": 172
},
{
"__id__": 174
"__id__": 175
},
{
"__id__": 177
"__id__": 178
}
],
"_active": false,
......@@ -7291,11 +7352,11 @@
"_name": "font",
"_objFlags": 0,
"_parent": {
"__id__": 170
"__id__": 171
},
"_children": [
{
"__id__": 172
"__id__": 173
}
],
"_active": false,
......@@ -7353,13 +7414,13 @@
"_name": "BRLNSDB",
"_objFlags": 0,
"_parent": {
"__id__": 171
"__id__": 172
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 173
"__id__": 174
}
],
"_prefab": null,
......@@ -7415,7 +7476,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 172
"__id__": 173
},
"_enabled": true,
"_materials": [
......@@ -7450,11 +7511,11 @@
"_name": "img",
"_objFlags": 0,
"_parent": {
"__id__": 170
"__id__": 171
},
"_children": [
{
"__id__": 175
"__id__": 176
}
],
"_active": false,
......@@ -7512,13 +7573,13 @@
"_name": "icon",
"_objFlags": 0,
"_parent": {
"__id__": 174
"__id__": 175
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 176
"__id__": 177
}
],
"_prefab": null,
......@@ -7574,7 +7635,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 175
"__id__": 176
},
"_enabled": true,
"_materials": [
......@@ -7606,29 +7667,29 @@
"_name": "audio",
"_objFlags": 0,
"_parent": {
"__id__": 170
"__id__": 171
},
"_children": [
{
"__id__": 178
"__id__": 179
},
{
"__id__": 180
"__id__": 181
},
{
"__id__": 182
"__id__": 183
},
{
"__id__": 184
"__id__": 185
},
{
"__id__": 186
"__id__": 187
},
{
"__id__": 188
"__id__": 189
},
{
"__id__": 190
"__id__": 191
}
],
"_active": false,
......@@ -7686,13 +7747,13 @@
"_name": "btn",
"_objFlags": 0,
"_parent": {
"__id__": 177
"__id__": 178
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 179
"__id__": 180
}
],
"_prefab": null,
......@@ -7748,7 +7809,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 178
"__id__": 179
},
"_enabled": true,
"_clip": {
......@@ -7767,13 +7828,13 @@
"_name": "mistake",
"_objFlags": 0,
"_parent": {
"__id__": 177
"__id__": 178
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 181
"__id__": 182
}
],
"_prefab": null,
......@@ -7829,7 +7890,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 180
"__id__": 181
},
"_enabled": true,
"_clip": {
......@@ -7848,13 +7909,13 @@
"_name": "showCard",
"_objFlags": 0,
"_parent": {
"__id__": 177
"__id__": 178
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 183
"__id__": 184
}
],
"_prefab": null,
......@@ -7910,7 +7971,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 182
"__id__": 183
},
"_enabled": true,
"_clip": {
......@@ -7929,13 +7990,13 @@
"_name": "start2Tiger",
"_objFlags": 0,
"_parent": {
"__id__": 177
"__id__": 178
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 185
"__id__": 186
}
],
"_prefab": null,
......@@ -7991,7 +8052,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 184
"__id__": 185
},
"_enabled": true,
"_clip": {
......@@ -8010,13 +8071,13 @@
"_name": "please5speak",
"_objFlags": 0,
"_parent": {
"__id__": 177
"__id__": 178
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 187
"__id__": 188
}
],
"_prefab": null,
......@@ -8072,7 +8133,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 186
"__id__": 187
},
"_enabled": true,
"_clip": {
......@@ -8091,13 +8152,13 @@
"_name": "readyGo",
"_objFlags": 0,
"_parent": {
"__id__": 177
"__id__": 178
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 189
"__id__": 190
}
],
"_prefab": null,
......@@ -8153,7 +8214,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 188
"__id__": 189
},
"_enabled": true,
"_clip": {
......@@ -8172,13 +8233,13 @@
"_name": "right",
"_objFlags": 0,
"_parent": {
"__id__": 177
"__id__": 178
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 191
"__id__": 192
}
],
"_prefab": null,
......@@ -8234,7 +8295,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 190
"__id__": 191
},
"_enabled": true,
"_clip": {
......
......@@ -46,13 +46,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
_cantouch = null;
initData() {
// 所有全局变量 默认都是null
this._cantouch = true;
let data = this.data;
this.data = this.data.questions[0]
}
private topQuestion: cc.Node
private item_question: cc.Node
//题目id
private currentId: number
//总时间时间
......@@ -61,14 +55,23 @@ export default class SceneComponent extends MyCocosSceneComponent {
private right: number
//进度条成都
private lengthProgress: number
// 游戏页面
private layer_game: cc.Node;
// 准备开始
private layout_begin: cc.Node;
initData() {
// 所有全局变量 默认都是null
this._cantouch = true;
let data = this.data;
this.data = this.data.questions[0]
}
initView() {
// 取对象
/* this.topQuestion = pg.view.find(this, 'topQuestion'); */
/* this.item_question = pg.view.find(this, 'item_question'); */
this.layer_game = pg.view.find(this, 'layer_game');
this.layout_begin = pg.view.find(this.layer_game, 'layout_begin');
pg.view.visible(pg.view.find(this.layer_game, 'countdown/countdown1'), true);
pg.view.visible(pg.view.find(this.layer_game, 'countdown/countdown2'), false);
}
initListener() {
......@@ -76,13 +79,19 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
getCurrent() {
return this.data.options[this.currentId];
}
async initGame() {
this.showCamera();
await this.showBegin()
this.hideBegin();
// this.showCamera();
// await this.showBegin()
// this.hideBegin();
this.startQuestion();
}
gameOver() {
this.state = State.Over;
}
showCamera() {
courseware && courseware.openRecognitionCamera({
x: 0,
......@@ -104,7 +113,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.aniBottomEnter().then(() => {
pg.hw.playAudio('readyGo', false, () => {
});
cc.tween(ready).to(1, { y: -20 }).to(0.2, { y: 0 }).delay(1).call(() => {
cc.tween(ready).to(1, { y: -20 }).to(0.2, { y: 0 }).delay(0.3).call(() => {
ready.active = false;
}).start();
cc.tween(go).delay(1).to(1, { y: -20 }).to(0.2, { y: 0 }).delay(0.5).call(() => {
......@@ -138,29 +147,25 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.currentTime = this.time * 1000;
this.lengthProgress = 0
this.right = 0
//预加载第一题
this.firstOptions()
//题目数分配
this.updateProgress()
}
//预加载第一题
firstOptions() {
let topQuestion = pg.view.find(this, 'layer_game/topQuestion');
let countdown = pg.view.find(this, 'layer_game/countdown');
let countdown1 = pg.view.find(countdown, 'countdown1');
let countdown2 = pg.view.find(countdown, 'countdown2');
countdown1.active = true
countdown2.active = false
this.startCountDown = true;
this.gameStart = true;
this.state = State.Recording;
this.updateTitleOptions();
this.updateQuestion();
this.updateProgress();
}
gameOver() {
this.state = State.Over;
//题目
updateQuestion() {
let item_question = pg.view.find(this, 'layer_game/item_question');
let data = this.getCurrent();
pg.view.setNetImg(pg.view.find(item_question, "img"), data.image, { w: 700, h: 360 })
pg.view.setString(pg.view.find(item_question, "text"), data.text)
}
private startCountDown: boolean;
//------------------------------Loop----------------------------------
private gameStart: boolean;
private state: number;
private waitTime: number;
update(dt) {
if (this.startCountDown) {
if (this.gameStart) {
var nowTime = Date.now();
if (!this.lastTime) this.lastTime = nowTime;
let subTime = nowTime - this.lastTime;
......@@ -171,20 +176,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 游戏结束
}
this.updateClock(subTime);
this.updateTime(subTime);
this.updateState(subTime);
}
}
private state: number;
private waitTime: number;
updateTime(dt) {
updateState(dt) {
this.waitTime -= dt;
if (this.waitTime > 0) return;
switch (this.state) {
case State.Recording:
this.state = State.RecordEnd;
this.waitTime = 3 * 1000;//3秒录音
this.startRecord(this.getCurrentOptions().text);
this.startRecord(this.getCurrent().text);
break;
case State.RecordEnd:
this.state = State.RecordShow;
......@@ -195,66 +197,60 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.state = State.Recording;
this.hideAnswer();
this.currentId++;
if (!this.getCurrentOptions()) {
if (!this.getCurrent()) {
this.gameOver();
return;
}
this.updateTitleOptions()
this.updateQuestion()
break;
}
}
//------------------------------Answer----------------------------------
getCurrentOptions() {
return this.data.options[this.currentId];
//用户回答结果
checkRight(score) {
let isRight = score > 40;
let item_question = pg.view.find(this, 'layer_game/item_question');
/*
* answer 获取的用户答案
*/
//判断对错
let row = pg.view.find(this, 'layer_game/row');
item_question.children[2].active = true
//正确
if (isRight) {
//正确后执行函数
this.onAnswerRight(row)
} else {
this.onAnswerError(row)
}
}
//回答正确后回调
onAnswerRight(row) {
//答对题目数
this.right += 1
row.children[0].active = true
this.updateProgressPercent();
}
onAnswerError(row) {
//错误音频
pg.audio.playAudioByUrl(this.getCurrent().audio);
//错误
row.children[1].active = true
}
hideAnswer() {
let topQuestion = pg.view.find(this, 'layer_game/topQuestion');
let item_question = pg.view.find(this, 'layer_game/item_question');
let row = pg.view.find(this, 'layer_game/row');
let right = pg.view.find(row, 'right');
let mistake = pg.view.find(row, 'mistake');
let answer = pg.view.find(topQuestion, 'answer');
let text = pg.view.find(item_question, 'text');
right.active = false
mistake.active = false
answer.active = false
}
//题目
updateTitleOptions() {
let topQuestion = pg.view.find(this, 'layer_game/topQuestion');
pg.view.setNetImg(topQuestion.children[1], this.getCurrentOptions().image, { w: 700, h: 360 })
pg.view.setString(topQuestion.children[2], this.getCurrentOptions().text)
}
// 倒计时完成
private lastTime: number;
updateClock(dt) {
let time = Math.floor(this.currentTime / 100);
let n1 = Math.floor(time / 100) > 0 ? Math.floor(time / 100) : 0;
time -= (n1 * 100);
let n2 = Math.floor(time / 10) > 0 ? Math.floor(time / 10) : 0;
time -= (n2 * 10);
let n3 = Math.floor(time / 1) > 0 ? Math.floor(time / 1) : 0;
let countStr = `${n1}${n2}.${n3}`;
let countdown = pg.view.find(this, 'layer_game/countdown');
let countdown1 = pg.view.find(countdown, 'countdown1');
let countdown2 = pg.view.find(countdown, 'countdown2');
//更换时间及闹钟图片
countdown1.active = (Number(countStr) >= 10)
countdown2.active = !(Number(countStr) >= 10)
pg.view.setString(countdown1.children[0], countStr)
pg.view.setString(countdown2.children[0], countStr)
}
//题目数分配
updateProgress() {
let layout_progress = pg.view.find(this, 'layer_game/layout_progress')
var questionLenght = this.data.options.length
//星星数
for (let i = 1; i <= 3; i++) {
layout_progress.children[2].children[5 + i].active = true
pg.view.setString(layout_progress.children[2].children[5 + i], Math.round(questionLenght / 3 * i))
}
text.active = false
}
//------------------------------Record----------------------------------
startRecord(letter) {
courseware && courseware.startTest(letter); //开始录音
}
......@@ -287,58 +283,65 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
recrodEnd(data) {
let score = data.result.overall;
this.whetherAnswer(score > 40)
this.checkRight(score)
}
//用户回答结果
whetherAnswer(answer) {
let topQuestion = pg.view.find(this, 'layer_game/topQuestion');
/*
* answer 获取的用户答案
*/
//判断对错
let row = pg.view.find(this, 'layer_game/row');
topQuestion.children[2].active = true
//正确
if (answer) {
//正确后执行函数
this.rightQuestions(row)
} else {
//错误音频
pg.audio.playAudioByUrl(this.getCurrentOptions().audio);
//错误
row.children[1].active = true
}
//------------------------------Progress----------------------------------
// 倒计时完成
private lastTime: number;
updateClock(dt) {
let time = Math.floor(this.currentTime / 100);
let n1 = Math.floor(time / 100) > 0 ? Math.floor(time / 100) : 0;
time -= (n1 * 100);
let n2 = Math.floor(time / 10) > 0 ? Math.floor(time / 10) : 0;
time -= (n2 * 10);
let n3 = Math.floor(time / 1) > 0 ? Math.floor(time / 1) : 0;
let countStr = `${n1}${n2}.${n3}`;
let countdown = pg.view.find(this, 'layer_game/countdown');
let countdown1 = pg.view.find(countdown, 'countdown1');
let countdown2 = pg.view.find(countdown, 'countdown2');
//更换时间及闹钟图片
countdown1.active = (Number(countStr) >= 10)
countdown2.active = !(Number(countStr) >= 10)
pg.view.setString(countdown1.children[0], countStr)
pg.view.setString(countdown2.children[0], countStr)
}
//回答正确后回调
rightQuestions(row) {
updateProgressPercent() {
//获取layout_progress节点
let layout_progress = pg.view.find(this, 'layer_game/layout_progress')
var progressParent = layout_progress.children[0].getComponent(cc.layout_progress)
//获取题目数量
let lengthQ = this.data.options.length
//答对题目数
this.right += 1
var progressParent = layout_progress.children[0].getComponent(cc.ProgressBar)
pg.view.setString(layout_progress.children[1].children[0], this.right)
//星星切换
for (let i = 1; i <= 3; i++) {
if (this.right == Math.round(lengthQ / 3 * i)) {
if (this.right == Math.round(this.data.options.length / 3 * i)) {
layout_progress.children[2].children[i - 1].active = false
layout_progress.children[2].children[i + 2].active = true
}
if (this.right == Math.round(lengthQ / 3 * 2)) layout_progress.children[0].children[1].active = true
if (this.right == Math.round(this.data.options.length / 3 * 2)) layout_progress.children[0].children[1].active = true
}
//进度条
this.lengthProgress += 1 / (lengthQ)
this.lengthProgress += 1 / this.data.options.length
progressParent.progress = this.lengthProgress
//彩色进度条同步进度条宽度
layout_progress.children[0].children[1].width = layout_progress.children[0].children[0].width
row.children[0].active = true
}
//题目数分配
updateProgress() {
let layout_progress = pg.view.find(this, 'layer_game/layout_progress')
var questionLenght = this.data.options.length
//星星数
for (let i = 1; i <= 3; i++) {
layout_progress.children[2].children[5 + i].active = true
pg.view.setString(layout_progress.children[2].children[5 + i], Math.round(questionLenght / 3 * i))
}
}
playLocalAudio(audioName) {
const audio = cc.find(`Canvas/res/audio/${audioName}`).getComponent(cc.AudioSource);
......
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