-
Notifications
You must be signed in to change notification settings - Fork 0
/
margin_container_options.gd
32 lines (24 loc) · 1.24 KB
/
margin_container_options.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
extends MarginContainer
func _ready() -> void:
$VBoxContainer/Music.value = GlobalOptions.music_volume
$VBoxContainer/Sound.value = GlobalOptions.sound_volume
# This function is called when the Music slider value changes
func _on_MusicVolumeSlider_value_changed(value):
GlobalOptions.music_volume = value # Update the global music volume
GlobalOptions.apply_volume_settings() # Apply the new volume to all music nodes
# This function is called when the Sound slider value changes
func _on_SoundVolumeSlider_value_changed(value):
GlobalOptions.sound_volume = value # Update the global sound volume
GlobalOptions.apply_volume_settings() # Apply the new volume to all sound nodes
func _on_music_value_changed(value: float) -> void:
_on_MusicVolumeSlider_value_changed(value)
func _on_sound_value_changed(value: float) -> void:
if $".".visible == true:
_on_SoundVolumeSlider_value_changed(value)
$TestPop.play()
func _on_mute_music_toggled(toggled_on: bool) -> void:
GlobalOptions.music_muted = toggled_on
GlobalOptions.apply_volume_settings() # Apply the change immediately
func _on_mute_sounds_toggled(toggled_on: bool) -> void:
GlobalOptions.sound_muted = toggled_on
GlobalOptions.apply_volume_settings() # Apply the change immediately