Every popup is now called *Popup instead of *Window in its file, root node, node name, class and variable, and PopupWindow becomes BasePopup. Player is PlayerRow, SongListObject is SongRow and Character is CharacterCard. Script files are snake_case and scene files PascalCase, each matching its class or root node, and LightGrayTheme.tres is light_gray_theme.tres.
27 lines
691 B
GDScript
27 lines
691 B
GDScript
class_name LogPopup
|
|
extends BasePopup
|
|
|
|
@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]
|