Commit e62b0390 authored by limingzhe's avatar limingzhe

feat: 增加数据池

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