- Types on every parameter, return value and variable, and snake_case names (the player name limit is the constant MAX_NAME_LENGTH). - Spelling fixes: *_triggered, character_selected, separator, caught_errors. The server's catched_errors key stays as the server sends it. - Signals are connected with signal.connect() instead of by name. - Code is ordered signals, constants, exported vars, vars, @onready vars, functions, with @onready on one line and two blank lines between functions. - Every script starts with a ## description. Template comments, old LOC notes and commented-out code are gone, apart from the local play code. - Lines are at most 100 characters, apart from the local play path. - The screenshot tour turns off the blinking text cursor so pictures match.
30 lines
852 B
GDScript
30 lines
852 B
GDScript
class_name QRPopup
|
|
extends BasePopup
|
|
## Shows a QR code with the address of the search page on the MusicServer, so players
|
|
## can search for soundtracks on their phones.
|
|
|
|
@onready var qr_panel: Panel = $QRPanel
|
|
@onready var qr_code_rect: QRCodeRect = %QRCodeRect
|
|
@onready var url_label: Label = %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
|
|
|