69 lines
1.7 KiB
GDScript
69 lines
1.7 KiB
GDScript
extends Control
|
|
|
|
var _data
|
|
|
|
const TEXT_PADDING = 30
|
|
|
|
var items = []
|
|
var tween
|
|
|
|
func _ready() -> void:
|
|
if get_tree().root.has_node("Data"):
|
|
_data = get_tree().root.get_node("Data")
|
|
|
|
if _data.data.has("metadata") and _data.data.metadata.has("credits"):
|
|
var credits = _data.data.metadata.credits
|
|
var sections = credits.keys()
|
|
var y = 50
|
|
|
|
for section in sections:
|
|
var section_text = RichTextLabel.new()
|
|
section_text.position = Vector2(-120, y)
|
|
section_text.size = Vector2(40, TEXT_PADDING)
|
|
section_text.bbcode_enabled = true
|
|
section_text.text = "[center]%s" % [section]
|
|
add_child(section_text)
|
|
items.push_back(section_text)
|
|
y += TEXT_PADDING
|
|
var people = credits[section].keys()
|
|
|
|
for person in people:
|
|
var person_text = RichTextLabel.new()
|
|
person_text.position = Vector2(-120, y)
|
|
person_text.size = Vector2(40, TEXT_PADDING)
|
|
person_text.bbcode_enabled = true
|
|
person_text.text = "[center]%s" % [person]
|
|
add_child(person_text)
|
|
items.push_back(person_text)
|
|
y += TEXT_PADDING
|
|
|
|
var links = credits[section][person].keys()
|
|
|
|
for link in links:
|
|
var url = credits[section][person][link]
|
|
|
|
y += TEXT_PADDING
|
|
|
|
|
|
func show_credits():
|
|
if tween:
|
|
tween.kill()
|
|
|
|
tween = create_tween()
|
|
tween.set_ease(Tween.EASE_OUT)
|
|
tween.set_trans(Tween.TRANS_BACK)
|
|
|
|
for item in items:
|
|
tween.tween_property(item, "position:x", 320, 0.25)
|
|
|
|
func hide_credits():
|
|
if tween:
|
|
tween.kill()
|
|
|
|
tween = create_tween()
|
|
tween.set_parallel()
|
|
tween.set_ease(Tween.EASE_OUT)
|
|
tween.set_trans(Tween.TRANS_QUAD)
|
|
|
|
for item in items:
|
|
tween.tween_property(item, "position:x", -120, 0.25)
|