2020-03-21 09:10:26 +00:00
|
|
|
tool
|
|
|
|
extends HBoxContainer
|
|
|
|
|
|
|
|
signal changed
|
|
|
|
signal value_changed( value )
|
|
|
|
|
|
|
|
export( Texture ) var minus_texture setget set_minus_texture, get_minus_texture
|
|
|
|
func set_minus_texture( value ):
|
2021-01-21 21:03:44 +00:00
|
|
|
minus_texture = value
|
|
|
|
if self.has_node( "kh_h_slider/minus" ):
|
|
|
|
$kh_h_slider/minus.texture_normal = minus_texture
|
2020-03-21 09:10:26 +00:00
|
|
|
func get_minus_texture():
|
2021-01-21 21:03:44 +00:00
|
|
|
return minus_texture
|
|
|
|
|
2020-03-21 09:10:26 +00:00
|
|
|
export( Texture ) var plus_texture setget set_plus_texture, get_plus_texture
|
|
|
|
func set_plus_texture( value ):
|
2021-01-21 21:03:44 +00:00
|
|
|
plus_texture = value
|
|
|
|
if self.has_node( "kh_h_slider/plus" ):
|
|
|
|
$kh_h_slider/plus.texture_normal = plus_texture
|
2020-03-21 09:10:26 +00:00
|
|
|
func get_plus_texture():
|
2021-01-21 21:03:44 +00:00
|
|
|
return plus_texture
|
2020-03-21 09:10:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _ready():
|
2021-01-21 21:03:44 +00:00
|
|
|
self.add_child( preload( "res://addons/kh_slider/kh_h_slider.tscn" ).instance() )
|
|
|
|
|
|
|
|
$kh_h_slider/minus.connect( "pressed", self, "_on_minus_pressed" )
|
|
|
|
$kh_h_slider/value.connect( "changed", self, "_on_value_changed" )
|
|
|
|
$kh_h_slider/value.connect( "value_changed", self, "_on_value_value_changed" )
|
|
|
|
$kh_h_slider/plus.connect( "pressed", self, "_on_plus_pressed" )
|
|
|
|
$kh_h_slider/minus.texture_normal = minus_texture
|
|
|
|
$kh_h_slider/plus.texture_normal = plus_texture
|
|
|
|
|
2020-03-21 09:10:26 +00:00
|
|
|
func _on_minus_pressed():
|
2021-01-21 21:03:44 +00:00
|
|
|
$kh_h_slider/value.value -= $kh_h_slider/value.step
|
|
|
|
|
2020-03-21 09:10:26 +00:00
|
|
|
func _on_plus_pressed():
|
2021-01-21 21:03:44 +00:00
|
|
|
$kh_h_slider/value.value += $kh_h_slider/value.step
|
|
|
|
|
2020-03-21 09:10:26 +00:00
|
|
|
func _on_value_changed():
|
2021-01-21 21:03:44 +00:00
|
|
|
emit_signal( "changed" )
|
|
|
|
|
2020-03-21 09:10:26 +00:00
|
|
|
|
|
|
|
func _on_value_value_changed( value ):
|
2021-01-21 21:03:44 +00:00
|
|
|
emit_signal( "value_changed", value )
|