speedin-santa/Scripts/UI/CreditTemplate.gd
2024-12-18 16:35:26 -05:00

32 lines
992 B
GDScript

class_name CreditTemplate extends Control
@onready var title = $VBoxContainer/Title
@onready var nam = $VBoxContainer/Name
@onready var description = $VBoxContainer/Description
@export var speed: float = 30
@export var expireTime: float = 30
@export var creditInfo: Credit
var timer: float = 0
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
title.text = "[center]%s" % creditInfo.title
nam.text = "[center]%s" % creditInfo.name
var paragraph: String = "[center]"
for desc: String in creditInfo.description:
paragraph += desc + "\n"
for link: String in creditInfo.links:
paragraph += "[url=%s]%s[/url]\n" % [link, link]
description.text = paragraph
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
timer += delta
position.y -= speed * delta
if (timer >= expireTime): self.queue_free()
func _on_description_meta_clicked(meta: Variant) -> void:
OS.shell_open(str(meta))