Commit cabe61c7 authored by Tt's avatar Tt

处理完成

parent 19c93dcc
......@@ -193,7 +193,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.recording = false;
this.showTimeEnd();
let testData = {
"text": "yes i can blue whales qiant pandas endangered",
"text": "somewhere else to find food",
"audio": "https://staging-teach.cdn.ireadabc.com/6ee3ccaa831a884f02c6a75c6f647cb5.wav"
}
if (!courseware) {
......@@ -216,13 +216,24 @@ export default class SceneComponent extends MyCocosSceneComponent {
keyTextArr = keyTextArr.map(key => {
return key.trim();
})
const dataTextArr = data.text.split(" ");
let colorNormal = '#313131';
let colorRight = '#1D8B38';
let str = '';
let isRight = false;
// 整句识别判断对错 如果需要特殊的方式就是,把整个句子拆分开来,
// 1.识别当前句子中哪些是整句匹配的标绿
// 2.识别当前句子中哪些是小词匹配的标绿
// 3.整理修改方案(整段句子不进行拆分,哪一部分标绿就把哪一部分拆出来,产生一个数组,A -> A G A , A => A G A G A,依次类推通过递归拆分数组)
// 4.最后抛出一个调整之后的数组。 或者每一个拆分出去的瞬间,做一个下标记录,识别一个,下标一个,按顺序来。
if (keyTextArr[0] == data.text) {
let color = colorNormal;
color = colorRight;
str += `<color=${color}>${data.text}</color> `
} else {
// 拆散判断对错
const dataTextArr = data.text.split(" ");
for (let i = 0; i < dataTextArr.length; i++) {
const word = dataTextArr[i];
let color = colorNormal;
......@@ -232,6 +243,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
str += `<color=${color}>${word}</color> `
}
}
this.rich_content.active = true;
const richText = this.rich_content.getComponent(cc.RichText);
......@@ -241,18 +253,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.scheduleOnce(() => {
if (isRight) {
this.xiaodi.playQuestionVoice(this.currentQuestion.rightAudio).then(() => {
this.scheduleOnce(() => {
this._cantouch = true;
this.showNextBtn();
}, 0.5)
})
} else {
this.xiaodi.playQuestionVoice(this.currentQuestion.errorAudio).then(() => {
this.scheduleOnce(() => {
this._cantouch = true;
}, 0.5)
})
}
}, 0.5)
}
showNextBtn() {
}
onTouchRestart() {
// 处理展示视频内容
......@@ -368,6 +380,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.showUI();
}
initVideoPlayer() {
this.videoPlayer.node.x = -10000;
this.videoPlayer.node.y = -10000;
this.layout_video.active = false;
this.videoPlayer.node.on('ready-to-play', () => {
console.log('ready-to-play');
this._isReadyToPlay = true;
......@@ -630,6 +645,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.view.find(this, 'layout_xiaodi').getComponent(dg_xiaodi).playOverEnd()
}
private gameOver() {
this.rich_content.active = false;
// 按钮显示未下一题的显示内容
this.showXiaodi();
}
......
export const defaultData =
{"npcAudioText":"去看影像","npcAudio":"","npcAudioName":"","npcAudioEnd":"http://teach.cdn.ireadabc.com/51cf798ecb6d6503b568650119756323_l.mp3","npcAudioEndName":"","video":"http://teach.cdn.ireadabc.com/dd6c6a4d86af226e3d4cf3c86233889c.mp4","questions":[{"img":"http://teach.cdn.ireadabc.com/22bd5eb379682e6577d7c4865ffb06f8.png","title":"The pictures show some endangered animals.Can you name any other endangered animals?","keyword":"Yes, I can, Blue whales, giant pandas, endangered","startAudio":"http://teach.cdn.ireadabc.com/7b060c020cbc36cf6d1e1c50f569df18_l.mp3","startAudioName":"","rightAudio":"http://teach.cdn.ireadabc.com/e3ab2de0acd00ccc9dc7c895d30a0f7b_l.mp3","rightAudioName":"","errorAudio":"http://teach.cdn.ireadabc.com/acd02042b5e43fafc99784efc11beae0_l.mp3","errorAudioName":"","audioName":""},{"img":"http://teach.cdn.ireadabc.com/9ff8046fa6e17f42e850e15d2de7ea56.png","title":"7545437567456","keyword":"dig, head, circle, glass, short hair","startAudio":"http://teach.cdn.ireadabc.com/9fadff1fae6245b15217aa70de36eb37_l.mp3","startAudioName":"","rightAudio":"http://teach.cdn.ireadabc.com/d41d8cd98f00b204e9800998ecf8427e_l.mp3","rightAudioName":"","errorAudio":"http://teach.cdn.ireadabc.com/acd02042b5e43fafc99784efc11beae0_l.mp3","errorAudioName":"","audioName":""}],"questionText":"","audioName":""}
{
"npcAudioText": "结束",
"npcAudio": "", "npcAudioName": "",
"npcAudioEnd": "http://teach.cdn.ireadabc.com/51cf798ecb6d6503b568650119756323_l.mp3",
"npcAudioEndName": "", "video": "http://teach.cdn.ireadabc.com/dd6c6a4d86af226e3d4cf3c86233889c.mp4",
"questions": [{
"img": "http://teach.cdn.ireadabc.com/22bd5eb379682e6577d7c4865ffb06f8.png",
"title": "The pictures show some endangered animals.Can you name any other endangered animals?",
// "keyword": "Yes, I can, Blue whales, giant pandas, endangered",
"keyword": "somewhere else to find food",
"startAudio": "",
"startAudioName": "",
"rightAudio": "http://teach.cdn.ireadabc.com/e3ab2de0acd00ccc9dc7c895d30a0f7b_l.mp3",
"rightAudioName": "", "errorAudio": "http://teach.cdn.ireadabc.com/acd02042b5e43fafc99784efc11beae0_l.mp3", "errorAudioName": "", "audioName": ""
}, { "img": "http://teach.cdn.ireadabc.com/9ff8046fa6e17f42e850e15d2de7ea56.png", "title": "7545437567456", "keyword": "dig, head, circle, glass, short hair", "startAudio": "http://teach.cdn.ireadabc.com/9fadff1fae6245b15217aa70de36eb37_l.mp3", "startAudioName": "", "rightAudio": "http://teach.cdn.ireadabc.com/d41d8cd98f00b204e9800998ecf8427e_l.mp3", "rightAudioName": "", "errorAudio": "http://teach.cdn.ireadabc.com/acd02042b5e43fafc99784efc11beae0_l.mp3", "errorAudioName": "", "audioName": "" }], "questionText": "", "audioName": ""
}
let a = {
"npcTitle": "exit",
......@@ -14,7 +29,7 @@ let a = {
{
"img": "http://staging-teach.cdn.ireadabc.com/b4494456199505bdf990fff96a0c9fb8.jpg",
"title": "this is first question on this world?",
"keyword": "hello,world,good,info",
"keyword": "somewhere else to find food",
"startAudio": "http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610_l.mp3",
"startAudioName": "",
"rightAudio": "http://staging-teach.cdn.ireadabc.com/289fe0a6d9893519c3fb5993b86b6fe9_l.mp3",
......
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