Commit 5f3f4903 authored by asdf's avatar asdf

播放音乐和移动的时候也可以切换至下一页

parent 35db1014
...@@ -37,7 +37,6 @@ cc.Class({ ...@@ -37,7 +37,6 @@ cc.Class({
initSceneData() { initSceneData() {
this._resList = []; this._resList = [];
window.GameData = {}; window.GameData = {};
GameData.audioCount = 0;
}, },
_designSize: null, // 设计分辨率 _designSize: null, // 设计分辨率
...@@ -121,6 +120,8 @@ cc.Class({ ...@@ -121,6 +120,8 @@ cc.Class({
initData() { initData() {
// 所有全局变量 默认都是null // 所有全局变量 默认都是null
GameData.audioCount = 0;
let optionList = this.data.questionList[GameData.questionIndex].optionList; let optionList = this.data.questionList[GameData.questionIndex].optionList;
this.optionList = []; this.optionList = [];
for (let i = 0; i < optionList.length; i++) { for (let i = 0; i < optionList.length; i++) {
...@@ -297,40 +298,25 @@ cc.Class({ ...@@ -297,40 +298,25 @@ cc.Class({
}, },
onTurnLast() { onTurnLast() {
if (GameData.isMoving) {
return;
}
if (GameData.audioCount != 0) {
return;
}
GameData.questionIndex--;
this.nodeDict.nodAnswerParent.destroyAllChildren(); this.nodeDict.nodAnswerParent.destroyAllChildren();
this.nodeDict.nodQuestionParent.destroyAllChildren(); this.nodeDict.nodQuestionParent.destroyAllChildren();
cc.audioEngine.stopAll();
GameData.questionIndex--;
this.initData(); this.initData();
this.playAudioQuestion(); this.playAudioQuestion();
}, },
onReplay() { onReplay() {
if (GameData.isMoving) {
return;
}
if (GameData.audioCount != 0) {
return;
}
this.nodeDict.nodAnswerParent.destroyAllChildren(); this.nodeDict.nodAnswerParent.destroyAllChildren();
this.nodeDict.nodQuestionParent.destroyAllChildren(); this.nodeDict.nodQuestionParent.destroyAllChildren();
cc.audioEngine.stopAll();
this.initData(); this.initData();
this.startGame(); this.startGame();
}, },
onTurnNext() { onTurnNext() {
if (GameData.isMoving) {
return;
}
if (GameData.audioCount != 0) {
return;
}
GameData.questionIndex++;
this.nodeDict.nodAnswerParent.destroyAllChildren(); this.nodeDict.nodAnswerParent.destroyAllChildren();
this.nodeDict.nodQuestionParent.destroyAllChildren(); this.nodeDict.nodQuestionParent.destroyAllChildren();
cc.audioEngine.stopAll();
GameData.questionIndex++;
this.initData(); this.initData();
this.startGame(); this.startGame();
}, },
......
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