extends Control @onready var tab_patient_file = $Margin/ComputerScreen/Tabs/PatientFile @onready var tab_statistics = $Margin/ComputerScreen/Tabs/Statistics @onready var tab_recording = $Margin/ComputerScreen/Tabs/Recording @onready var patient_file = $Margin/ComputerScreen/ComputerTabs/FileContainer/PatientFile @onready var statistics = $Margin/ComputerScreen/ComputerTabs/Statistics @onready var recording = $Margin/ComputerScreen/ComputerTabs/Recording var tab_list var screen_list # Called when the node enters the scene tree for the first time. func _ready() -> void: tab_list = [tab_patient_file, tab_statistics, tab_recording] screen_list = [patient_file, statistics, recording] #Connecting signals tab_patient_file.pressed.connect(self._on_tab_patient_file_pressed) tab_statistics.pressed.connect(self._on_tab_statistics_pressed) tab_recording.pressed.connect(self._on_tab_recording_pressed) Globals.response_chosen.connect(self._on_response_chosen) #Shows the patient file tab func _on_tab_patient_file_pressed(): tab_switch(tab_patient_file, patient_file) #Shows the statistics tab func _on_tab_statistics_pressed(): tab_switch(tab_statistics, statistics) #Shows the recording tab func _on_tab_recording_pressed(): tab_switch(tab_recording, recording) #Shows the correct screen according to the pressed tab func tab_switch(pressed_tab, tab_screen): #Highlights pressed tab and unpress the others for tab in tab_list: tab.set_pressed(false) tab.set_mouse_filter(Control.MOUSE_FILTER_STOP) pressed_tab.set_pressed(true) pressed_tab.set_mouse_filter(Control.MOUSE_FILTER_IGNORE) #Showing desired screen and hiding the others for node in screen_list: node.hide() tab_screen.show() func _recording_text(dialogue_line): #Records the dialogues recording.append_text("\n\n") recording.append_text("[color=red]" + dialogue_line.character + "[/color]" + "\n") recording.append_text(dialogue_line.text) func _on_response_chosen(response): #Adds protagonist responses to the recording tab recording.append_text("\n\n") recording.append_text("[color=green]You[/color]" + "\n") recording.append_text(response.text) #Updates the statistics tab func update_statistics(accurate_diagnoses, misdiagnoses): var accurate_diagnoses_line = "ACCURATE DIAGNOSES : " + Globals.colorize(str(accurate_diagnoses), "green") var misdiagnoses_line = "MISDIAGNOSES : " + Globals.colorize(str(misdiagnoses), "red") statistics.text = accurate_diagnoses_line + "\n\n" + misdiagnoses_line #Resets to initial state func reset(): update_statistics(Globals.accurate_diagnoses, Globals.misdiagnoses) patient_file.text = Globals.default_patient_file recording.text = ""