32 lines
992 B
GDScript3
32 lines
992 B
GDScript3
![]() |
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))
|