Commit 44d15aaf authored by yu's avatar yu

1

parent eccee385
...@@ -92,6 +92,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -92,6 +92,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this._results[idx].push(null); this._results[idx].push(null);
}); });
}); });
this.isPlayBgAudio = true;
} }
private stopQuestionAudio() { private stopQuestionAudio() {
...@@ -160,9 +161,12 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -160,9 +161,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
play.active = false; play.active = false;
stop.active = true; stop.active = true;
pg.audio.stopAudio(this.itemAudio);
element.getComponent(Item).playing(); element.getComponent(Item).playing();
this.playAudioByUrl(quest.audio, () => { pg.audio.playAudioByUrl(quest.audio, () => {
element.getComponent(Item).stop(); element.getComponent(Item).stop();
}).then((audioId: number) => {
this.itemAudio = audioId;
}); });
}); });
...@@ -237,6 +241,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -237,6 +241,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
record_start.on('click', () => { record_start.on('click', () => {
this.playLocalAudio('btn'); this.playLocalAudio('btn');
this.stopBgAudio();
mask.active = true; mask.active = true;
// icon_record.getComponent(dragonBones.ArmatureDisplay).timeScale = 1; // icon_record.getComponent(dragonBones.ArmatureDisplay).timeScale = 1;
...@@ -319,6 +324,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -319,6 +324,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.log('idx:' + idx); this.log('idx:' + idx);
if (window['courseware']) { if (window['courseware']) {
this.playBgAudio();
window['courseware'].stopTest((res) => { window['courseware'].stopTest((res) => {
this.log('--------录音返回结果 stopTest ------------'); this.log('--------录音返回结果 stopTest ------------');
this.log('res' + res); this.log('res' + res);
...@@ -386,6 +392,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -386,6 +392,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
onHomeworkFinish({ stone: 10, details: this._results }); onHomeworkFinish({ stone: 10, details: this._results });
}); });
} else { } else {
this.playBgAudio();
if (idx !== -1) { if (idx !== -1) {
let content = cc.find("view/content", this.pagContent.children[this.roundIdx]); let content = cc.find("view/content", this.pagContent.children[this.roundIdx]);
content.children[idx].getComponent(Item).recorded(); content.children[idx].getComponent(Item).recorded();
...@@ -397,12 +404,15 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -397,12 +404,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
}); });
this.btn_arrow.on(cc.Node.EventType.TOUCH_END, this.onArrow, this); this.btn_arrow.on(cc.Node.EventType.TOUCH_END, this.onArrow, this);
this.btn_last.on(cc.Node.EventType.TOUCH_END, this.onLast, this); this.btn_last.on(cc.Node.EventType.TOUCH_END, this.onLast, this);
this.btn_audio_off.on(cc.Node.EventType.TOUCH_END, this.onAudioOff, this);
this.btn_audio_on.on(cc.Node.EventType.TOUCH_END, this.onAudioOn, this);
this.setPagBg(); this.setPagBg();
this.refreshArrow(); this.refreshArrow();
if (this.data.bgAudio && this.data.bgAudio != "") { if (this.data.bgAudio && this.data.bgAudio != "") {
this.btn_audio_on.active = true; this.btn_audio_on.active = true;
} }
} }
private itemAudio = -1;
private onAudioOn() { private onAudioOn() {
this.btn_audio_off.active = true; this.btn_audio_off.active = true;
this.btn_audio_on.active = false; this.btn_audio_on.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