Commit 2f1b0248 authored by limingzhe's avatar limingzhe

feat: 增加自动播放

parent c2eb6249
......@@ -630,6 +630,7 @@ cc.Class({
// this.initBg();
// this.initPanel();
// this.initScore();
......@@ -653,6 +654,7 @@ cc.Class({
},
showBackBtn() {
const backBtn = cc.find('Canvas/back_btn');
backBtn.active = true;
......@@ -697,6 +699,7 @@ cc.Class({
this.curQuesIndex--;
this.initCurQues();
this.refreshPage();
this.clickTopAudio(this.topAudioRectNode);
})
arrowR.on('click', () => {
......@@ -713,6 +716,7 @@ cc.Class({
this.curQuesIndex++;
this.initCurQues();
this.refreshPage();
this.clickTopAudio(this.topAudioRectNode);
})
......@@ -8787,6 +8791,7 @@ cc.Class({
rectNode.isClicked = false;
});
})
},
......@@ -9062,6 +9067,7 @@ cc.Class({
// })
},
topAudioRectNode: null,
setAudioAnim(data, bg) {
console.log(' in setAudioAnim')
......@@ -9069,13 +9075,61 @@ cc.Class({
const rectNode = animNode.rectNode;
const key = data.labelArr[1]?.value;
rectNode.top_audio_key = key;
rectNode.anim_node = animNode;
this.topAudioRectNode = rectNode;
rectNode.on("click", () => {
this.clickTopAudio(rectNode);
// if (rectNode.isClicked) {
// return;
// }
// rectNode.isClicked = true;
// const inputData = this.curQues.find(it => {
// return it[key];
// })
// console.log('`inputData: ', inputData);
// if (inputData) {
// this.playAudioAnim(inputData[key], animNode, () => {
// rectNode.isClicked = false;
// });
// } else {
// rectNode.isClicked = false;
// }
})
if (data.anchorGroup != null) {
this.setRectNodeAnchor(data, bg, rectNode);
}
this.audioAnimArr.push(rectNode);
this.labaNode = rectNode;
delayCall(0.5, () => {
this.clickTopAudio(this.topAudioRectNode);
});
},
clickTopAudio(rectNode) {
if (rectNode.isClicked) {
return;
}
rectNode.isClicked = true;
const key = rectNode.top_audio_key
const animNode = rectNode.anim_node;
const inputData = this.curQues.find(it => {
return it[key];
})
......@@ -9088,20 +9142,9 @@ cc.Class({
} else {
rectNode.isClicked = false;
}
})
if (data.anchorGroup != null) {
this.setRectNodeAnchor(data, bg, rectNode);
}
this.audioAnimArr.push(rectNode);
this.labaNode = rectNode;
},
setTextOption(data, bg) {
const rectNode = this.setOneRect(data, bg, cc.Color.BLUE);
......@@ -9825,6 +9868,8 @@ cc.Class({
},
refreshPage() {
this.refreshInputText();
this.refreshInputPic();
this.refreshArrowBtn();
......@@ -9859,6 +9904,7 @@ cc.Class({
node.active = false;
} else {
node.active = true;
this.topAudioRectNode = node;
}
} else {
node.active = false;
......
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