extends VBoxContainer

func initialize_with_progress(levelFullName: String) -> void:
	if !GlobalState.get_progress().has(levelFullName):
		return
	if !GlobalState.get_progress()[levelFullName].has("froggies"):
		return
	var froggies : Dictionary = GlobalState.get_progress()[levelFullName]["froggies"]
	for key in froggies.keys():
		register_froggy(int(key), froggies[key])
	
	var level_time : float = GlobalState.get_level_time(levelFullName)
	if(GlobalState.get_level_completed(levelFullName)):
		$"%LevelTime".visible = true
		$"%LevelTime".text = "Time " + str(round(level_time*1000)/1000) + " sec"
	

func register_froggy(var count : int = 0, var freed: bool = false) -> void:
	var frogo: String = "%FreedFroggy" + str(count + 1)
	var test = self.get_children()
	get_node(frogo).visible = true
	get_node(frogo + "/ImprisionedFroggy").visible = !freed
