freettrpg/scripts/ui.gd

22 lines
701 B
GDScript3
Raw Permalink Normal View History

extends Node
# Loading the stat field
var field = preload("res://scenes/menu/inputOutput.tscn")
# Creating all necessary stat fields
func placeFields(data, container, isWriteable):
# Load which stats should be displayed
# Create the fields one-by-one
for i in range(int(data.get("amount"))):
var fieldInstance = field.instantiate()
container.add_child(fieldInstance)
# Changes their placeholder based on what should be entered or seen in that field
container.get_child(i).placeholder_text = data.get(str(i))
container.get_child(i).custom_minimum_size.y = 40
# Every field except ID (if not isWriteable)
if i > 0 and !isWriteable:
container.get_child(i).editable = false