extends Control

const LEVEL_5_ROOMS: PackedScene          = preload("res://levels/level_5rooms.tscn")
const LEVEL_3_ROOMS: PackedScene          = preload("res://levels/level_3_rooms.tscn")
const LEVEL_PLATFORMER: PackedScene       = preload("res://levels/level_platformer.tscn")
const LEVEL_SEMAPHORE_LIGHTS: PackedScene = preload("res://levels/level_semaphore_lights.tscn")
const LEVEL_CUBE_PORTALS: PackedScene     = preload("res://levels/level_cube_portals.tscn")
const LEVEL_HERMIONE: PackedScene         = preload("res://levels/level_hermione.tscn")

@onready var items_container: VBoxContainer = $CenterContainer/ItemsContainer

var levels: Dictionary = {
	"Semaphore": LEVEL_3_ROOMS,
	"Semaphore - Lights Demo": LEVEL_SEMAPHORE_LIGHTS,
	"5 rooms": LEVEL_5_ROOMS,
	"Platform": LEVEL_PLATFORMER,
	"Recurisve portals - WIP": LEVEL_CUBE_PORTALS,
	"Multiple Worlds": LEVEL_HERMIONE
}

func _ready() -> void:
	for key in levels:
		var b = Button.new()
		items_container.add_child(b)
		b.text = key
		b.pressed.connect(func(): get_tree().change_scene_to_packed(levels[key]))
