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

feat:逻辑调整

parent 0c5730f2
......@@ -383,7 +383,7 @@ cc.Class({
return;
}
let wordNode = wordNodeArr[2 * index];
let wordNode = wordNodeArr[2 * this._curIndex];
this.playTextAutio(wordNode, wordNode.data.lrcData.audio_url, () => {
this._cantouch = true;
......@@ -585,30 +585,16 @@ cc.Class({
//停止监听动画
this._stopAni = true;
this._cantouch = true;
state.stop();
//播放待机动画
this.playAni('normal', 0);
this._curIndex++;
this.moveHand(this._curIndex, () => {
this._cantouch = true;
this.showEnd();
})
if (callback) {
callback();
}
}, (audioId) => {
//显示完成,不再播放动画
if (this._shown) {
return;
}
//设置可播放动画
this._stopAni = false;
......@@ -765,7 +751,54 @@ cc.Class({
if (time < currentTime) {
//如果是最后一个匹配,则移动手指
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);
......
export const defaultData = {
"exercises": {
"wordArr": [{
"val": "A",
"lrcData": {
"audio_url": "http://staging-teach.cdn.ireadabc.com/e896863da284cf8ba738caf98d568d39.mp3",
"fontSize": 24,
"lineHeight": 32,
"lyrics": [{
"time": 0,
"data": "",
"newLine": false
}, {
"time": 1.211424,
"data": "",
"newLine": false
}, {
"time": 2.411394,
"data": "",
"newLine": false
}]
"exercises":{
"wordArr":[
{
"val":"A",
"lrcData":{
"audio_url":"http://staging-teach.cdn.ireadabc.com/e896863da284cf8ba738caf98d568d39.mp3",
"fontSize":24,
"lineHeight":32,
"lyrics":[
{
"time":0.040271,
"data":"",
"newLine":false
},
"audioUrl": "http://staging-teach.cdn.ireadabc.com/e896863da284cf8ba738caf98d568d39.mp3"
}, {
"val": "a",
"lrcData": {
"audio_url": "http://staging-teach.cdn.ireadabc.com/9747c77fc914684e151aac636e1b47b6.mp3",
"fontSize": 24,
"lineHeight": 32,
"lyrics": [{
"time": 0,
"data": "",
"newLine": false
}, {
"time": 1.258075,
"data": "",
"newLine": false
}, {
"time": 2.532695,
"data": "",
"newLine": false
}]
{
"time":1.277515,
"data":"",
"newLine":false
},
"audioUrl": "http://staging-teach.cdn.ireadabc.com/9747c77fc914684e151aac636e1b47b6.mp3"
}],
"picUrl": "http://staging-teach.cdn.ireadabc.com/d125fe9022b0528cfbb621dd5b9f701a.png"
{
"time":2.574908,
"data":"",
"newLine":false
}
}
]
}
},
{
"val":"a",
"lrcData":{
"audio_url":"http://staging-teach.cdn.ireadabc.com/9747c77fc914684e151aac636e1b47b6.mp3",
"fontSize":24,
"lineHeight":32,
"lyrics":[
{
"time":0.120777,
"data":"",
"newLine":false
},
{
"time":1.158266,
"data":"",
"newLine":false
},
{
"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