Commit b739e1fc authored by 李维's avatar 李维

完成语音评测页面

parent f8b65a0e
...@@ -40,19 +40,22 @@ ...@@ -40,19 +40,22 @@
}, },
{ {
"__id__": 33 "__id__": 33
},
{
"__id__": 36
} }
], ],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 36 "__id__": 44
}, },
{ {
"__id__": 37 "__id__": 45
} }
], ],
"_prefab": { "_prefab": {
"__id__": 38 "__id__": 46
}, },
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
...@@ -1342,6 +1345,272 @@ ...@@ -1342,6 +1345,272 @@
"fileId": "c8TTnwgvpL2Kb1J1NCiHC8", "fileId": "c8TTnwgvpL2Kb1J1NCiHC8",
"sync": false "sync": false
}, },
{
"__type__": "cc.Node",
"_name": "audioClips",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 37
},
{
"__id__": 40
}
],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 43
},
"_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": ""
},
{
"__type__": "cc.Node",
"_name": "right",
"_objFlags": 0,
"_parent": {
"__id__": 36
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 38
}
],
"_prefab": {
"__id__": 39
},
"_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": ""
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 37
},
"_enabled": true,
"_clip": {
"__uuid__": "9ab937ea-56b2-433a-8bf2-fc5db40f33d6"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "87e8bdef-072f-4642-b630-352bb34d47b4"
},
"fileId": "b72HtDZt5D1JFSlkV3dHvr",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "wrong",
"_objFlags": 0,
"_parent": {
"__id__": 36
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 41
}
],
"_prefab": {
"__id__": 42
},
"_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": ""
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 40
},
"_enabled": true,
"_clip": {
"__uuid__": "2ca571b6-6cc3-4b8f-830e-e9dd662c0b6c"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "87e8bdef-072f-4642-b630-352bb34d47b4"
},
"fileId": "0chKulT+1NHLcNjfZBplCI",
"sync": false
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "87e8bdef-072f-4642-b630-352bb34d47b4"
},
"fileId": "dessiBBVFGHYtjCtBgRQeZ",
"sync": false
},
{ {
"__type__": "cc.Widget", "__type__": "cc.Widget",
"_name": "", "_name": "",
...@@ -1377,6 +1646,8 @@ ...@@ -1377,6 +1646,8 @@
"__id__": 1 "__id__": 1
}, },
"_enabled": true, "_enabled": true,
"audioBeforeTest": "",
"recordWaitCount": 0,
"_id": "" "_id": ""
}, },
{ {
......
{
"ver": "1.1.2",
"uuid": "d5d7295b-e125-4e5f-b27f-fc93795c8e53",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "9ab937ea-56b2-433a-8bf2-fc5db40f33d6",
"downloadMode": 0,
"duration": 0.45102,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "2ca571b6-6cc3-4b8f-830e-e9dd662c0b6c",
"downloadMode": 0,
"duration": 0.6818,
"subMetas": {}
}
\ No newline at end of file
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
"rawHeight": 51, "rawHeight": 51,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 38,
"borderRight": 0, "borderRight": 16,
"subMetas": {} "subMetas": {}
} }
} }
......
...@@ -27,6 +27,7 @@ const MSG_PLAYER_TO_HOME = "msg_player_to_home"; ...@@ -27,6 +27,7 @@ const MSG_PLAYER_TO_HOME = "msg_player_to_home";
const MSG_PROFIX_END = "__END__"; const MSG_PROFIX_END = "__END__";
const DEBUG = true; const DEBUG = true;
const TOTAL_SCORE = 42; // 总分 - 双方分数之和等于 TOTAL_SCORE const TOTAL_SCORE = 42; // 总分 - 双方分数之和等于 TOTAL_SCORE
const AI_SUCCESS_RATE = 0.85; // ai评测成功率
@ccclass @ccclass
export default class SceneComponent extends MyCocosSceneComponent { export default class SceneComponent extends MyCocosSceneComponent {
...@@ -152,6 +153,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -152,6 +153,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.initLoadingLayer(); this.initLoadingLayer();
this.initOfflineLayer(); this.initOfflineLayer();
this.initPronunciationTestLayer(); this.initPronunciationTestLayer();
this.initCoolCat();
this.initTurntable(); this.initTurntable();
this.initGemstone(); this.initGemstone();
this.initScore(); this.initScore();
...@@ -210,6 +212,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -210,6 +212,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
initPronunciationTestLayer() { initPronunciationTestLayer() {
const loadingLayerBase = cc.find("Canvas/PronunciationTestLayer"); const loadingLayerBase = cc.find("Canvas/PronunciationTestLayer");
this.pronunciationTestLayer = loadingLayerBase.getComponent("PronunciationTestLayer"); this.pronunciationTestLayer = loadingLayerBase.getComponent("PronunciationTestLayer");
this.pronunciationTestLayer.init("http://staging-teach.cdn.ireadabc.com/31952573236dd316a8ee1672d1614a1c.mp3")
} }
redPlayerNode = null; redPlayerNode = null;
...@@ -238,6 +241,12 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -238,6 +241,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.treeNode = cc.find("Canvas/center_map/tree/stand"); this.treeNode = cc.find("Canvas/center_map/tree/stand");
} }
// 初始化酷猫
coolCat = null;
initCoolCat() {
this.coolCat = cc.find("Canvas/coolcatLand/coolcat");
}
// 小人上树 // 小人上树
playerToTree(playerNode) { playerToTree(playerNode) {
const wordPos = this.treeNode.convertToWorldSpaceAR(cc.v2(0, 0)) const wordPos = this.treeNode.convertToWorldSpaceAR(cc.v2(0, 0))
...@@ -700,7 +709,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -700,7 +709,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
if(isAi) { if(isAi) {
setTimeout(() => { setTimeout(() => {
console.log("语音评测结束") console.log("语音评测结束")
if(Math.random() > 1) { if(Math.random() > AI_SUCCESS_RATE) {
console.log("评测失败,后退") console.log("评测失败,后退")
// 后退 // 后退
this.runEvent(MSG_PLAYER_TO_HOME, {success: false, gemIndex: param.index}); this.runEvent(MSG_PLAYER_TO_HOME, {success: false, gemIndex: param.index});
...@@ -711,7 +720,9 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -711,7 +720,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
}, DEBUG?10:2000); }, DEBUG?10:2000);
} else { } else {
this.coolCat.active = false;
this.pronunciationTestLayer.showVoice(this.gemstonesAll[param.index], this.gemstonesAll[param.index].__letter).then(res=>{ this.pronunciationTestLayer.showVoice(this.gemstonesAll[param.index], this.gemstonesAll[param.index].__letter).then(res=>{
this.coolCat.active = true;
this.runEvent(MSG_PLAYER_TO_HOME, {success: res, gemIndex: param.index}); this.runEvent(MSG_PLAYER_TO_HOME, {success: res, gemIndex: param.index});
}) })
} }
......
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