Commit faa9641b authored by limingzhe's avatar limingzhe

fix: 闪屏测试

parents 1472461c e88c2d9c
{ {"ver":"1.1.2","uuid":"f6e31e97-ccb9-4c5f-a2fa-b4eed558e692","isBundle":false,"bundleName":"","priority":1,"compressionType":{},"optimizeHotUpdate":{},"inlineSpriteFrames":{},"isRemoteBundle":{"ios":false,"android":false},"subMetas":{}}
"ver": "1.1.2", \ No newline at end of file
"uuid": "f6e31e97-ccb9-4c5f-a2fa-b4eed558e692",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {
"ios": false,
"android": false
},
"subMetas": {}
}
\ No newline at end of file
...@@ -89,6 +89,8 @@ cc.Class({ ...@@ -89,6 +89,8 @@ cc.Class({
onDestory() { onDestory() {
cc.audioEngine.stopAll() cc.audioEngine.stopAll()
this.gameLogic.destroy()
}, },
getData(func) { getData(func) {
...@@ -106,6 +108,10 @@ cc.Class({ ...@@ -106,6 +108,10 @@ cc.Class({
func(this.getDefaultData()); func(this.getDefaultData());
}, },
<<<<<<< HEAD
=======
>>>>>>> e88c2d9cbb93dd63b82666ce50372da1e3cc16f1
getDefaultData() { getDefaultData() {
const dataJson = '{"contentObj":{"version":"1.0","key":"DataKey_Sbx_Pronunciation","theme":"D","border_image_url":"","video_image_url":"","text_image_url":"","dataArray":[{"video_url":"http://staging-teach.cdn.ireadabc.com/16eace86b47925cc644797cecd37b03b.mp4","textDragonBones":{"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/e74e4ffcb5c7b3321b448c93969541cd.png","name":"kkKoala_tex.png"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/fca011e0fe39287dc8dd2cd44c0ef7ed.json","name":"kkKoala_tex.json"},"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/d825a8ed1199f157800e11ddb9954146.json","name":"kkKoala_ske.json"}},"rightDragonBones":{"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/aedca82ee5031ab43082c7a08a79b3d6.png","name":"蚂蚁骨骼_animation_tex.png"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/f86dd94a9d56eab7c5f257abc600a577.json","name":"蚂蚁骨骼_animation_tex.json"},"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/5482364adfb24d2b0f627f2767167f4b.json","name":"蚂蚁骨骼_animation_ske.json"}},"rightType":"image","image_url":"http://staging-teach.cdn.ireadabc.com/863035154daca76366204c0d4dddee51.png"}]}}' const dataJson = '{"contentObj":{"version":"1.0","key":"DataKey_Sbx_Pronunciation","theme":"D","border_image_url":"","video_image_url":"","text_image_url":"","dataArray":[{"video_url":"http://staging-teach.cdn.ireadabc.com/16eace86b47925cc644797cecd37b03b.mp4","textDragonBones":{"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/e74e4ffcb5c7b3321b448c93969541cd.png","name":"kkKoala_tex.png"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/fca011e0fe39287dc8dd2cd44c0ef7ed.json","name":"kkKoala_tex.json"},"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/d825a8ed1199f157800e11ddb9954146.json","name":"kkKoala_ske.json"}},"rightDragonBones":{"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/aedca82ee5031ab43082c7a08a79b3d6.png","name":"蚂蚁骨骼_animation_tex.png"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/f86dd94a9d56eab7c5f257abc600a577.json","name":"蚂蚁骨骼_animation_tex.json"},"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/5482364adfb24d2b0f627f2767167f4b.json","name":"蚂蚁骨骼_animation_ske.json"}},"rightType":"image","image_url":"http://staging-teach.cdn.ireadabc.com/863035154daca76366204c0d4dddee51.png"}]}}'
......
...@@ -174,13 +174,24 @@ export default class Cartoon { ...@@ -174,13 +174,24 @@ export default class Cartoon {
} }
} }
_timeoutIds = []
_intervalIds = []
destroy() {
this._timeoutIds.forEach(id => {
clearTimeout(id);
});
this._intervalIds.forEach(id => {
clearInterval(id);
});
}
playVideo(videoPlayer, callback) { playVideo(videoPlayer, callback) {
if(videoPlayer && videoPlayer.isPlaying) { if(videoPlayer && videoPlayer.isPlaying) {
videoPlayer.stop() videoPlayer.stop()
} }
if(videoPlayer) { if(videoPlayer) {
setTimeout(()=>{ this._timeoutIds(setTimeout(()=>{
videoPlayer.play() videoPlayer.play()
videoPlayer.node.off("completed") videoPlayer.node.off("completed")
videoPlayer.node.on("completed", ()=>{ videoPlayer.node.on("completed", ()=>{
...@@ -188,7 +199,7 @@ export default class Cartoon { ...@@ -188,7 +199,7 @@ export default class Cartoon {
callback() callback()
} }
}) })
}, 50) }, 50))
} }
} }
...@@ -397,9 +408,9 @@ class DragonBones { ...@@ -397,9 +408,9 @@ class DragonBones {
let sx = parentNode.width / animaNode.width; // let sx = parentNode.width / animaNode.width;
let sy = parentNode.height / animaNode.height; // let sy = parentNode.height / animaNode.height;
animaNode.setScale(Math.min(sx, sy)); // animaNode.setScale(Math.min(sx, sy));
if(callback) { if(callback) {
callback(this) callback(this)
} }
......
...@@ -452,16 +452,16 @@ export default class GameLogic { ...@@ -452,16 +452,16 @@ export default class GameLogic {
if(this.m_currentQuestion >= this.g_formData.dataArray.length) { if(this.m_currentQuestion >= this.g_formData.dataArray.length) {
this.m_currentQuestion = this.g_formData.dataArray.length-1 this.m_currentQuestion = this.g_formData.dataArray.length-1
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
setTimeout(() => { this._timeoutIds.push(setTimeout(() => {
resolve(false) resolve(false)
}, 20); }, 20));
}); });
} else if(this.m_currentQuestion <= -1) { } else if(this.m_currentQuestion <= -1) {
this.m_currentQuestion = 0; this.m_currentQuestion = 0;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
setTimeout(() => { this._timeoutIds.push(setTimeout(() => {
resolve(false) resolve(false)
}, 20); }, 20));
}); });
} }
...@@ -720,4 +720,16 @@ export default class GameLogic { ...@@ -720,4 +720,16 @@ export default class GameLogic {
console.log(`Click enabled! [${eventName}]`) console.log(`Click enabled! [${eventName}]`)
} }
_timeoutIds = []
_intervalIds = []
destroy() {
this.g_cartoon.destroy();
this._timeoutIds.forEach(id => {
clearTimeout(id);
});
this._intervalIds.forEach(id => {
clearInterval(id);
});
}
} }
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