29 lines
521 B
GDScript
29 lines
521 B
GDScript
@tool
|
|
extends Control
|
|
|
|
class_name GameMenuTab
|
|
|
|
signal on_tab_selected(index: int)
|
|
|
|
@export var index: int = 0
|
|
@export var image: Texture:
|
|
set(value):
|
|
image = value
|
|
if is_inside_tree() and has_node("%Texture"):
|
|
$%Texture.texture_normal = image
|
|
|
|
var is_selected: bool = false
|
|
|
|
func _ready():
|
|
if image != null and has_node("%Texture"):
|
|
$%Texture.texture_normal = image
|
|
|
|
func _on_texture_pressed() -> void:
|
|
on_tab_selected.emit(index)
|
|
|
|
func select():
|
|
is_selected = true
|
|
|
|
func deselect():
|
|
is_selected = false
|