37 lines
1.0 KiB
GDScript
37 lines
1.0 KiB
GDScript
extends Control
|
|
@onready var texture_rect: TextureRect = $Control/TextureRect
|
|
|
|
@export var nodearr : Array[Node]
|
|
signal Onclick(State)
|
|
var SelectNode = null:
|
|
set(value):
|
|
if value != SelectNode:
|
|
var tween = create_tween()
|
|
tween.parallel().tween_property(texture_rect, "global_position", value.global_position, 0.2).set_ease(Tween.EASE_OUT)
|
|
tween.tween_property(texture_rect, "scale",Vector2(0.5,0.5) , 0.05)
|
|
tween.tween_property(texture_rect, "scale",Vector2(1,1) ,0.1)
|
|
if SelectNode != null:
|
|
SelectNode.IsSelect = false
|
|
SelectNode = value
|
|
if SelectNode != null:
|
|
SelectNode.IsSelect = true
|
|
|
|
var OnClickIsCooling = false:
|
|
set(value):
|
|
OnClickIsCooling = value
|
|
await get_tree().create_timer(0.2).timeout
|
|
OnClickIsCooling = false
|
|
|
|
|
|
func _ready() -> void:
|
|
await get_tree().create_timer(0.1).timeout
|
|
SelectNode = %Home
|
|
for node : BaseControl in nodearr:
|
|
node.on_click.connect(func(_node):
|
|
if !OnClickIsCooling:
|
|
SelectNode = _node
|
|
OnClickIsCooling = true
|
|
Onclick.emit(_node.name)
|
|
)
|
|
pass # Replace with function body.
|