29 lines
795 B
GDScript
29 lines
795 B
GDScript
|
|
extends Control
|
||
|
|
|
||
|
|
@onready var icons = {
|
||
|
|
"1c": $Row/Icon1c,
|
||
|
|
"1g": $Row/Icon1g,
|
||
|
|
"3c": $Row/Icon3c,
|
||
|
|
"3g": $Row/Icon3g,
|
||
|
|
"6c": $Row/Icon6c,
|
||
|
|
"6g": $Row/Icon6g,
|
||
|
|
"10c": $Row/Icon10c,
|
||
|
|
"10g": $Row/Icon10g,
|
||
|
|
}
|
||
|
|
|
||
|
|
@onready var event_label: RichTextLabel = $Row/Label
|
||
|
|
|
||
|
|
## Shows this achievement event with the matching points/state icon.
|
||
|
|
## event_type is "c" for completed or "g" for revealed but not completed.
|
||
|
|
func open(level: int, event_type: String, event_text: String) -> void:
|
||
|
|
var icon_key := str(level) + event_type.to_lower()
|
||
|
|
if not icons.has(icon_key):
|
||
|
|
push_warning("Unknown achievement icon: %s" % icon_key)
|
||
|
|
return
|
||
|
|
|
||
|
|
for key: String in icons:
|
||
|
|
icons[key].visible = key == icon_key
|
||
|
|
|
||
|
|
event_label.text = event_text
|
||
|
|
visible = true
|