mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Allow muting sounds and music
This commit is contained in:
@@ -53,6 +53,12 @@ export class HUDGameMenu extends BaseHUDPart {
|
||||
this.musicButton = makeDiv(menuButtons, null, ["button", "music"]);
|
||||
this.sfxButton = makeDiv(menuButtons, null, ["button", "sfx"]);
|
||||
this.settingsButton = makeDiv(menuButtons, null, ["button", "settings"]);
|
||||
|
||||
this.trackClicks(this.musicButton, this.toggleMusic);
|
||||
this.trackClicks(this.sfxButton, this.toggleSfx);
|
||||
|
||||
this.musicButton.classList.toggle("muted", this.root.app.settings.getAllSettings().musicMuted);
|
||||
this.sfxButton.classList.toggle("muted", this.root.app.settings.getAllSettings().musicMuted);
|
||||
}
|
||||
|
||||
update() {
|
||||
@@ -68,4 +74,17 @@ export class HUDGameMenu extends BaseHUDPart {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
toggleMusic() {
|
||||
const newValue = !this.root.app.settings.getAllSettings().musicMuted;
|
||||
this.root.app.settings.updateSetting("musicMuted", newValue);
|
||||
|
||||
this.musicButton.classList.toggle("muted", newValue);
|
||||
}
|
||||
|
||||
toggleSfx() {
|
||||
const newValue = !this.root.app.settings.getAllSettings().soundsMuted;
|
||||
this.root.app.settings.updateSetting("soundsMuted", newValue);
|
||||
this.sfxButton.classList.toggle("muted", newValue);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user