The popups, the volume slider, the player name field and the main window get a class_name, so the main window and the quiz hold them by their real type instead of Control. The classes already use the names the files will get.
27 lines
693 B
GDScript
27 lines
693 B
GDScript
class_name LogPopup
|
|
extends PopupWindow
|
|
|
|
@onready
|
|
var log_panel: Panel = %LogPanel
|
|
|
|
@onready
|
|
var log_box: VBoxContainer = %LogVBoxContainer
|
|
|
|
var log_rows: Array
|
|
|
|
func add_log_row(text: String) -> void:
|
|
var log_row: String = get_time() + text
|
|
log_rows.append(log_row)
|
|
log_box.add_child(make_log_label(log_row))
|
|
|
|
func make_log_label(row: String) -> Label:
|
|
var log_label: Label = Label.new()
|
|
log_label.add_theme_font_size_override("font_size", 20)
|
|
log_label.text = row
|
|
log_label.autowrap_mode = TextServer.AUTOWRAP_WORD
|
|
return log_label
|
|
|
|
func get_time() -> String:
|
|
var time: Dictionary = Time.get_time_dict_from_system()
|
|
return "%02d:%02d:%02d " % [time.hour, time.minute, time.second]
|