Commit 81f5dddc authored by Tt's avatar Tt

基础流程完成

parent 83628316
......@@ -93,25 +93,25 @@
"__id__": 33
},
{
"__id__": 51
"__id__": 54
},
{
"__id__": 59
"__id__": 63
},
{
"__id__": 66
"__id__": 70
}
],
"_active": true,
"_components": [
{
"__id__": 86
"__id__": 90
},
{
"__id__": 87
"__id__": 91
},
{
"__id__": 88
"__id__": 92
}
],
"_prefab": null,
......@@ -1460,7 +1460,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 600,
"height": 90
"height": 110
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -1472,7 +1472,7 @@
"ctor": "Float64Array",
"array": [
-62.593,
-196.015,
-191.291,
0,
0,
0,
......@@ -1513,8 +1513,8 @@
"_dstBlendFactor": 771,
"_string": "",
"_N$string": "",
"_fontSize": 40,
"_lineHeight": 40,
"_fontSize": 50,
"_lineHeight": 50,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
......@@ -1541,16 +1541,16 @@
"__id__": 34
},
{
"__id__": 36
"__id__": 39
},
{
"__id__": 41
"__id__": 44
},
{
"__id__": 43
"__id__": 46
},
{
"__id__": 45
"__id__": 48
}
],
"_active": true,
......@@ -1610,11 +1610,76 @@
"_parent": {
"__id__": 33
},
"_children": [
{
"__id__": 35
},
{
"__id__": 37
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 700,
"height": 158
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
371.414,
5.786,
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": "1foBDZ4NhEdKKeOFTW0HJo"
},
{
"__type__": "cc.Node",
"_name": "btn_restart",
"_objFlags": 0,
"_parent": {
"__id__": 34
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 35
"__id__": 36
}
],
"_prefab": null,
......@@ -1640,8 +1705,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
6.126,
5.786,
-38.906,
0,
0,
0,
0,
......@@ -1663,14 +1728,14 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "1foBDZ4NhEdKKeOFTW0HJo"
"_id": "172kD8vD1M6qC3tWw9lsAq"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 34
"__id__": 35
},
"_enabled": true,
"_materials": [
......@@ -1695,7 +1760,102 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "b5PQvSCQFMNZ2Z4Mkm2JHK"
"_id": "c5auoTht5EFYPUYBbnikR8"
},
{
"__type__": "cc.Node",
"_name": "New Label",
"_objFlags": 0,
"_parent": {
"__id__": 34
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 38
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 232,
"height": 73.08
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
186.595,
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": "03kH1T6eFGa4RXGdxzVQC0"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 37
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "再看一遍",
"_N$string": "再看一遍",
"_fontSize": 58,
"_lineHeight": 58,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "9aOwvD0hlOk6GDiiohF4WB"
},
{
"__type__": "cc.Node",
......@@ -1706,13 +1866,13 @@
},
"_children": [
{
"__id__": 37
"__id__": 40
}
],
"_active": true,
"_components": [
{
"__id__": 40
"__id__": 43
}
],
"_prefab": null,
......@@ -1768,16 +1928,16 @@
"_name": "img_ing",
"_objFlags": 0,
"_parent": {
"__id__": 36
"__id__": 39
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 38
"__id__": 41
},
{
"__id__": 39
"__id__": 42
}
],
"_prefab": null,
......@@ -1833,7 +1993,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 37
"__id__": 40
},
"_enabled": true,
"_materials": [
......@@ -1865,7 +2025,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 37
"__id__": 40
},
"_enabled": true,
"_normalMaterial": null,
......@@ -1926,7 +2086,7 @@
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": {
"__id__": 37
"__id__": 40
},
"_id": "ecrPqC/gZDobH2MQs86M5z"
},
......@@ -1935,7 +2095,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 36
"__id__": 39
},
"_enabled": true,
"_materials": [
......@@ -1970,10 +2130,10 @@
"__id__": 33
},
"_children": [],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 42
"__id__": 45
}
],
"_prefab": null,
......@@ -2029,7 +2189,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 41
"__id__": 44
},
"_enabled": true,
"_materials": [
......@@ -2065,10 +2225,10 @@
"__id__": 33
},
"_children": [],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 44
"__id__": 47
}
],
"_prefab": null,
......@@ -2124,7 +2284,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 43
"__id__": 46
},
"_enabled": true,
"_materials": [
......@@ -2161,16 +2321,16 @@
},
"_children": [
{
"__id__": 46
"__id__": 49
},
{
"__id__": 48
"__id__": 51
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 50
"__id__": 53
}
],
"_prefab": null,
......@@ -2226,13 +2386,13 @@
"_name": "RICHTEXT_CHILD",
"_objFlags": 1024,
"_parent": {
"__id__": 45
"__id__": 48
},
"_children": [],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 47
"__id__": 50
}
],
"_prefab": null,
......@@ -2259,7 +2419,7 @@
"ctor": "Float64Array",
"array": [
0,
0,
-37.8,
0,
0,
0,
......@@ -2282,14 +2442,14 @@
"_groupIndex": 0,
"groupIndex": 0,
"showInEditor": false,
"_id": "beLa1M0zNOn5faWkjLVLYU"
"_id": "7eMU2qVspOy7FMzWDWK2QQ"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 46
"__id__": 49
},
"_enabled": true,
"_materials": [
......@@ -2315,20 +2475,20 @@
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "48K8tp/whJI7rnbaVh6hr3"
"_id": "2av1a8HsBHaqsyvFDbNHnB"
},
{
"__type__": "cc.PrivateNode",
"_name": "RICHTEXT_CHILD",
"_objFlags": 1024,
"_parent": {
"__id__": 45
"__id__": 48
},
"_children": [],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 49
"__id__": 52
}
],
"_prefab": null,
......@@ -2354,8 +2514,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
472.45,
-37.8,
0,
0,
0,
......@@ -2378,14 +2538,14 @@
"_groupIndex": 0,
"groupIndex": 0,
"showInEditor": false,
"_id": "419V+A57dBuaNHlQ616TS2"
"_id": "79CHDwBxRDDbXbaOHgm6mk"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 48
"__id__": 51
},
"_enabled": true,
"_materials": [
......@@ -2411,14 +2571,14 @@
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "daZYEHYuVLaZ4oTRaguzJZ"
"_id": "36R9PPCXZOZLtRbcsCbpAx"
},
{
"__type__": "cc.RichText",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 45
"__id__": 48
},
"_enabled": true,
"_fontFamily": "Arial",
......@@ -2443,16 +2603,19 @@
},
"_children": [
{
"__id__": 52
"__id__": 55
},
{
"__id__": 54
"__id__": 57
}
],
"_active": true,
"_components": [
{
"__id__": 58
"__id__": 61
},
{
"__id__": 62
}
],
"_prefab": null,
......@@ -2508,13 +2671,13 @@
"_name": "ani",
"_objFlags": 0,
"_parent": {
"__id__": 51
"__id__": 54
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 53
"__id__": 56
}
],
"_prefab": null,
......@@ -2540,8 +2703,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
800.397,
-269.342,
800,
-270,
0,
0,
0,
......@@ -2570,7 +2733,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 52
"__id__": 55
},
"_enabled": true,
"_materials": [
......@@ -2610,17 +2773,17 @@
"_name": "btn_go",
"_objFlags": 0,
"_parent": {
"__id__": 51
"__id__": 54
},
"_children": [
{
"__id__": 55
"__id__": 58
}
],
"_active": false,
"_components": [
{
"__id__": 57
"__id__": 60
}
],
"_prefab": null,
......@@ -2647,7 +2810,7 @@
"ctor": "Float64Array",
"array": [
823.5,
-16.021,
51.802,
0,
0,
0,
......@@ -2676,13 +2839,13 @@
"_name": "text",
"_objFlags": 0,
"_parent": {
"__id__": 54
"__id__": 57
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 56
"__id__": 59
}
],
"_prefab": null,
......@@ -2696,8 +2859,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 97.87,
"height": 50.4
"width": 200,
"height": 80
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -2708,7 +2871,7 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
-7.546,
9,
0,
0,
......@@ -2738,7 +2901,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 55
"__id__": 58
},
"_enabled": true,
"_materials": [
......@@ -2752,7 +2915,7 @@
"_N$string": "Label",
"_fontSize": 40,
"_lineHeight": 40,
"_enableWrapText": true,
"_enableWrapText": false,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
......@@ -2762,7 +2925,7 @@
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$overflow": 2,
"_N$cacheMode": 0,
"_id": "afc8hY+ZlPH7Qv0lzw0KDE"
},
......@@ -2771,7 +2934,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 54
"__id__": 57
},
"_enabled": true,
"_materials": [
......@@ -2803,15 +2966,41 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 51
"__id__": 54
},
"_enabled": true,
"aniRole": {
"__id__": 52
"__id__": 55
},
"moveX": 500,
"_id": "e4RrOXSNJGd68Mq3UTYY0p"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 54
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 36,
"_left": 0,
"_right": 960,
"_top": 0,
"_bottom": 540,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "2cuzieJC1CB4cn2DtvSCDY"
},
{
"__type__": "cc.Node",
"_name": "video",
......@@ -2821,13 +3010,13 @@
},
"_children": [
{
"__id__": 60
"__id__": 64
},
{
"__id__": 62
"__id__": 66
},
{
"__id__": 64
"__id__": 68
}
],
"_active": true,
......@@ -2885,13 +3074,13 @@
"_name": "btn_return",
"_objFlags": 0,
"_parent": {
"__id__": 59
"__id__": 63
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 61
"__id__": 65
}
],
"_prefab": null,
......@@ -2947,7 +3136,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 60
"__id__": 64
},
"_enabled": true,
"_materials": [
......@@ -2979,13 +3168,13 @@
"_name": "icon_play",
"_objFlags": 0,
"_parent": {
"__id__": 59
"__id__": 63
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 63
"__id__": 67
}
],
"_prefab": null,
......@@ -3041,7 +3230,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 62
"__id__": 66
},
"_enabled": true,
"_materials": [
......@@ -3073,13 +3262,13 @@
"_name": "icon_stop",
"_objFlags": 0,
"_parent": {
"__id__": 59
"__id__": 63
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 65
"__id__": 69
}
],
"_prefab": null,
......@@ -3135,7 +3324,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 64
"__id__": 68
},
"_enabled": true,
"_materials": [
......@@ -3171,13 +3360,13 @@
},
"_children": [
{
"__id__": 67
"__id__": 71
},
{
"__id__": 70
"__id__": 74
},
{
"__id__": 71
"__id__": 75
}
],
"_active": true,
......@@ -3235,11 +3424,11 @@
"_name": "font",
"_objFlags": 0,
"_parent": {
"__id__": 66
"__id__": 70
},
"_children": [
{
"__id__": 68
"__id__": 72
}
],
"_active": true,
......@@ -3297,13 +3486,13 @@
"_name": "BRLNSDB",
"_objFlags": 0,
"_parent": {
"__id__": 67
"__id__": 71
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 69
"__id__": 73
}
],
"_prefab": null,
......@@ -3359,7 +3548,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 68
"__id__": 72
},
"_enabled": true,
"_materials": [
......@@ -3394,7 +3583,7 @@
"_name": "img",
"_objFlags": 0,
"_parent": {
"__id__": 66
"__id__": 70
},
"_children": [],
"_active": true,
......@@ -3452,15 +3641,9 @@
"_name": "audio",
"_objFlags": 0,
"_parent": {
"__id__": 66
"__id__": 70
},
"_children": [
{
"__id__": 72
},
{
"__id__": 74
},
{
"__id__": 76
},
......@@ -3475,6 +3658,12 @@
},
{
"__id__": 84
},
{
"__id__": 86
},
{
"__id__": 88
}
],
"_active": true,
......@@ -3532,13 +3721,13 @@
"_name": "btn",
"_objFlags": 0,
"_parent": {
"__id__": 71
"__id__": 75
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 73
"__id__": 77
}
],
"_prefab": null,
......@@ -3594,7 +3783,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 72
"__id__": 76
},
"_enabled": true,
"_clip": {
......@@ -3613,13 +3802,13 @@
"_name": "right",
"_objFlags": 0,
"_parent": {
"__id__": 71
"__id__": 75
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 75
"__id__": 79
}
],
"_prefab": null,
......@@ -3675,7 +3864,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 74
"__id__": 78
},
"_enabled": true,
"_clip": {
......@@ -3694,13 +3883,13 @@
"_name": "bettery",
"_objFlags": 0,
"_parent": {
"__id__": 71
"__id__": 75
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 77
"__id__": 81
}
],
"_prefab": null,
......@@ -3756,7 +3945,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 76
"__id__": 80
},
"_enabled": true,
"_clip": {
......@@ -3775,13 +3964,13 @@
"_name": "error",
"_objFlags": 0,
"_parent": {
"__id__": 71
"__id__": 75
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 79
"__id__": 83
}
],
"_prefab": null,
......@@ -3837,7 +4026,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 78
"__id__": 82
},
"_enabled": true,
"_clip": {
......@@ -3856,13 +4045,13 @@
"_name": "bgm",
"_objFlags": 0,
"_parent": {
"__id__": 71
"__id__": 75
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 81
"__id__": 85
}
],
"_prefab": null,
......@@ -3918,7 +4107,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 80
"__id__": 84
},
"_enabled": true,
"_clip": {
......@@ -3937,13 +4126,13 @@
"_name": "opendoor",
"_objFlags": 0,
"_parent": {
"__id__": 71
"__id__": 75
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 83
"__id__": 87
}
],
"_prefab": null,
......@@ -3999,7 +4188,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 82
"__id__": 86
},
"_enabled": true,
"_clip": {
......@@ -4018,13 +4207,13 @@
"_name": "light",
"_objFlags": 0,
"_parent": {
"__id__": 71
"__id__": 75
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 85
"__id__": 89
}
],
"_prefab": null,
......@@ -4080,7 +4269,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 84
"__id__": 88
},
"_enabled": true,
"_clip": {
......@@ -4146,6 +4335,9 @@
"__id__": 2
},
"_enabled": true,
"xiaodi": {
"__id__": 61
},
"question_img": {
"__id__": 25
},
......@@ -4153,19 +4345,22 @@
"__id__": 31
},
"btn_vioce": {
"__id__": 36
"__id__": 39
},
"btn_restart": {
"__id__": 34
},
"label_tip_wait": {
"__id__": 41
"__id__": 44
},
"label_tip_ing": {
"__id__": 43
"__id__": 46
},
"rich_content": {
"__id__": 45
"__id__": 48
},
"btn_go": {
"__id__": 57
},
"_id": "6eW7M4ET1L4KOTzIOVRmf8"
}
......
......@@ -25,15 +25,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
@property(dg_xiaodi) xiaodi: dg_xiaodi = null;
async onLoadEnd() {
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.initData();
this.initView();
this.initEvent();
// pg.view.find(this, 'layout_xiaodi').getComponent(dg_xiaodi).playEnter(this.data.npcAudio).then(() => {
// this.initGame();
// })
this.initGame();
this.xiaodi.playEnter(this.data.npcAudio).then(() => {
this.initGame();
})
// this.initGame();
}
_cantouch = null;
......@@ -63,6 +64,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
@property(cc.Node) label_tip_wait: cc.Node = null;
@property(cc.Node) label_tip_ing: cc.Node = null;
@property(cc.Node) rich_content: cc.Node = null;
@property(cc.Node) btn_go: cc.Node = null;
// 初始化页面
initView() {
......@@ -74,17 +76,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
// 事件监听
initEvent() {
pg.view.touchOn(this.btn_go, this.onTouchNext, this);
pg.view.touchOn(this.btn_restart, this.onTouchRestart, this);
pg.view.touchOn(this.btn_vioce, this.onTouchRecord, this);
pg.view.touchOn(pg.view.find(this.btn_vioce,'img_ing'), this.onTouchRecordEnd, this);
pg.view.touchOn(pg.view.find(this.btn_vioce, 'img_ing'), this.onTouchRecordEnd, this);
}
// 初始化游戏
initGame() {
this.nextStage();
}
//1. 完成录音倒计时等部分代码。
//2. 完成录音结果匹配代码(dg17)
//3. 增加录音结果音频等
//4. 右下角角色的音频播放动作
//5. 视频播放
......@@ -107,6 +108,20 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.btn_vioce.active = true;
pg.view.visible(pg.view.find(this.btn_vioce, 'img_ing'), false)
this.label_tip_wait.active = true;
// 展示下一题
this.btn_go.active = true;
if (!this.nextQuestion) {
pg.view.setString(pg.view.find(this.btn_go, 'text'), '看影像')
} else {
pg.view.setString(pg.view.find(this.btn_go, 'text'), '下一题')
}
this._cantouch = false;
this.xiaodi.playQuestionVoice(this.currentQuestion.startAudio).then(() => {
this._cantouch = true;
})
}
//按钮触发,使用的方法
......@@ -146,6 +161,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.view.visible(pg.view.find(this.btn_vioce, 'img_ing'), false)
}
async onTouchRecord() {
if (!this._cantouch) return;
if (this.recording) return;
if (this.recordAudio) return;
this.recording = true;
......@@ -201,7 +217,55 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.rich_content.active = true;
const richText = this.rich_content.getComponent(cc.RichText);
richText.string = str;
// 处理正确错误
this.scheduleOnce(() => {
if (isRight) {
this.xiaodi.playQuestionVoice(this.currentQuestion.rightAudio).then(() => {
this._cantouch = true;
this.showNextBtn();
})
} else {
this.xiaodi.playQuestionVoice(this.currentQuestion.errorAudio).then(() => {
this._cantouch = true;
})
}
}, 0.5)
}
showNextBtn() {
}
showVideo() {
return new Promise(reslove => {
reslove('')
})
}
onTouchRestart() {
// 处理展示视频内容
this.showVideo().then(() => {
// 底部显示为重新查看
this.btn_restart.active = true;
// 播放小迪结束的动作与gameOver相关内容
this.gameOver();
})
}
onTouchNext() {
if (this.recording) return;
if (!this.nextQuestion) {
// 处理展示视频内容
this.showVideo().then(() => {
// 底部显示为重新查看
this.btn_restart.active = true;
// 播放小迪结束的动作与gameOver相关内容
this.gameOver();
})
} else {
this.xiaodi.playQuestionVoiceEnd();
this.nextStage();
}
}
showData(data) {
let list = data.result.sentences[0].details;
// 列表处理
......@@ -253,6 +317,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.view.find(this, 'layout_xiaodi').getComponent(dg_xiaodi).playOverEnd()
}
private gameOver() {
// 按钮显示未下一题的显示内容
this.showXiaodi();
}
onTouchExit() {
......
......@@ -7,50 +7,29 @@ export default class dg_xiaodi extends cc.Component {
@property(cc.Node)
aniRole: cc.Node = null;
@property moveX: number = 500;
private defaultX: number;
onLoad() {
this.defaultX = this.aniRole.x;
}
private audioIdEnter: any;
playEnter(audioUrl) {
return new Promise((resolve, reject) => {
this.node.active = true;
let startX = this.defaultX + this.moveX;
let startX = 1500
this.aniRole.x = startX;
cc.tween(this.aniRole)
.call(() => {
pg.view.playDBAnimation(this.aniRole, 'run');
if (this.moveX < 0) {
this.aniRole.scaleX = -this.aniRole.scaleX;
}
})
.to(0.5, { x: 0 })
.to(0.5, { x: 800 })
.call(() => {
if (this.moveX < 0) {
this.aniRole.scaleX = -this.aniRole.scaleX;
}
pg.view.playDBAnimation(this.aniRole, 'talk');
pg.audio.playAudioByUrl(audioUrl, () => {
this.audioIdEnter = null;
cc.tween(this.aniRole)
.call(() => {
pg.view.playDBAnimation(this.aniRole, 'run');
if (this.moveX < 0) {
this.aniRole.scaleX = -this.aniRole.scaleX;
}
})
.to(0.5, { x: -1800 })
.call(() => {
this.scheduleOnce(() => {
this.playEnterEnd()
resolve('');
}, 0.5)
})
.start();
this.scheduleOnce(() => {
this.playEnterEnd()
resolve('');
}, 0.5)
}, audioId => {
this.audioIdEnter = audioId;
})
......@@ -59,38 +38,88 @@ export default class dg_xiaodi extends cc.Component {
});
}
playEnterEnd() {
this.node.active = false;
// this.node.active = false;
pg.view.playDBAnimation(this.aniRole, 'normal');
if (this.audioIdEnter) {
cc.audioEngine.stopEffect(this.audioIdEnter)
}
}
// private audioIdStart: any;
// playQuestionStart(audioUrl) {
// return new Promise((resolve, reject) => {
// pg.view.playDBAnimation(this.aniRole, 'talk');
// pg.audio.playAudioByUrl(audioUrl, () => {
// this.audioIdStart = null;
// this.scheduleOnce(() => {
// this.playQuestionStartEnd()
// resolve('');
// }, 0.5)
// }, audioId => {
// this.audioIdStart = audioId;
// })
// })
// }
// playQuestionStartEnd() {
// pg.view.playDBAnimation(this.aniRole, 'normal');
// if (this.audioIdStart) {
// cc.audioEngine.stopEffect(this.audioIdStart)
// }
// }
private audioIdVoice: any;
playQuestionVoice(audioUrl) {
return new Promise((resolve, reject) => {
pg.view.playDBAnimation(this.aniRole, 'talk');
pg.audio.playAudioByUrl(audioUrl, () => {
this.audioIdVoice = null;
this.scheduleOnce(() => {
this.playQuestionVoiceEnd()
resolve('');
}, 0.5)
}, audioId => {
this.audioIdVoice = audioId;
})
})
}
playQuestionVoiceEnd() {
pg.view.playDBAnimation(this.aniRole, 'normal');
if (this.audioIdVoice) {
cc.audioEngine.stopEffect(this.audioIdVoice)
}
}
private audioIdOver: any;
playOver(audioUrl) {
this.node.active = true;
let startX = this.defaultX + this.moveX;
this.aniRole.x = startX;
cc.tween(this.aniRole)
.call(() => {
pg.view.playDBAnimation(this.aniRole, 'run');
if (this.moveX < 0) {
this.aniRole.scaleX = -this.aniRole.scaleX;
}
})
.to(0.3, { x: this.defaultX })
.call(() => {
if (this.moveX < 0) {
this.aniRole.scaleX = -this.aniRole.scaleX;
}
pg.view.playDBAnimation(this.aniRole, 'talk');
pg.audio.playAudioByUrl(audioUrl, () => {
this.audioIdOver = null;
pg.view.playDBAnimation(this.aniRole, 'normal');
}, audioId => {
this.audioIdOver = audioId;
})
})
.start();
// let startX = this.defaultX + this.moveX;
// this.aniRole.x = startX;
// cc.tween(this.aniRole)
// .call(() => {
// pg.view.playDBAnimation(this.aniRole, 'run');
// if (this.moveX < 0) {
// this.aniRole.scaleX = -this.aniRole.scaleX;
// }
// })
// .to(0.3, { x: this.defaultX })
// .call(() => {
// if (this.moveX < 0) {
// this.aniRole.scaleX = -this.aniRole.scaleX;
// }
// pg.view.playDBAnimation(this.aniRole, 'talk');
// pg.audio.playAudioByUrl(audioUrl, () => {
// this.audioIdOver = null;
// pg.view.playDBAnimation(this.aniRole, 'normal');
// }, audioId => {
// this.audioIdOver = audioId;
// })
// })
// .start();
}
playOverEnd() {
this.node.active = false;
......
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