extends MarginContainer @export var item1:String="default1" @export var item2:String="default_2" #移动背景 @onready var texture_rect: TextureRect = $Control/TextureRect #需要连接信号的节点数组 @export var nodearr : Array[Node] signal Onclick(State:int) 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.parallel().tween_property(texture_rect,"size",value.size,0.2).set_ease(Tween.EASE_OUT) SelectNode = value var OnClickIsCooling = false: set(value): OnClickIsCooling = value await get_tree().create_timer(0.2).timeout OnClickIsCooling = false func _ready() -> void: $HBoxContainer/Item1/item_name.text=item1 $HBoxContainer/Item2/item_name.text=item2 await get_tree().create_timer(0.1).timeout SelectNode = %Item1 for node : BaseControl in nodearr: node.on_click.connect(func(_node): if !OnClickIsCooling: SelectNode = _node OnClickIsCooling = true Onclick.emit(_node.get_child(0).get_index()) ) pass # Replace with function body.