Commit e62b0390 authored by limingzhe's avatar limingzhe

feat: 增加数据池

parent 671eabdf
No preview for this file type
......@@ -202,10 +202,12 @@ cc.Class({
step: null,
canTouch: null,
dataPool: null,
initData() {
// 所有全局变量 默认都是null
this.canTouch = false;
this.step = 1;
this.dataPool = [];
},
audioBtn: null,
......@@ -569,7 +571,8 @@ cc.Class({
letterAnim.play('anim_A_0');
const cb = () => {
this.canTouch = true;
// this.canTouch = true;
this.checkShowDataPool();
letterAnim.off('finished', cb)
}
letterAnim.on('finished', cb);
......@@ -606,7 +609,8 @@ cc.Class({
letterAnim.play('anim_a_0');
const cb = () => {
this.canTouch = true;
// this.canTouch = true;
this.checkShowDataPool();
letterAnim.off('finished', cb)
}
letterAnim.on('finished', cb);
......@@ -1429,11 +1433,12 @@ cc.Class({
},
photoEnd(data) {
photoEnd(data, isPool = false) {
console.log(' this.photo end');
if (!this.canTouch) {
if (!this.canTouch && isPool == false) {
this.dataPool.push(data);
console.log('! cantouch')
return;
}
......@@ -1487,7 +1492,8 @@ cc.Class({
this.canTouch = false;
this.showStepAudio();
} else {
this.canTouch = true;
// this.canTouch = true;
this.checkShowDataPool();
}
// const isFillAll = this.checkIsFillAll(answerData);
......@@ -1533,7 +1539,8 @@ cc.Class({
playAudioStep2() {
playAudioByUrl(this.data.write_big_2_audio_url, () => {
this.canTouch = true;
// this.canTouch = true;
this.checkShowDataPool();
});
},
......@@ -1546,16 +1553,29 @@ cc.Class({
playAudioStep4() {
playAudioByUrl(this.data.write_small_2_audio_url, () => {
this.canTouch = true;
this.checkShowDataPool();
// this.canTouch = true;
});
},
playAudioStep5() {
playAudioByUrl(this.data.finish_audio_url, () => {
// this.canTouch = true;
});
},
checkShowDataPool() {
if (this.dataPool.length == 0) {
this.canTouch = true;
return;
}
const data = this.dataPool.shift();
this.photoEnd(data, true);
},
checkShowStepAudio() {
......@@ -1660,7 +1680,8 @@ cc.Class({
const playEnd = () => {
this.playAni('normal', 0);
this.showSmallLetterAnim();
this.canTouch = true;
// this.checkShowDataPool();
// this.canTouch = true;
}
if (!this.data.write_small_0_audio_url) {
......@@ -1695,7 +1716,8 @@ cc.Class({
const playEnd = () => {
this.playAni('normal', 0);
this.canTouch = true;
// this.canTouch = true;
this.checkShowDataPool();
// this.startTesting();
}
......
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