27 lines
727 B
GDScript
27 lines
727 B
GDScript
extends Control
|
|
|
|
#@export var SECTOR_COUNT: int = 15
|
|
@export var SectorScenePath: String = "res://scenes/Sector.tscn"
|
|
@onready var container = $VBoxContainer
|
|
|
|
func _ready():
|
|
_create_sector_buttons()
|
|
|
|
func _create_sector_buttons():
|
|
for child in container.get_children():
|
|
child.queue_free()
|
|
for i in range(Manager.SECTOR_COUNT):
|
|
var button = Button.new()
|
|
button.text = "Sector %d" % (i+1)
|
|
button.custom_minimum_size = Vector2(200, 40)
|
|
var index = i
|
|
button.pressed.connect(func() -> void:
|
|
_on_sector_selected(index)
|
|
)
|
|
container.add_child(button)
|
|
|
|
func _on_sector_selected(index: int):
|
|
Manager.current_sector = index
|
|
var sector_scene = load(SectorScenePath)
|
|
get_tree().change_scene_to_packed(sector_scene)
|