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.
32 lines
739 B
GDScript
32 lines
739 B
GDScript
class_name QRPopup
|
|
extends PopupWindow
|
|
|
|
@onready
|
|
var qr_panel: Panel = $QRPanel
|
|
|
|
@onready
|
|
var qr_code_rect: QRCodeRect = $QRPanel/QRCodeRect
|
|
|
|
@onready
|
|
var url_label: Label = $QRPanel/URLLabel
|
|
|
|
|
|
func _ready() -> void:
|
|
qr_code_rect.light_module_color = Color.WHITE
|
|
qr_code_rect.dark_module_color = Color.BLACK
|
|
qr_code_rect.quiet_zone_size = 4
|
|
|
|
# Generate QR code for the search URL
|
|
var url: String = Settings.default_path + "/search"
|
|
qr_code_rect.data = url
|
|
url_label.text = qr_code_rect.data
|
|
GameLog.debug("QR code generated for: ", url)
|
|
|
|
func open() -> void:
|
|
super()
|
|
# Regenerate QR code in case settings changed
|
|
var url: String = Settings.default_path + "/search"
|
|
qr_code_rect.data = url
|
|
url_label.text = qr_code_rect.data
|
|
|