41 lines
818 B
JavaScript
41 lines
818 B
JavaScript
class AudioManager {
|
|
constructor(openBgm, slotBgm, csBgm, baoXiangBgm) {
|
|
this.openBgm = openBgm;
|
|
this.slotBgm = slotBgm;
|
|
this.csBgm = csBgm;
|
|
this.baoXiangBgm = baoXiangBgm;
|
|
}
|
|
stop() {
|
|
this.baoXiangBgm.stop();
|
|
this.csBgm.stop();
|
|
this.slotBgm.stop();
|
|
this.openBgm.stop();
|
|
}
|
|
|
|
playOpenBgm() {
|
|
this.stop();
|
|
this.openBgm.seek(0);
|
|
this.openBgm.play();
|
|
}
|
|
|
|
playSlotBgm() {
|
|
this.stop();
|
|
this.slotBgm.seek(0);
|
|
this.slotBgm.play();
|
|
}
|
|
|
|
playCsBgm() {
|
|
this.stop();
|
|
this.csBgm.seek(0);
|
|
this.csBgm.play();
|
|
}
|
|
|
|
playBaoXiangBgm() {
|
|
this.stop();
|
|
this.baoXiangBgm.seek(0);
|
|
this.baoXiangBgm.play();
|
|
}
|
|
}
|
|
|
|
export default AudioManager;
|