Files
Denis Defolie 97a065879c Visual overhaul: theme, illustrations, redesigned screens (0.3.0)
Phase "habillage" of the post-0.1.0 plan. Rendering was reviewed on real
screenshots (new tools/screenshot.gd, `make screenshot`), which also
caught and fixed map markers overlapping and truncated titles.

- Global Godot theme (Atkinson Hyperlegible font, cream/green/gold
  palette, raised buttons, rounded cards, thick keyboard focus).
- Original vector art: forest/marsh backdrops, Plume the owl, stars,
  exercise-type icons, correct/try-again icons, 10 collection items.
- Redesigned world map (markers as cards with icon, title and stars,
  responsive layout), profile screens, mission intro, exercise host,
  rule/feedback panels, reward screen and collection grid.
- Motion helper (pop-in, fade) honouring an animations setting.
- Settings: animations flag; base window 1152x648 with canvas_items.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-11 22:36:43 +02:00

76 lines
2.7 KiB
GDScript

extends Control
## Collection d'objets gagnes avec les etoiles. Un objet non debloque reste
## mysterieux mais indique comment l'obtenir (jamais de mystere frustrant).
const ICON_SIZE := 72.0
@onready var _title_label: Label = %TitleLabel
@onready var _progress_label: Label = %ProgressLabel
@onready var _items_box: GridContainer = %ItemsBox
@onready var _back_button: Button = %BackButton
func _ready() -> void:
_title_label.text = UIText.get_text("collection.title")
_back_button.text = UIText.get_text("collection.back_button")
_back_button.pressed.connect(_on_back_pressed)
var owned: Array = ProgressManager.owned_items()
var catalog := ExerciseEngine.get_reward_items()
var found := 0
for item in catalog:
var is_owned := owned.has(item["item_id"])
if is_owned:
found += 1
_items_box.add_child(_build_row(item, is_owned))
_progress_label.text = (
"%s %d/%d" % [UIText.get_text("collection.progress_label"), found, catalog.size()]
)
## Une ligne = pictogramme + texte (le Label s'appelle "TextLabel").
func _build_row(item: Dictionary, is_owned: bool) -> Control:
var card := PanelContainer.new()
card.theme_type_variation = &"SoftCard"
card.size_flags_horizontal = Control.SIZE_EXPAND_FILL
var row := HBoxContainer.new()
row.add_theme_constant_override("separation", 12)
card.add_child(row)
var icon := TextureRect.new()
icon.texture = (
ItemIcons.texture_for(item["item_id"]) if is_owned else ItemIcons.locked_texture()
)
icon.custom_minimum_size = Vector2(ICON_SIZE, ICON_SIZE)
icon.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
icon.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
icon.size_flags_vertical = Control.SIZE_SHRINK_CENTER
row.add_child(icon)
var label := Label.new()
label.name = "TextLabel"
label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
label.size_flags_horizontal = Control.SIZE_EXPAND_FILL
label.size_flags_vertical = Control.SIZE_SHRINK_CENTER
if is_owned:
label.text = "%s\n%s" % [item["title"], item["description"]]
else:
label.text = (
"%s\n%s" % [UIText.get_text("collection.locked_title"), _unlock_hint(item["unlock"])]
)
row.add_child(label)
return card
func _unlock_hint(unlock: Dictionary) -> String:
var count: int = int(unlock["count"])
if unlock["type"] == "mission_stars":
var mission := ExerciseEngine.get_mission(unlock.get("mission_id", ""))
return UIText.get_text("collection.unlock_mission_stars") % [count, mission.get("title", "")]
return UIText.get_text("collection.unlock_total_stars") % count
func _on_back_pressed() -> void:
GameManager.goto(GameManager.SCENE_WORLD_MAP)