mirror of
https://github.com/kodzukye/omens-ascent.git
synced 2026-08-10 05:13:10 +00:00
39 lines
1.2 KiB
GDScript
39 lines
1.2 KiB
GDScript
class_name CreditEntryRow
|
|
extends VBoxContainer
|
|
|
|
@onready var _title_label: Label = $TitleLabel
|
|
@onready var _used_for_label: Label = $UsedForLabel
|
|
@onready var _artist_label: Label = $ArtistLabel
|
|
@onready var _license_label: Label = $LicenseLabel
|
|
@onready var _link_button: LinkButton = $LinkButton
|
|
|
|
func _ready() -> void:
|
|
_link_button.pressed.connect(_on_link_button_pressed)
|
|
|
|
func setup(entry: CreditEntry) -> void:
|
|
_title_label.text = '"' + entry.asset_name + '"'
|
|
_artist_label.text = "by " + entry.artist_name
|
|
|
|
# Retire les champs vide
|
|
_used_for_label.visible = entry.used_for != ""
|
|
if _used_for_label.visible:
|
|
_used_for_label.text = "Used for " + entry.used_for
|
|
|
|
_license_label.visible = entry.license_note != ""
|
|
if _license_label.visible:
|
|
_license_label.text = "LICENSE: " + entry.license_note
|
|
|
|
_link_button.visible = entry.link_url != ""
|
|
if _link_button.visible:
|
|
_link_button.text = entry.link_url
|
|
_link_button.uri = _to_full_uri(entry.link_url)
|
|
|
|
func _on_link_button_pressed() -> void:
|
|
OS.shell_open(_link_button.uri)
|
|
|
|
func _to_full_uri(url: String) -> String:
|
|
# So the links can be open, besoin de https askip
|
|
if url.begins_with("http://") or url.begins_with("https://"):
|
|
return url
|
|
return "https://" + url
|