Added descriptions to upgrades and fixed timer not stopping bug

This commit is contained in:
2024-05-11 12:26:07 +01:00
parent b180483437
commit 9fc8367dd3
12 changed files with 162 additions and 48 deletions

View File

@@ -3,6 +3,8 @@ extends PanelContainer
signal load_file(filename : String)
signal load_level(level_name : String)
var MainTheme = preload("res://MainTheme.tres")
func update_level_list(unique : bool = false) -> void:
var list : Array[String] = []
@@ -12,12 +14,21 @@ func update_level_list(unique : bool = false) -> void:
for k in vb.get_children():
vb.remove_child(k)
k.queue_free()
if DirAccess.dir_exists_absolute("user://Levels"):
var lb = Label.new();
lb.theme = MainTheme
lb.size_flags_horizontal = Control.SIZE_EXPAND_FILL
lb.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
lb.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
lb.text = "User Levels"
vb.add_child(lb)
for file in DirAccess.get_files_at("user://Levels"):
if file.ends_with(".json"):
var data = JSON.parse_string(FileAccess.get_file_as_string("user://Levels/%s" % file))
var b = Button.new()
b.theme = load("res://MainTheme.tres")
b.theme = MainTheme
b.text = data.name
b.theme_type_variation = "UserFile"
b.size_flags_horizontal = Control.SIZE_EXPAND_FILL
@@ -27,6 +38,16 @@ func update_level_list(unique : bool = false) -> void:
b.icon = load("res://Icons/User.png")
vb.add_child(b)
list.push_back(data.name)
var l = Label.new();
l.theme = MainTheme
l.text = "Internal Levels"
l.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
l.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
l.size_flags_horizontal = Control.SIZE_EXPAND_FILL
vb.add_child(l)
for file in DirAccess.get_files_at("res://Levels"):
if file.ends_with(".json"):
var data = JSON.parse_string(FileAccess.get_file_as_string("res://Levels/%s" % file))