class_name GamePanel extends PanelContainer const quest_progress_bar_template = preload("res://quest_progress_bar.tscn") signal time_changed(time : float) @onready var timer : Timer = $Timer func _ready() -> void: Game.panel = self func _process(delta: float) -> void: time_changed.emit(timer.time_left) func add_quest_progress_bar(quest : Quest) -> void: var qpb : QuestProgressBar = quest_progress_bar_template.instantiate() qpb.setup(quest) %QuestProgressList/VBoxContainer.add_child(qpb) #TODO: Change the hero portrait to match if quest.steps > 1: for i in range(quest.steps-1): qpb.add_waypoint(float(i) / quest.steps, quest.step_messages[i]) func switch_panel(active : bool) -> void: %Active.visible = active %Passive.visible = !active func _on_end_shift_pressed() -> void: Game.confirm_end_shift() func _on_visitor_spawned(remaining : int, total : int) -> void: update_visitor_count(total - remaining, total) func connect_visitor_spawner(spawner : VisitorSpawner) -> void: spawner.visitor_spawned.connect(_on_visitor_spawned) update_visitor_count(spawner.total_visitors - spawner.visitors_remaining, spawner.total_visitors) func update_visitor_count(current : int, total : int) -> void: %Passive/VisitorsLabel.text = "Visitors: %d/%d" % [current, total]