everything_has_a_price_jam/gui/currency_inspector_panel.gd
2026-09-26 12:37:45 -06:00

28 lines
686 B
GDScript

extends Control
var currency: Currency = null
func _ready() -> void:
UserContext.currency_inspect.connect(currency_inspect)
update()
func currency_inspect(c: Currency):
currency = c
update()
func update():
if currency == null:
visible = false
return
visible = true
%InspectedCurrency.text = currency.name
%CurrencyDescription.text = currency.description
for child in %ProductionsList.get_children():
child.queue_free()
for production in currency.production:
var display := preload("res://gui/production_display.tscn").instantiate()
display.production = production
%ProductionsList.add_child(display)
func _on_close_button_pressed() -> void:
visible = false