Commit 2f1b0248 authored by limingzhe's avatar limingzhe

feat: 增加自动播放

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