47 lines
1.2 KiB
GDScript3
47 lines
1.2 KiB
GDScript3
|
extends Control
|
||
|
|
||
|
|
||
|
# Declare member variables here. Examples:
|
||
|
# var a = 2
|
||
|
# var b = "text"
|
||
|
signal volume_changed(slider,value)
|
||
|
var count = 0
|
||
|
var sliders = []
|
||
|
var values = []
|
||
|
|
||
|
# Called when the node enters the scene tree for the first time.
|
||
|
func _ready():
|
||
|
pass # Replace with function body.
|
||
|
|
||
|
func set_count(value):
|
||
|
for slice in $HBoxContainer.get_children():
|
||
|
slice.remove_and_skip()
|
||
|
sliders = []
|
||
|
for i in range(0,value):
|
||
|
if len(values) < value+1:
|
||
|
values.append(50)
|
||
|
var slice = VBoxContainer.new()
|
||
|
var slider = VSlider.new()
|
||
|
slider.hint_tooltip = "Vocal mix "+String(i+1)
|
||
|
slider.size_flags_vertical = SIZE_EXPAND_FILL
|
||
|
slider.value = values[i]
|
||
|
slider.connect("value_changed",self,"on_value_changed")
|
||
|
slice.add_child(slider)
|
||
|
sliders.append(slider)
|
||
|
var label = Label.new()
|
||
|
label.text = String(i+1)
|
||
|
label.hint_tooltip = "Vocal mix "+String(i+1)
|
||
|
label.mouse_filter = Control.MOUSE_FILTER_STOP
|
||
|
slice.add_child(label)
|
||
|
$HBoxContainer.add_child(slice)
|
||
|
|
||
|
func on_value_changed(value):
|
||
|
for i in range(0,len(sliders)):
|
||
|
if values[i] != sliders[i].value:
|
||
|
values[i] = sliders[i].value
|
||
|
emit_signal("volume_changed",0,sliders[0].value)
|
||
|
|
||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||
|
#func _process(delta):
|
||
|
# pass
|