summaryrefslogtreecommitdiff
path: root/Scenes/UI/Menu.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2023-12-28 09:07:41 +0100
committerDaniel Weipert <git@mail.dweipert.de>2023-12-28 09:07:41 +0100
commit96d36cee33d6321834565f0a5d412ef95c5ceffd (patch)
tree0dec02c5915cc154d48eef6ac9c2cd0be7df7982 /Scenes/UI/Menu.gd
parent46556d864b9685c3b09a0038f5de83966fe7ff94 (diff)
next commitHEADmain
Diffstat (limited to 'Scenes/UI/Menu.gd')
-rw-r--r--Scenes/UI/Menu.gd27
1 files changed, 27 insertions, 0 deletions
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()