end_of_day dialogues
This commit is contained in:
+47
-2
@@ -35,6 +35,8 @@ func _ready() -> void:
|
||||
|
||||
#Connecting Signals
|
||||
title_screen.connect("new_game_pressed", self._on_new_game_pressed)
|
||||
title_screen.connect("load_pressed", self._on_load_pressed)
|
||||
title_screen.connect("settings_pressed", self._on_settings_pressed)
|
||||
screening_desk.connect("recovery_pressed", self._on_recovery_pressed)
|
||||
|
||||
pass
|
||||
@@ -112,7 +114,7 @@ func start_day_loop():
|
||||
await TransitionScreen.transition_finished
|
||||
|
||||
#Finally starting the Game Loop
|
||||
$ScreeningDesk.new_patient("564")
|
||||
$ScreeningDesk.new_patient(Globals.patient_id)
|
||||
|
||||
|
||||
|
||||
@@ -141,4 +143,47 @@ func _on_recovery_pressed():
|
||||
scenes_to_show = [$ScreeningDesk, $ScreeningDesk.alone_controls]
|
||||
TransitionScreen.transition("big", scenes_to_hide, scenes_to_show)
|
||||
await TransitionScreen.transition_finished
|
||||
$ScreeningDesk.new_patient("564")
|
||||
$ScreeningDesk.new_patient(Globals.patient_id)
|
||||
|
||||
|
||||
|
||||
func save_game(save_slot:String):
|
||||
|
||||
var save_data = {
|
||||
"day_count": Globals.day_count,
|
||||
"patient_count": Globals.patient_count,
|
||||
"patient_id": Globals.patient_id
|
||||
}
|
||||
|
||||
var file = FileAccess.open("res://Saves/save_" + save_slot + ".json", FileAccess.WRITE)
|
||||
if file:
|
||||
var json_string = JSON.stringify(save_data)
|
||||
print(json_string)
|
||||
file.store_string(json_string)
|
||||
file.close()
|
||||
print("Game saved successfully!")
|
||||
else:
|
||||
print("Failed to open file for saving.")
|
||||
|
||||
|
||||
|
||||
func load_game(save_slot:String):
|
||||
|
||||
var file = FileAccess.open("res://Saves/save_" + save_slot + ".json", FileAccess.READ)
|
||||
if file:
|
||||
var json_string = file.get_as_text()
|
||||
file.close()
|
||||
var load_data = JSON.parse_string(json_string)
|
||||
|
||||
if load_data == OK:
|
||||
print(load_data)
|
||||
Globals.day_count = load_data["day_count"]
|
||||
Globals.patient_count = load_data["patient_count"]
|
||||
Globals.patient_id = load_data["patient_id"]
|
||||
else:
|
||||
print("Failed to parse Loading Data.")
|
||||
|
||||
|
||||
|
||||
func _on_save_pressed():
|
||||
|
||||
|
||||
Reference in New Issue
Block a user