Commit 2fb2c068 authored by Chen Jiping's avatar Chen Jiping

feat:逻辑调整

parent 0c5730f2
...@@ -383,7 +383,7 @@ cc.Class({ ...@@ -383,7 +383,7 @@ cc.Class({
return; return;
} }
let wordNode = wordNodeArr[2 * index]; let wordNode = wordNodeArr[2 * this._curIndex];
this.playTextAutio(wordNode, wordNode.data.lrcData.audio_url, () => { this.playTextAutio(wordNode, wordNode.data.lrcData.audio_url, () => {
this._cantouch = true; this._cantouch = true;
...@@ -585,30 +585,16 @@ cc.Class({ ...@@ -585,30 +585,16 @@ cc.Class({
//停止监听动画 //停止监听动画
this._stopAni = true; this._stopAni = true;
this._cantouch = true;
state.stop(); state.stop();
//播放待机动画 //播放待机动画
this.playAni('normal', 0); this.playAni('normal', 0);
this._curIndex++;
this.moveHand(this._curIndex, () => {
this._cantouch = true;
this.showEnd();
})
if (callback) { if (callback) {
callback(); callback();
} }
}, (audioId) => { }, (audioId) => {
//显示完成,不再播放动画
if (this._shown) {
return;
}
//设置可播放动画 //设置可播放动画
this._stopAni = false; this._stopAni = false;
...@@ -765,7 +751,54 @@ cc.Class({ ...@@ -765,7 +751,54 @@ cc.Class({
if (time < currentTime) { if (time < currentTime) {
this.textTwinkle(node); //如果是最后一个匹配,则移动手指
if (len == 1) {
const showNext = () => {
this._cantouch = true;
if(this._shown){
return;
}
this._curIndex++;
if(this._curIndex >= this.data.exercises.wordArr.length && !this._times){
this._times = 1;
this._curIndex = 0;
console.log("the first time");
}
this.playAni('normal', 0);
this.moveHand(this._curIndex, () => {
this._cantouch = true;
this.showEnd();
})
}
let duration = cc.audioEngine.getDuration(audioId);
duration = Math.round(duration * 1000) / 1000;
console.log('Remaining time:', duration - currentTime);
//如果超过动画时长,则等音频播放完成后再移动手指
if(duration - currentTime > 0.6){
this.textTwinkle(node);
cc.audioEngine.setFinishCallback(audioId, () => {
showNext();
});
}
else{
this.textTwinkle(node, () => {
showNext();
});
}
}
else{
this.textTwinkle(node);
}
//移除匹配上的元素 //移除匹配上的元素
arr.splice(i, 1); arr.splice(i, 1);
......
export const defaultData = { export const defaultData = {
"exercises": { "exercises":{
"wordArr": [{ "wordArr":[
"val": "A", {
"lrcData": { "val":"A",
"audio_url": "http://staging-teach.cdn.ireadabc.com/e896863da284cf8ba738caf98d568d39.mp3", "lrcData":{
"fontSize": 24, "audio_url":"http://staging-teach.cdn.ireadabc.com/e896863da284cf8ba738caf98d568d39.mp3",
"lineHeight": 32, "fontSize":24,
"lyrics": [{ "lineHeight":32,
"time": 0, "lyrics":[
"data": "", {
"newLine": false "time":0.040271,
}, { "data":"",
"time": 1.211424, "newLine":false
"data": "", },
"newLine": false {
}, { "time":1.277515,
"time": 2.411394, "data":"",
"data": "", "newLine":false
"newLine": false },
}] {
}, "time":2.574908,
"audioUrl": "http://staging-teach.cdn.ireadabc.com/e896863da284cf8ba738caf98d568d39.mp3" "data":"",
}, { "newLine":false
"val": "a", }
"lrcData": { ]
"audio_url": "http://staging-teach.cdn.ireadabc.com/9747c77fc914684e151aac636e1b47b6.mp3", }
"fontSize": 24, },
"lineHeight": 32, {
"lyrics": [{ "val":"a",
"time": 0, "lrcData":{
"data": "", "audio_url":"http://staging-teach.cdn.ireadabc.com/9747c77fc914684e151aac636e1b47b6.mp3",
"newLine": false "fontSize":24,
}, { "lineHeight":32,
"time": 1.258075, "lyrics":[
"data": "", {
"newLine": false "time":0.120777,
}, { "data":"",
"time": 2.532695, "newLine":false
"data": "", },
"newLine": false {
}] "time":1.158266,
}, "data":"",
"audioUrl": "http://staging-teach.cdn.ireadabc.com/9747c77fc914684e151aac636e1b47b6.mp3" "newLine":false
}], },
"picUrl": "http://staging-teach.cdn.ireadabc.com/d125fe9022b0528cfbb621dd5b9f701a.png" {
} "time":2.447526,
} "data":"",
"newLine":false
}
]
}
}
],
"picUrl":"http://staging-teach.cdn.ireadabc.com/101cdabba6404b73292d3b676f4683b1.png",
"audioUrl":"http://staging-teach.cdn.ireadabc.com/bbab99eb9f5fe3cbe2d24cf80594d8c9.mp3"
},
"audioUrl":"http://staging-teach.cdn.ireadabc.com/bbab99eb9f5fe3cbe2d24cf80594d8c9.mp3",
"guideAudioUrl1":"http://staging-teach.cdn.ireadabc.com/c3b83a24fd8f9b37ee72409cdb45e3f7.mp3",
"guideAudioUrl2":"http://staging-teach.cdn.ireadabc.com/9f6ff5d0617bf274ee2d9af4cfc93c62.mp3",
"guideAudioUrl3":"http://staging-teach.cdn.ireadabc.com/c3b83a24fd8f9b37ee72409cdb45e3f7.mp3"
};
\ No newline at end of file
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