mirror of
https://github.com/JohnBreaux/Boat-Battle.git
synced 2025-02-04 12:28:35 +00:00
Radical debug menu overhaul + Options overhaul
This commit is contained in:
@@ -1,10 +1,33 @@
|
||||
extends Control
|
||||
|
||||
onready var sound_slider = find_node("SFX Slider", true, true)
|
||||
onready var music_slider = find_node("Volume Slider", true, true)
|
||||
onready var theme_buttons = find_node("Buttons", true, true).get_children()
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
find_next_valid_focus().grab_focus()
|
||||
sound_slider.value = OptionsController.get_sfx_volume()
|
||||
music_slider.value = OptionsController.get_mus_volume()
|
||||
|
||||
|
||||
func _on_Button_pressed():
|
||||
queue_free()
|
||||
MessageBus.emit_signal("change_scene", "Title")
|
||||
|
||||
|
||||
func _on_SFX_Slider_value_changed(value):
|
||||
OptionsController.set_sfx_vol(value)
|
||||
|
||||
|
||||
func _on_Volume_Slider_value_changed(value):
|
||||
OptionsController.set_mus_vol(value)
|
||||
|
||||
|
||||
func _on_Light_pressed():
|
||||
OptionsController.set_theme("light")
|
||||
|
||||
|
||||
func _on_Dark_pressed():
|
||||
OptionsController.set_theme("dark")
|
||||
|
||||
36
godot_ship/script/options/OptionsController.gd
Normal file
36
godot_ship/script/options/OptionsController.gd
Normal file
@@ -0,0 +1,36 @@
|
||||
extends Node
|
||||
|
||||
# signals
|
||||
# Subscribe to these if you want to be notified about changes to the volume
|
||||
signal change_theme (theme)
|
||||
signal change_mus_volume (volume)
|
||||
signal change_sfx_volume (volume)
|
||||
|
||||
# Option variables
|
||||
var theme = "dark"
|
||||
var mus_vol = 100
|
||||
var sfx_vol = 100
|
||||
|
||||
func _ready():
|
||||
pass
|
||||
|
||||
# Setters
|
||||
func set_theme(theme_name):
|
||||
match theme_name:
|
||||
"dark","light":
|
||||
theme = String(theme_name)
|
||||
emit_signal("change_theme", theme)
|
||||
func set_mus_vol(volume):
|
||||
mus_vol = volume
|
||||
emit_signal("change_mus_volume", mus_vol)
|
||||
func set_sfx_vol(volume):
|
||||
sfx_vol = volume
|
||||
emit_signal("change_sfx_volume", sfx_vol)
|
||||
|
||||
# Getters
|
||||
func get_theme():
|
||||
return theme
|
||||
func get_mus_volume():
|
||||
return mus_vol
|
||||
func get_sfx_volume():
|
||||
return sfx_vol
|
||||
Reference in New Issue
Block a user