extends Control

@onready var label_player_name = $HBoxContainer/PlayerName
#@onready var label_science = $HBoxContainer/LabelScience
@onready var label_iron = $HBoxContainer/IronLabel
@onready var label_water = $HBoxContainer/WaterLabel
@onready var label_copper = $HBoxContainer/CopperLabel
@onready var label_since = $HBoxContainer/SinceLabel
#@onready var label_population = $HBoxContainer/LabelPopulation

func update_info():
	
	label_player_name.text = "Gracz: %s" % PlayerData.PlayerName
#label_science.text = "🔬 Nauka: %s" % player.science

	label_iron.text = "%s: %.2f" % [tr("iron"), PlayerData.resources.iron]
	label_water.text = "%s: %.2f" % [tr("water"), PlayerData.resources.water]
	label_copper.text = "%s: %.2f" % [tr("copper"), PlayerData.resources.copper]
	label_since.text = "%s: %.2f" % [tr("since"), PlayerData.since_doc]

	
	#label_population.text = "👥 Populacja: %s" % GameData.format_number(player.total_population)

func _ready():
	PlayerData.connect("stats_changed", Callable(self, "update_info"))
	update_info()

func _on_stats_changed():
	update_info()
