Commit d2859736 authored by 范雪寒's avatar 范雪寒

fix: 右下角播放按钮

parent 2bbabd5a
...@@ -52,7 +52,9 @@ export class Game { ...@@ -52,7 +52,9 @@ export class Game {
_currentPlayingAudioName; _currentPlayingAudioName;
_currentPlayingAudioCallback; _currentPlayingAudioCallback;
playAudio(key, now = true, callback = null) { playAudio(key, now = true, callback = null) {
if (key == '') {
return;
}
if (this._currentPlayingAudioName != '') { if (this._currentPlayingAudioName != '') {
const audio = this._parent.audioObj[this._currentPlayingAudioName]; const audio = this._parent.audioObj[this._currentPlayingAudioName];
if (audio) { if (audio) {
......
...@@ -291,10 +291,12 @@ export class MyGame extends Game { ...@@ -291,10 +291,12 @@ export class MyGame extends Game {
totalAudioBtn.y = this._parent.canvasHeight - totalAudioBtn.height; totalAudioBtn.y = this._parent.canvasHeight - totalAudioBtn.height;
totalAudioBtn.addTouchBeganListener(() => { totalAudioBtn.addTouchBeganListener(() => {
jelly(totalAudioBtn); jelly(totalAudioBtn);
if (this.data.totalAudio != '') {
this.playAudio(this.data.totalAudio, true, () => { this.playAudio(this.data.totalAudio, true, () => {
totalAudioBtn.init(this.images.get('btn_play')); totalAudioBtn.init(this.images.get('btn_play'));
}); });
totalAudioBtn.init(this.images.get('btn_pause')); totalAudioBtn.init(this.images.get('btn_pause'));
}
}); });
this.addChild(totalAudioBtn); this.addChild(totalAudioBtn);
} }
......
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