Commit 528f74f4 authored by 李维's avatar 李维

修复部分音频不播放动画的问题

parent 3447ae7f
...@@ -436,9 +436,11 @@ cc.Class({ ...@@ -436,9 +436,11 @@ cc.Class({
let btn_picture = pg.view.find(this, "btn_picture"); let btn_picture = pg.view.find(this, "btn_picture");
// 一局失败弹出tryagain,同时下方录音按钮明亮并出现提示 // 一局失败弹出tryagain,同时下方录音按钮明亮并出现提示
this.setMaoAni("wrong");
this.playSFX("audio_tryagain").then(() => { this.playSFX("audio_tryagain").then(() => {
pg.view.visible(bg_tryagain, false); pg.view.visible(bg_tryagain, false);
pg.view.visible(end, false); pg.view.visible(end, false);
this.setMaoAni("normal");
}) })
pg.view.visible(end, true); pg.view.visible(end, true);
pg.view.visible(bg_tryagain, true); pg.view.visible(bg_tryagain, true);
...@@ -448,9 +450,12 @@ cc.Class({ ...@@ -448,9 +450,12 @@ cc.Class({
this._playing = true; this._playing = true;
this._tryagainCount++; this._tryagainCount++;
this._timeoutIds.push(setTimeout(() => { this._timeoutIds.push(setTimeout(() => {
this.setMaoAni("begin");
if (this._tryagainCount == 1) { if (this._tryagainCount == 1) {
pg.audio.playAudioByUrl(this._tryagain.one).then(() => { pg.audio.playAudioByUrl(this._tryagain.one).then(() => {
this.setMaoAni("normal");
this._playing = false; this._playing = false;
}) })
// this.playSFX("audio_record"); // this.playSFX("audio_record");
...@@ -463,6 +468,7 @@ cc.Class({ ...@@ -463,6 +468,7 @@ cc.Class({
action.start(); action.start();
} else if (this._tryagainCount == 2) { } else if (this._tryagainCount == 2) {
pg.audio.playAudioByUrl(this._tryagain.two).then(() => { pg.audio.playAudioByUrl(this._tryagain.two).then(() => {
this.setMaoAni("normal");
this._playing = false; this._playing = false;
}) })
// this.playSFX("audio_record"); // this.playSFX("audio_record");
...@@ -475,11 +481,12 @@ cc.Class({ ...@@ -475,11 +481,12 @@ cc.Class({
action.start(); action.start();
} else { } else {
pg.audio.playAudioByUrl(this._tryagain.three).then(() => { pg.audio.playAudioByUrl(this._tryagain.three).then(() => {
this.setMaoAni("normal");
this._playing = false; this._playing = false;
this.nextStage(); this.nextStage();
}) })
} }
}, 1000 * 1)); }, 1000 * 2));
}, },
state5Finish() { state5Finish() {
let btn_replay = pg.view.find(this, "btn_replay") let btn_replay = pg.view.find(this, "btn_replay")
...@@ -647,7 +654,9 @@ cc.Class({ ...@@ -647,7 +654,9 @@ cc.Class({
resolve(""); resolve("");
} else { } else {
this._audio_record = true; this._audio_record = true;
this.setMaoAni("begin");
pg.audio.playAudioByUrl(this._cat.record).then(() => { pg.audio.playAudioByUrl(this._cat.record).then(() => {
this.setMaoAni("normal");
this._playing = false; this._playing = false;
resolve(''); resolve('');
}) })
...@@ -869,6 +878,7 @@ cc.Class({ ...@@ -869,6 +878,7 @@ cc.Class({
//按钮触发,使用的方法 //按钮触发,使用的方法
onTouchRecord() { onTouchRecord() {
if (this._playing) { if (this._playing) {
this.setMaoAni("normal")
cc.audioEngine.stopAllEffects(); cc.audioEngine.stopAllEffects();
} }
this.playSFX("audio_btns"); this.playSFX("audio_btns");
......
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