29 lines
978 B
GDScript
29 lines
978 B
GDScript
extends HBoxContainer
|
|
|
|
@onready var check_icon: Label = $CheckIcon
|
|
@onready var objective_label: Label = $ObjectiveLabel
|
|
|
|
func setup(obj: QuestObjective, is_quest_completed: bool) -> void:
|
|
# Texte : description + compteur si nécessaire
|
|
if obj.required_count > 1:
|
|
objective_label.text = "%s (%d/%d)" % [
|
|
obj.description, obj.current_count, obj.required_count
|
|
]
|
|
else:
|
|
objective_label.text = obj.description
|
|
|
|
# Petit marqueur "optionnel"
|
|
if obj.is_optional:
|
|
objective_label.text += " [optionnel]"
|
|
|
|
# Icône et couleur selon l'état
|
|
var complete := obj.is_complete() or is_quest_completed
|
|
if complete:
|
|
check_icon.text = "☑"
|
|
check_icon.add_theme_color_override("font_color", Color(0.4, 0.9, 0.4))
|
|
objective_label.add_theme_color_override("font_color", Color(0.6, 0.6, 0.6))
|
|
else:
|
|
check_icon.text = "☐"
|
|
check_icon.add_theme_color_override("font_color", Color(0.8, 0.8, 0.8))
|
|
objective_label.add_theme_color_override("font_color", Color(1, 1, 1))
|