按钮闪烁
This commit is contained in:
parent
9bac26b7db
commit
3ea7f0eeb9
@ -30,7 +30,7 @@ func _ready() -> void:
|
||||
if !OnClickIsCooling:
|
||||
SelectNode = _node
|
||||
OnClickIsCooling = true
|
||||
Onclick.emit(_node.index)
|
||||
Onclick.emit(_node.get_index())
|
||||
)
|
||||
pass # Replace with function body.
|
||||
|
||||
|
@ -110,7 +110,6 @@ script = ExtResource("10_jyc6b")
|
||||
TextureNormal = ExtResource("3_t55mh")
|
||||
TexturePressed = ExtResource("3_r83c5")
|
||||
styleBox = SubResource("StyleBoxTexture_bqmim")
|
||||
is_Scale = true
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Record"]
|
||||
custom_minimum_size = Vector2(74, 74)
|
||||
@ -147,7 +146,6 @@ script = ExtResource("10_jyc6b")
|
||||
TextureNormal = ExtResource("6_q5g71")
|
||||
TexturePressed = ExtResource("7_3wr4h")
|
||||
styleBox = SubResource("StyleBoxTexture_bqmim")
|
||||
is_Scale = true
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Build"]
|
||||
custom_minimum_size = Vector2(74, 74)
|
||||
@ -185,7 +183,6 @@ script = ExtResource("10_jyc6b")
|
||||
TextureNormal = ExtResource("8_0e4lg")
|
||||
TexturePressed = ExtResource("9_gdew3")
|
||||
styleBox = SubResource("StyleBoxTexture_bqmim")
|
||||
is_Scale = true
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Export"]
|
||||
custom_minimum_size = Vector2(74, 74)
|
||||
@ -237,7 +234,6 @@ script = ExtResource("10_jyc6b")
|
||||
TextureNormal = ExtResource("11_px13j")
|
||||
TexturePressed = ExtResource("12_ljpgt")
|
||||
styleBox = SubResource("StyleBoxTexture_bqmim")
|
||||
is_Scale = true
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Download"]
|
||||
custom_minimum_size = Vector2(74, 74)
|
||||
@ -275,7 +271,6 @@ script = ExtResource("10_jyc6b")
|
||||
TextureNormal = ExtResource("13_8lrx3")
|
||||
TexturePressed = ExtResource("15_f66s7")
|
||||
styleBox = SubResource("StyleBoxTexture_bqmim")
|
||||
is_Scale = true
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="HBoxContainer/margin/VBoxContainer/GridContainer/Upload"]
|
||||
custom_minimum_size = Vector2(74, 74)
|
||||
|
@ -2,12 +2,14 @@ extends BaseControl
|
||||
|
||||
@export var TextureNormal :Texture2D
|
||||
@export var TexturePressed : Texture2D
|
||||
|
||||
#用来播放动画的tween
|
||||
var animation_tween
|
||||
|
||||
func _ready() -> void:
|
||||
super._ready()
|
||||
self.button_down.connect(_on_button_down)
|
||||
self.button_up.connect(_on_button_up)
|
||||
self.on_click.connect(_on_click)
|
||||
$TextureRect.texture=TextureNormal
|
||||
self.flat=true
|
||||
|
||||
@ -22,4 +24,34 @@ func _on_button_up() -> void:
|
||||
$TextureRect.texture=TextureNormal
|
||||
pass # Replace with function body.
|
||||
|
||||
var is_selected
|
||||
var is_select:bool:
|
||||
set(value):
|
||||
|
||||
if is_select!=value:
|
||||
if value:
|
||||
if animation_tween!=null:
|
||||
animation_tween.kill()
|
||||
animation_tween=create_tween()
|
||||
animation_tween.tween_callback(set_texture.bind(TexturePressed)).set_delay(0.15)
|
||||
animation_tween.tween_callback(set_texture.bind(TextureNormal)).set_delay(0.15)
|
||||
animation_tween.tween_callback(set_texture.bind(TexturePressed)).set_delay(0.15)
|
||||
animation_tween.tween_callback(set_texture.bind(TextureNormal)).set_delay(0.15)
|
||||
animation_tween.tween_callback(set_texture.bind(TexturePressed)).set_delay(0.15)
|
||||
else:
|
||||
if animation_tween!=null:
|
||||
animation_tween.kill()
|
||||
animation_tween=null
|
||||
set_texture(TextureNormal)
|
||||
pass
|
||||
|
||||
is_select=value
|
||||
|
||||
|
||||
func set_texture(texture:Texture2D):
|
||||
$TextureRect.texture=texture
|
||||
|
||||
func _on_click(node):
|
||||
is_select=not is_select
|
||||
|
||||
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user