Finally fixed font texture

This commit is contained in:
2024-05-09 14:12:40 +01:00
parent 10952b6502
commit 099340f870
20 changed files with 294 additions and 95 deletions

View File

@@ -1,8 +1,12 @@
extends PanelContainer
signal load_file(filename : String)
signal load_level(level_name : String)
func update_level_list(unique : bool = false) -> void:
var list : Array[String] = []
func update_level_list() -> void:
var vb = $VBoxContainer/ScrollContainer/VBoxContainer
for k in vb.get_children():
@@ -19,11 +23,16 @@ func update_level_list() -> void:
b.size_flags_horizontal = Control.SIZE_EXPAND_FILL
b.pressed.connect(_on_load_file_pressed.bind(b))
b.set_meta("filename", "user://Levels/%s" % file)
b.set_meta("level_name", data.name)
b.icon = load("res://Icons/User.png")
vb.add_child(b)
list.push_back(data.name)
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))
if unique:
if list.has(data.name):
continue
var b = Button.new()
b.theme = load("res://MainTheme.tres")
b.theme_type_variation = "InternalFile"
@@ -31,12 +40,12 @@ func update_level_list() -> void:
b.size_flags_horizontal = Control.SIZE_EXPAND_FILL
b.pressed.connect(_on_load_file_pressed.bind(b))
b.set_meta("filename", "res://Levels/%s" % file)
b.set_meta("level_name", data.name)
b.icon = load("res://Icons/Internal.png")
vb.add_child(b)
func show_panel() -> void:
update_level_list()
func show_panel(unique : bool = false) -> void:
update_level_list(unique)
visible = true
func _on_cancel_pressed() -> void:
@@ -44,4 +53,5 @@ func _on_cancel_pressed() -> void:
func _on_load_file_pressed(node):
load_file.emit(node.get_meta("filename"))
load_level.emit(node.get_meta("level_name"))
visible = false