everything_has_a_price_jam/gui/production_ledger.gd
2026-09-27 14:50:00 -06:00

31 lines
915 B
GDScript

extends VBoxContainer
@export var new_message_color: Color
@export var old_message_color: Color
func _ready() -> void:
Economy.production_log.connect(append)
Economy.log.connect(log)
func log(s: String):
var display := preload("res://gui/production_log.tscn").instantiate()
display.set_color(new_message_color)
for child in get_children():
if child is ProductionLog and child.is_old:
child.set_color(old_message_color)
display.generic = true
display.generic_text = s
add_child(display)
move_child(display, 0)
func append(producer: Currency, production: Production):
var display := preload("res://gui/production_log.tscn").instantiate()
display.set_color(new_message_color)
for child in get_children():
if child is ProductionLog and child.is_old:
child.set_color(old_message_color)
display.producer = producer
display.production = production
add_child(display)
move_child(display, 0)