Add achievement item UI and logic for displaying achievements

This commit is contained in:
Kirill
2026-10-18 20:03:27 +03:00
parent fe68e788b3
commit e41d652631
4 changed files with 132 additions and 4 deletions
+28
View File
@@ -0,0 +1,28 @@
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