diff --git a/UI/menu.gd b/UI/menu.gd index 1d183e2..57636c6 100644 --- a/UI/menu.gd +++ b/UI/menu.gd @@ -27,6 +27,9 @@ func set_last_save_info(): func _ready() -> void: set_last_save_info() $AudioStreamPlayer.play() + AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), 0) + AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Music"), 0) + AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Fx"), 0) func _on_button_pressed() -> void: emit_signal("start") @@ -46,3 +49,13 @@ func _on_load_pressed() -> void: func _on_timer_timeout() -> void: $MarginContainer/Panel/VBoxContainer/info.text="" + + +func _on_volume_slider_value_changed(value: float) -> void: + AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), value) + +func _on_musique_slider_value_changed(value: float) -> void: + AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Music"), value) + +func _on_fx_slider_value_changed(value: float) -> void: + AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Fx"), value) diff --git a/UI/menu.tscn b/UI/menu.tscn index a904adf..b4bb192 100644 --- a/UI/menu.tscn +++ b/UI/menu.tscn @@ -87,12 +87,76 @@ vertical_alignment = 3 wait_time = 5.0 one_shot = true +[node name="VBoxContainer2" type="VBoxContainer" parent="MarginContainer/Panel"] +layout_mode = 0 +offset_left = 100.0 +offset_top = 681.0 +offset_right = 1841.0 +offset_bottom = 1011.0 + +[node name="Label" type="Label" parent="MarginContainer/Panel/VBoxContainer2"] +layout_mode = 2 +theme = ExtResource("3_feq31") +text = "Options" +horizontal_alignment = 1 + +[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/Panel/VBoxContainer2"] +layout_mode = 2 + +[node name="Label2" type="Label" parent="MarginContainer/Panel/VBoxContainer2/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "volume " + +[node name="HSlider" type="HSlider" parent="MarginContainer/Panel/VBoxContainer2/HBoxContainer"] +custom_minimum_size = Vector2(1580, 0) +layout_mode = 2 +min_value = -80.0 +max_value = 6.0 +tick_count = 5 + +[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/Panel/VBoxContainer2"] +layout_mode = 2 + +[node name="Label2" type="Label" parent="MarginContainer/Panel/VBoxContainer2/HBoxContainer2"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Musique +" + +[node name="HSlider" type="HSlider" parent="MarginContainer/Panel/VBoxContainer2/HBoxContainer2"] +custom_minimum_size = Vector2(1580, 0) +layout_mode = 2 +min_value = -80.0 +max_value = 6.0 +tick_count = 5 + +[node name="HBoxContainer3" type="HBoxContainer" parent="MarginContainer/Panel/VBoxContainer2"] +layout_mode = 2 + +[node name="Label2" type="Label" parent="MarginContainer/Panel/VBoxContainer2/HBoxContainer3"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "FX +" + +[node name="HSlider" type="HSlider" parent="MarginContainer/Panel/VBoxContainer2/HBoxContainer3"] +custom_minimum_size = Vector2(1580, 0) +layout_mode = 2 +min_value = -80.0 +max_value = 6.0 +tick_count = 5 + [node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] stream = ExtResource("4_0n4j1") volume_db = -14.596 autoplay = true +bus = &"Music" [connection signal="pressed" from="MarginContainer/Panel/VBoxContainer/Start" to="." method="_on_button_pressed"] [connection signal="pressed" from="MarginContainer/Panel/VBoxContainer/Load" to="." method="_on_load_pressed"] [connection signal="pressed" from="MarginContainer/Panel/VBoxContainer/Save" to="." method="_on_save_pressed"] [connection signal="timeout" from="MarginContainer/Panel/VBoxContainer/info/Timer" to="." method="_on_timer_timeout"] +[connection signal="value_changed" from="MarginContainer/Panel/VBoxContainer2/HBoxContainer/HSlider" to="." method="_on_volume_slider_value_changed"] +[connection signal="value_changed" from="MarginContainer/Panel/VBoxContainer2/HBoxContainer2/HSlider" to="." method="_on_musique_slider_value_changed"] +[connection signal="value_changed" from="MarginContainer/Panel/VBoxContainer2/HBoxContainer3/HSlider" to="." method="_on_fx_slider_value_changed"] diff --git a/default_bus_layout.tres b/default_bus_layout.tres index 21cb17d..0030008 100644 --- a/default_bus_layout.tres +++ b/default_bus_layout.tres @@ -7,6 +7,7 @@ damping = 0.07 spread = 0.35 [resource] +bus/0/volume_db = -80.0 bus/1/name = &"Music" bus/1/solo = false bus/1/mute = false