修改样板播放bgm的逻辑

This commit is contained in:
AncTe committed 2023-06-21 17:28:19 +08:00
1 parent 48a0752f9c
commit 3604c7550f
4 files changed
+13 -107

No files matched your search

+9 -4
View File
@@ -25,10 +25,15 @@ export class BgmController extends ResourceController<HTMLAudioElement> {
play(id: BgmIds, when: number = 0) {
if (this.playing === id) return;
this.pause();
const bgm = this.get(id);
bgm.currentTime = when;
bgm.play();
this.playing = id;
if (core.musicStatus.bgmStatus) {
const bgm = this.get(id);
bgm.currentTime = when;
bgm.volume = core.musicStatus.userVolume;
bgm.play();
this.playing = id;
} else {
delete this.playing;
}
this.lastBgm = id;
}