2024-06-15 20:33:37 +02:00
|
|
|
extends Node
|
|
|
|
|
2024-06-16 19:32:19 +02:00
|
|
|
var field = preload("res://scenes/menu/inputOutput.tscn")
|
2024-06-18 19:17:42 +02:00
|
|
|
var data
|
2024-06-15 21:56:18 +02:00
|
|
|
var amount
|
|
|
|
|
|
|
|
func _ready():
|
2024-06-18 19:17:42 +02:00
|
|
|
data = Content.data
|
|
|
|
for i in range(int(data.get("amount"))):
|
|
|
|
var fieldInstance = field.instantiate()
|
|
|
|
$"ScrollContainer/VBoxContainer".add_child(fieldInstance)
|
|
|
|
$"ScrollContainer/VBoxContainer".get_child(i).placeholder_text = data.get(str(i))
|
|
|
|
$"ScrollContainer/VBoxContainer".get_child(i).custom_minimum_size.y = 40
|
|
|
|
if i > 0:
|
|
|
|
$"ScrollContainer/VBoxContainer".get_child(i).editable = false
|
|
|
|
amount = data.get("amount")
|
2024-06-15 20:33:37 +02:00
|
|
|
|
|
|
|
func _on_button_pressed():
|
2024-06-16 20:01:56 +02:00
|
|
|
var savePath = str("user://player_data"+$"ScrollContainer/VBoxContainer".get_child(0).text+".json")
|
2024-06-18 19:17:42 +02:00
|
|
|
data = Load.loadJSON(savePath)
|
|
|
|
if typeof(data) == 27:
|
2024-06-15 21:56:18 +02:00
|
|
|
for i in range(int(amount)-1):
|
2024-06-16 20:01:56 +02:00
|
|
|
$"ScrollContainer/VBoxContainer".get_child(i+1).text = data.get(str($"ScrollContainer/VBoxContainer".get_child(i+1).placeholder_text))
|
2024-06-15 20:33:37 +02:00
|
|
|
|
2024-06-16 20:01:56 +02:00
|
|
|
func _process(_delta):
|
2024-06-15 20:33:37 +02:00
|
|
|
if Input.is_action_pressed("escape"):
|
|
|
|
get_tree().change_scene_to_file("res://scenes/menu/main.tscn")
|
2024-06-16 19:32:19 +02:00
|
|
|
|
|
|
|
func hideGet():
|
|
|
|
$button.visible = false
|
|
|
|
$button.disabled = true
|