forked from interstellar_development/freettrpg
6b2159b840
Hopefully final refactoring, offloaded ui scripts to its own global .gd to prevent repetition.
21 lines
701 B
GDScript
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
|