extends Control class_name CardBase signal left_clicked signal right_clicked signal un_right_clicked signal hovering(delta: float) @export var card_name_label: Label @export var card_desc_label: Label @export var icon_rect: TextureRect var _card: SupportCard var card: SupportCard: get: return _card set(value): _update(value) _card = value func _update(card: SupportCard): card_name_label.text = card.name card_desc_label.text = card.description icon_rect.texture = card.icon func _process(delta): var mouse_position = get_global_mouse_position() var rect = get_global_rect() if rect.has_point(mouse_position) and get_window().has_focus(): hovering.emit(delta) func _input(event): if event is InputEventMouseButton: var mouse_position = get_global_mouse_position() var rect = get_global_rect() if rect.has_point(mouse_position) and event.button_index == MOUSE_BUTTON_LEFT and event.is_pressed() and get_window().has_focus(): left_clicked.emit() elif rect.has_point(mouse_position) and event.button_index == MOUSE_BUTTON_RIGHT and event.is_pressed() and get_window().has_focus(): right_clicked.emit() elif event.button_index == MOUSE_BUTTON_RIGHT and !event.is_pressed(): un_right_clicked.emit()