Commit 6c49b45a authored by 李维's avatar 李维

修改随机的泡泡数

parent 8c881d66
...@@ -83,7 +83,12 @@ cc.Class({ ...@@ -83,7 +83,12 @@ cc.Class({
getData((data) => { getData((data) => {
console.log('data:', data); console.log('data:', data);
this.data = this.translateData(data.rows) || this.getDefaultData(); if(data.rows) {
this.data = this.translateData(data.rows)
} else {
this.data = this.getDefaultData();
}
this.data = JSON.parse(JSON.stringify(this.data)); this.data = JSON.parse(JSON.stringify(this.data));
this.preloadItem() this.preloadItem()
this.preloadItem(_=>{ this.preloadItem(_=>{
...@@ -110,6 +115,10 @@ cc.Class({ ...@@ -110,6 +115,10 @@ cc.Class({
}) })
}, },
destroyed() {
this.gameLogic.destroyed && this.gameLogic.destroyed();
},
getData(cb) { getData(cb) {
let data; let data;
...@@ -163,17 +172,17 @@ cc.Class({ ...@@ -163,17 +172,17 @@ cc.Class({
} }
} }
data.forEach((item, index)=>{ data.forEach((item, index)=>{
const errItem = getErrDataItem(data, index, 1); const errItem = getErrDataItem(data, index, 5);
const configItem = { const configItem = {
"correct": [], "correct": [],
"incorrect": [], "incorrect": [],
"audio_url1": item.audio_url "audio_url1": item.audio_cn_url
} }
configItem.correct.push({ configItem.correct.push({
"type": "Text", "type": "Text",
"text": item.text_en, "text": item.text_en,
"audio_url": item.audio_url, "audio_url": item.audio_cn_url,
"image_url": "" "image_url": ""
}) })
...@@ -181,7 +190,7 @@ cc.Class({ ...@@ -181,7 +190,7 @@ cc.Class({
configItem.incorrect.push({ configItem.incorrect.push({
"type": "Text", "type": "Text",
"text": eItem.text_en, "text": eItem.text_en,
"audio_url": eItem.audio_url, "audio_url": eItem.audio_cn_url,
"image_url": "" "image_url": ""
}) })
}) })
......
...@@ -16,6 +16,7 @@ export default class GameLogic { ...@@ -16,6 +16,7 @@ export default class GameLogic {
g_audioResList = []; g_audioResList = [];
g_animaResList = []; g_animaResList = [];
g_properties = {}; g_properties = {};
g_timeoutIds = [];
m_bubblesAll = []; m_bubblesAll = [];
m_currentQuestion = -1; m_currentQuestion = -1;
...@@ -26,6 +27,7 @@ export default class GameLogic { ...@@ -26,6 +27,7 @@ export default class GameLogic {
m_isPlayingAudio = false; m_isPlayingAudio = false;
m_sysIntervalId = null; m_sysIntervalId = null;
constructor(formData, systemOption) { constructor(formData, systemOption) {
this.g_systemOption = systemOption; this.g_systemOption = systemOption;
this.g_imageResList = this.g_systemOption.imageResList; this.g_imageResList = this.g_systemOption.imageResList;
...@@ -151,9 +153,9 @@ export default class GameLogic { ...@@ -151,9 +153,9 @@ export default class GameLogic {
let a = btn_lion.node.getComponent(dragonBones.ArmatureDisplay) let a = btn_lion.node.getComponent(dragonBones.ArmatureDisplay)
a.playAnimation(aniName, 1); a.playAnimation(aniName, 1);
setTimeout(() => { this.g_timeoutIds.push(setTimeout(() => {
a.playAnimation(aniName, -1); a.playAnimation(aniName, -1);
}, 3200); }, 3200))
} }
...@@ -569,10 +571,10 @@ export default class GameLogic { ...@@ -569,10 +571,10 @@ export default class GameLogic {
this.m_bubblesAll = this.save; this.m_bubblesAll = this.save;
return new Promise((resolve, reject)=>{ return new Promise((resolve, reject)=>{
setTimeout(() => { this.g_timeoutIds.push(setTimeout(() => {
resolve(); resolve();
this.enableClick("DestroyBubbles") this.enableClick("DestroyBubbles")
}, 1100); }, 1100));
}) })
} }
...@@ -614,12 +616,12 @@ export default class GameLogic { ...@@ -614,12 +616,12 @@ export default class GameLogic {
bubble.move.vX = vArr[count%4].vX bubble.move.vX = vArr[count%4].vX
bubble.move.vY = vArr[count%4].vY bubble.move.vY = vArr[count%4].vY
count++; count++;
setTimeout(() => { this.g_timeoutIds.push(setTimeout(() => {
this.g_cartoon.playAudio("出现") this.g_cartoon.playAudio("出现")
this.g_cartoon.tweenChange(bubble.node, {scale: this.m_maxScale, x: bubble.move.x, y: bubble.move.y}, 3, _=>{ this.g_cartoon.tweenChange(bubble.node, {scale: this.m_maxScale, x: bubble.move.x, y: bubble.move.y}, 3, _=>{
resolve() resolve()
}) })
}, 200 * index); }, 200 * index));
}) })
pAll.push(_p) pAll.push(_p)
} }
...@@ -683,9 +685,9 @@ export default class GameLogic { ...@@ -683,9 +685,9 @@ export default class GameLogic {
asyncDelay(time) { asyncDelay(time) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
setTimeout(() => { this.g_timeoutIds.push(setTimeout(() => {
resolve(); resolve();
}, time * 1000); }, time * 1000));
}) })
} }
...@@ -744,7 +746,9 @@ export default class GameLogic { ...@@ -744,7 +746,9 @@ export default class GameLogic {
}); });
} }
destroyed() {
console.log("DES")
}
......
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