36 lines
1.1 KiB
GDScript
36 lines
1.1 KiB
GDScript
extends GridContainer
|
|
|
|
# Signal to send texture data back to the main scene
|
|
signal texture_selected(texture : AtlasTexture)
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
|
|
# Iterate over all children of the GridContainer
|
|
for button in get_children():
|
|
# Check if the child is a TextureButton
|
|
if button is TextureButton:
|
|
# Connect the pressed signal of the TextureButton to the handler function
|
|
button.connect("pressed", Callable(self, "_on_TextureButton_pressed").bind(button))
|
|
|
|
|
|
|
|
# Handler function for the pressed signal
|
|
func _on_TextureButton_pressed(button):
|
|
# Print the name of the button
|
|
#print("Button pressed: ", button.name)
|
|
|
|
#Texture Variable
|
|
var texture : AtlasTexture = button.texture_normal
|
|
#Sets the selected texture on the team screen
|
|
Global.selected_texture = texture
|
|
|
|
#For returning to the Team Selection Screen after selecting member
|
|
#Sets the global variable for the team selection screen to true so when you move back it's already open
|
|
Global.teamScreenVisible = true
|
|
Global.teamSelectionVisible = false
|
|
|
|
|
|
|
|
|