87 lines
2.6 KiB
GDScript
87 lines
2.6 KiB
GDScript
extends Control
|
|
|
|
@onready var tab_patient_file = $Margin/ComputerScreen/Tabs/PatientFile
|
|
@onready var tab_rules = $Margin/ComputerScreen/Tabs/Rules
|
|
@onready var tab_recording = $Margin/ComputerScreen/Tabs/Recording
|
|
@onready var patient_file = $Margin/ComputerScreen/ComputerTabs/FileContainer/PatientFile
|
|
@onready var rules = $Margin/ComputerScreen/ComputerTabs/Rules
|
|
@onready var recording = $Margin/ComputerScreen/ComputerTabs/Recording
|
|
@onready var screen = $Margin/ComputerScreen2
|
|
@onready var next_patient_button = $Margin/NextPatient/CallNextPatient
|
|
|
|
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_rules, tab_recording]
|
|
screen_list = [patient_file, rules, recording]
|
|
|
|
#Connecting signals
|
|
tab_patient_file.pressed.connect(self._on_tab_patient_file_pressed)
|
|
tab_rules.pressed.connect(self._on_tab_rules_pressed)
|
|
tab_recording.pressed.connect(self._on_tab_recording_pressed)
|
|
Globals.response_chosen.connect(self._on_response_chosen)
|
|
|
|
#Hiding everything
|
|
for node in tab_list + screen_list + [screen, next_patient_button]:
|
|
node.hide()
|
|
|
|
|
|
#Displays a message on the computer screen
|
|
func display(message):
|
|
var text = message.replace("\\n", "\n") #Replaces litteral backslashes by actual newlines (necessary because of Dialogue Manager)
|
|
screen.text = text
|
|
screen.show()
|
|
|
|
|
|
#Shows the patient file tab
|
|
func _on_tab_patient_file_pressed():
|
|
tab_switch(tab_patient_file, patient_file)
|
|
|
|
#Shows the rules tab
|
|
func _on_tab_rules_pressed():
|
|
tab_switch(tab_rules, rules)
|
|
|
|
#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)
|
|
|
|
|
|
#Resets to initial state
|
|
func reset():
|
|
|
|
for node in tab_list + screen_list + [screen, next_patient_button]:
|
|
node.hide()
|