extends Node2D

var _card_class = preload("res://card.tscn")

var field_scene = preload("res://field.tscn")
var fields: Array[Node] = []

var decks: Array[Dictionary]


func _load_decks():
	if !FileAccess.file_exists("user://decks.json"):
		return  # no loaded decks

	var file = FileAccess.open("user://decks.json", FileAccess.READ)
	decks = JSON.parse_string(file.get_as_text())
	file.close()


# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	# The first field in the array will be the player's own field.
	# Might be a better idea to have that in a seperate variable? idk

	var card = _card_class.instantiate()

	# TODO: Currently working with an already-cached card with a known ID to load this.
	# Later on, the cards should be pulling the IDs directly from the library's list of IDs.
	card.init("d3f10f07-7cfe-4a6f-8de6-373e367a731b")

	add_child(card)

	#fields.append(field_scene.instantiate())
	#var colors: Array[Color] = [Color(1, 0, 1)]
	#fields[0].set_colors(colors)
	#add_child(fields[0])


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta: float) -> void:
	pass