diff --git a/public/libs/control.js b/public/libs/control.js index 97a9e66..51bd104 100644 --- a/public/libs/control.js +++ b/public/libs/control.js @@ -3585,19 +3585,19 @@ control.prototype.playBgm = function (bgm, startTime) { ////// 暂停背景音乐的播放 ////// control.prototype.pauseBgm = function () { - if (main.mode != 'play') return; + if (main.mode !== 'play') return; ancTe.bgm.pause(); }; ////// 恢复背景音乐的播放 ////// control.prototype.resumeBgm = function (resumeTime) { - if (main.mode != 'play') return; + if (main.mode !== 'play') return; ancTe.bgm.resume(); }; ////// 更改背景音乐的播放 ////// control.prototype.triggerBgm = function () { - if (main.mode != 'play') return; + if (main.mode !== 'play') return; core.musicStatus.bgmStatus = !core.musicStatus.bgmStatus; if (core.musicStatus.bgmStatus) this.resumeBgm(); diff --git a/src/core/audio/bgm.ts b/src/core/audio/bgm.ts index 3ff50c3..89aab92 100644 --- a/src/core/audio/bgm.ts +++ b/src/core/audio/bgm.ts @@ -63,6 +63,7 @@ export class BgmController extends ResourceController { if (has(this.playing) || !this.lastBgm) return; const bgm = this.get(this.lastBgm); bgm.play(); + this.playing = this.lastBgm; } get(id: BgmIds) {