修复音乐播放bug

This commit is contained in:
unanmed 2023-06-21 17:40:25 +08:00
parent 3604c7550f
commit 85f9a9fd07
2 changed files with 4 additions and 3 deletions

View File

@ -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();

View File

@ -63,6 +63,7 @@ export class BgmController extends ResourceController<HTMLAudioElement> {
if (has(this.playing) || !this.lastBgm) return;
const bgm = this.get(this.lastBgm);
bgm.play();
this.playing = this.lastBgm;
}
get(id: BgmIds) {