class_name CharacterSelectionItem extends PanelContainer signal selected static var selected_item: CharacterSelectionItem: set(value): var previous_item = selected_item selected_item = value if previous_item: previous_item.draw_highlight(false) var is_hovered := false func initialize_with_info(info: CharacterInformation): %Head.texture = load( "%s/%s/000.png" % [ "res://client_data/data/sprite", Constants.FilePaths.get_player_head(info.gender, info.head), ] ) %Body.texture = load( "%s/%s/000.png" % [ "res://client_data/data/sprite", Constants.FilePaths.get_player_body(info.gender, info.job), ] ) %Name.text = info.name func draw_highlight(is_highlighted: bool): if selected_item == self: is_highlighted = true var style_box: StyleBoxFlat = get_theme_stylebox("panel").duplicate() style_box.draw_center = is_highlighted add_theme_stylebox_override("panel", style_box) func _on_gui_input(event: InputEvent) -> void: if event.is_pressed(): selected_item = self draw_highlight(true) selected.emit() func _on_mouse_entered() -> void: is_hovered = true draw_highlight(is_hovered) func _on_mouse_exited() -> void: is_hovered = false draw_highlight(is_hovered)