objetos raros, objetos decorativos rompibles
This commit is contained in:
1 parent
827e16cf50
commit
66f4d8b33b
55 files changed
+4793
-163
No files matched your search
@@ -0,0 +1,42 @@
|
||||
extends VBoxContainer
|
||||
|
||||
## Vista de la coleccion permanente. No equipa, consume ni modifica los objetos.
|
||||
## Las tarjetas se crean desde el catalogo del perfil, no desde una segunda lista.
|
||||
signal back_requested
|
||||
const ITEM_CARD: PackedScene = preload("res://ui/menu/rare_item_card.tscn")
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
$Back.pressed.connect(func() -> void: back_requested.emit())
|
||||
|
||||
|
||||
func show_collection() -> void:
|
||||
for child: Node in $Scroll/Items.get_children():
|
||||
$Scroll/Items.remove_child(child)
|
||||
child.queue_free()
|
||||
var progress: PlayerProgressStore = get_node_or_null("/root/PlayerProgress") as PlayerProgressStore
|
||||
if progress == null:
|
||||
$Status.text = "No se encontro el perfil de objetos raros."
|
||||
$Status.show()
|
||||
show()
|
||||
return
|
||||
var owned_count: int = 0
|
||||
var items: Array[RareItemData] = progress.get_items()
|
||||
for item: RareItemData in items:
|
||||
var owned: bool = progress.has_item(item.id)
|
||||
if owned:
|
||||
owned_count += 1
|
||||
var card: PanelContainer = ITEM_CARD.instantiate() as PanelContainer
|
||||
$Scroll/Items.add_child(card)
|
||||
var icon: TextureRect = card.get_node("Margin/Row/Icon") as TextureRect
|
||||
icon.texture = item.icon
|
||||
icon.modulate = Color.WHITE if owned else Color(0.45, 0.45, 0.45)
|
||||
(card.get_node("Margin/Row/Text/Name") as Label).text = item.display_name
|
||||
(card.get_node("Margin/Row/Text/State") as Label).text = "CONSEGUIDO - SIEMPRE ACTIVO" if owned else "SIN CONSEGUIR"
|
||||
(card.get_node("Margin/Row/Text/Bonus") as Label).text = item.get_bonus_text()
|
||||
(card.get_node("Margin/Row/Text/Description") as Label).text = item.description
|
||||
$Count.text = "%d / %d objetos conseguidos" % [owned_count, items.size()]
|
||||
$Status.text = progress.last_error
|
||||
$Status.visible = not progress.last_error.is_empty()
|
||||
show()
|
||||
$Back.grab_focus()
|
||||
Reference in new issue
Block a user