61 lines
1.6 KiB
GDScript3
61 lines
1.6 KiB
GDScript3
|
extends Control
|
||
|
|
||
|
|
||
|
# Declare member variables here. Examples:
|
||
|
# var a = 2
|
||
|
# var b = "text"
|
||
|
onready var MouseSensSlider = $MouseSensSlider
|
||
|
onready var SFXVol = $SFXSlider
|
||
|
onready var MusicVol = $MusicSlider
|
||
|
onready var MasterVol = $MasterVolSlider
|
||
|
|
||
|
|
||
|
onready var SFXBusName := "SFX"
|
||
|
onready var MusicBusName := "Music"
|
||
|
onready var MasterBusName := "Master"
|
||
|
|
||
|
onready var SFXBus := AudioServer.get_bus_index(SFXBusName)
|
||
|
onready var MusicBus := AudioServer.get_bus_index(MusicBusName)
|
||
|
onready var MasterBus := AudioServer.get_bus_index(MasterBusName)
|
||
|
|
||
|
|
||
|
|
||
|
# Called when the node enters the scene tree for the first time.
|
||
|
func _ready():
|
||
|
MouseSensSlider.value = get_node("/root/Spatial/Player").mouse_sensitivity
|
||
|
SFXVol.value = db2linear(AudioServer.get_bus_volume_db(SFXBus))
|
||
|
MusicVol.value = db2linear(AudioServer.get_bus_volume_db(MusicBus))
|
||
|
MasterVol.value = db2linear(AudioServer.get_bus_volume_db(MasterBus))
|
||
|
|
||
|
|
||
|
func _on_MouseSensSlider_value_changed(value):
|
||
|
get_node("/root/Spatial/Player").mouse_sensitivity = value
|
||
|
|
||
|
|
||
|
func _on_SFXSlider_value_changed(value):
|
||
|
AudioServer.set_bus_volume_db(SFXBus, linear2db(value))
|
||
|
|
||
|
|
||
|
func _on_MusicSlider_value_changed(value):
|
||
|
AudioServer.set_bus_volume_db(MusicBus, linear2db(value))
|
||
|
|
||
|
|
||
|
func _on_MasterVolSlider_value_changed(value):
|
||
|
AudioServer.set_bus_volume_db(MasterBus, linear2db(value))
|
||
|
|
||
|
|
||
|
func _on_MouseSensSlider_mouse_exited():
|
||
|
pass#MouseSensSlider.release_focus()
|
||
|
|
||
|
|
||
|
func _on_SFXSlider_mouse_exited():
|
||
|
pass#SFXVol.release_focus()
|
||
|
|
||
|
|
||
|
func _on_MusicSlider_mouse_exited():
|
||
|
pass#MusicVol.release_focus()
|
||
|
|
||
|
|
||
|
func _on_MasterVolSlider_mouse_exited():
|
||
|
pass#MasterVol.release_focus()
|