From 96d36cee33d6321834565f0a5d412ef95c5ceffd Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Thu, 28 Dec 2023 09:07:41 +0100 Subject: next commit --- Scenes/UI/Menu.gd | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'Scenes/UI/Menu.gd') diff --git a/Scenes/UI/Menu.gd b/Scenes/UI/Menu.gd index b482342..ec6ca49 100644 --- a/Scenes/UI/Menu.gd +++ b/Scenes/UI/Menu.gd @@ -1,8 +1,14 @@ extends TabContainer +@onready var audio_bus = AudioServer.get_bus_index("Master") + + func _ready(): hide() + + self._ready_bombs() + self._ready_system() func _input(_event: InputEvent): @@ -37,6 +43,12 @@ func get_player(): ### Bombs ### +func _ready_bombs(): + for component in Bomb.COMPONENT_TYPE: + var idx = Bomb.COMPONENT_TYPE[component] + $Bombs/Panel/HBoxContainer/VBoxContainer3/BombComponents.set_item_text(idx, component.capitalize()) + + func _on_button_bomb_normal_pressed(): self.get_player().Bomb = preload("res://Scenes/Entities/Bombs/Bomb__Normal.tscn") @@ -50,9 +62,24 @@ func _on_bomb_power_item_selected(index): self.get_player().bomb_power = power +func _on_bomb_components_multi_selected(_index, _selected): + Global.player.bomb_components = [] + for idx in $Bombs/Panel/HBoxContainer/VBoxContainer3/BombComponents.get_selected_items(): + Global.player.bomb_components.append(idx) # same as enum idx + + ### System ### +func _ready_system(): + AudioServer.set_bus_volume_db(self.audio_bus, linear_to_db(0)) + $System/Panel/VBoxContainer2/SliderVolume.value = db_to_linear(AudioServer.get_bus_volume_db(self.audio_bus)) + + +func _on_slider_volume_value_changed(value): + AudioServer.set_bus_volume_db(self.audio_bus, linear_to_db(value)) + + func quit_game(): get_tree().quit() -- cgit v1.2.3