Commit 07c967ee authored by limingzhe's avatar limingzhe

fix: 闪屏异常

parents ea23c04c af228ac2
......@@ -87,9 +87,21 @@ cc.Class({
this.gameLogic.destroy();
},
getData(cb) {
cb(this.getDefaultData());
},
getData(func) {
if (window && window.courseware) {
window.courseware.getData(func, 'scene');
return;
}
const middleLayer = cc.find('middleLayer');
if (middleLayer) {
const middleLayerComponent = middleLayer.getComponent('middleLayer');
middleLayerComponent.getData(func);
return;
}
func(this.getDefaultData());
},
getDefaultData() {
const dataJson = '{"contentObj":{"version":"1.0","key":"DataKey_Sbox_FT_08","bgMusic":"","titleText":"","questionAudio_url":"http://staging-teach.cdn.ireadabc.com/ebd0090da6d9e7a293d8b58f4e653841.mp3","birdDragonBones_1":{},"birdDragonBones_2":{},"birdDragonBones_audio":{},"dataArray":[{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/06cc843598a912921f6ca3acfde6220b.png","dragonBones":{},"audio_url":"http://staging-teach.cdn.ireadabc.com/2bf96923b83ee0c5f20930386ce07384.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/571974922f6678111348a5643dba7e20.png","dragonBones":{},"audio_url":"http://staging-teach.cdn.ireadabc.com/ebd0090da6d9e7a293d8b58f4e653841.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/78579114773af12a7aec6723e3b9d475.png","dragonBones":{},"audio_url":"http://staging-teach.cdn.ireadabc.com/a76cbdade5c43c73bd2b491a71b06fcb.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/c99e82e1c3f087c6dc0469e30c624f70.png","dragonBones":{}},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/5b45c89ac9e899d76522767219b1346b.png","dragonBones":{}}]}}'
......
......@@ -263,10 +263,10 @@ export default class GameLogic {
this.g_cartoon.getCartoonElement("bird_1").wrong()
this.g_cartoon.getCartoonElement("bird_2").wrong()
this.g_cartoon.playAudio("try_again", ()=>{
setTimeout(()=>{
this._timeoutIds.push(setTimeout(()=>{
this.g_cartoon.playAudio(this.g_formData.dataArray[this.m_currentQuestion].audio_url)
this.enableClick(`card_${index+1}_image_container`)
}, 1000)
}, 1000))
})
} else {
this.enableClick(`card_${index+1}_image_container`)
......@@ -346,11 +346,11 @@ export default class GameLogic {
})
this.g_cartoon.tweenChange(bell2.node, {scaleX: 1, scaleY: 1}, 0.2, ()=>{
this.g_cartoon.getCartoonElement("bird_1").flyBack(()=>{
setTimeout(()=>{
this._timeoutIds(setTimeout(()=>{
if(callback) {
callback();
}
}, 1500)
}, 1500))
})
this.g_cartoon.getCartoonElement("bird_2").flyBack()
});
......@@ -699,21 +699,21 @@ export default class GameLogic {
birdAniWrong_1.node.opacity = 255;
birdStatic_1.node.opacity = 0;
birdAudio.switchAni(1)
setTimeout(() => {
this._timeoutIds(setTimeout(() => {
birdAniWrong_1.node.opacity = 0;
birdStatic_1.node.opacity = 255;
birdAudio.switchAni(0)
}, 1000);
}, 1000));
}
bird_2.wrong = ()=>{
birdAniWrong_2.node.opacity = 255;
birdStatic_2.node.opacity = 0;
setTimeout(() => {
this._timeoutIds(setTimeout(() => {
birdAniWrong_2.node.opacity = 0;
birdStatic_2.node.opacity = 255;
}, 1000);
}, 1000));
}
bird_1.node.y = -cc.winSize.height / 2 + bird_1.node.height + 10
......@@ -768,19 +768,24 @@ export default class GameLogic {
const downTime = Math.ceil((cc.winSize.height / 100) * 1000) / 1000
console.log(downTime)
this.intervalID = setInterval(() => {
console.log(' in snowing 3')
this._intervalIds.push(setInterval(() => {
let snow = getSnow( Math.ceil(Math.random()*4) )
// this.g_cartoon.tweenChange(snow, {y: -cc.winSize.height / 2}, downTime)
cc.tween(snow).to(downTime, {y: -cc.winSize.height / 2}).call(()=>snow.destroy()).start()
}, 100);
}, 100));
}
_timeoutIds = []
_intervalIds = []
// 生命周期
destroy() {
clearInterval(this.intervalID);
this._timeoutIds.forEach(id => {
clearTimeout(id);
});
this._intervalIds.forEach(id => {
clearInterval(id);
});
}
......@@ -792,9 +797,6 @@ export default class GameLogic {
// Common function
maskLayer = null;
initMaskLayer() {
......
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