freettrpg/scripts/ui.gd
Patrick_Pluto 6b2159b840 Code Refactoring: Part 2
Hopefully final refactoring, offloaded ui scripts to its own global .gd to prevent repetition.
2024-06-19 18:27:40 +02:00

21 lines
701 B
GDScript

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