everything_has_a_price_jam/gui/production_log.gd
2026-09-26 17:07:56 -06:00

38 lines
980 B
GDScript

extends Control
class_name ProductionLog
@export var producer: Currency = null
@export var production: Production
var is_old: bool = false
func _ready() -> void:
if producer != null:
%producer.text = producer.name
%Production.visible = true
%Production2.visible = false
else:
%Production.visible = false
%Production2.visible = true
%amount.text = str(abs(production.amount))
%amount2.text = str(abs(production.amount))
if production.amount > 0:
%type.text = "produced"
%producer2.text = "You gained"
else:
%type.text = "consumed"
%producer2.text = "You lost"
%production.text = production.currency.name
%production2.text = production.currency.name
make_old.call_deferred()
func make_old():
is_old = true
func set_color(color: Color):
var children = get_children()
while children.size():
var child = children.pop_back()
if child is Label:
child.add_theme_color_override("font_color", color)
children.append_array(child.get_children())