38 lines
1,005 B
GDScript
38 lines
1,005 B
GDScript
extends Control
|
|
|
|
var currency: Currency = null
|
|
|
|
func _ready() -> void:
|
|
UserContext.currency_inspect.connect(currency_inspect)
|
|
UserContext.member_inspect.connect(member_inspect)
|
|
update()
|
|
|
|
func member_inspect(_m: CurrencyMemberSprite):
|
|
visible = false
|
|
|
|
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()
|
|
%word.visible = currency.production.size() > 0
|
|
for production in currency.production:
|
|
var display := preload("res://gui/production_display.tscn").instantiate()
|
|
display.production = production
|
|
%ProductionsList.add_child(display)
|
|
if currency.thumbnail != null:
|
|
%CurrrencyImage.visible = true
|
|
%CurrrencyImage.texture = currency.thumbnail
|
|
else:
|
|
%CurrrencyImage.visible = false
|
|
|
|
func _on_close_button_pressed() -> void:
|
|
visible = false
|