extends TextureRect signal clicked @export var key: String = "production" @export var text: String = "Resource" @export var width: float = 66 @onready var rich_text_label: RichTextLabel = $RichTextLabel @onready var collision_shape_2d: CollisionShape2D = $MouseHandler/CollisionShape2D func _ready() -> void: rich_text_label.text = "[center]%s" % [text] custom_minimum_size.x = width collision_shape_2d.shape = RectangleShape2D.new() collision_shape_2d.shape.size = Vector2(width - 20, 10) collision_shape_2d.position.x = 33 - ((66 - width) / 2) func _on_mouse_handler_clicked() -> void: clicked.emit() func select(): rich_text_label.self_modulate = Color(1, 1, 1, 1) self_modulate = Color(1, 1, 1, 0.4) func unselect(): rich_text_label.self_modulate = Color(1, 1, 1, 0.4) self_modulate = Color(1, 1, 1, 0.1)