UI code reorganizing
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
extends Node
|
||||
|
||||
#Variables for gameplay
|
||||
var day_count : int = 1
|
||||
var floor_count : int = -1
|
||||
var patient_count : int = 1
|
||||
@@ -10,6 +11,11 @@ var patient_list = ["42", "43", "44", "45", "46", "47", "48", "49", "50", "51"]
|
||||
var patients_seen = []
|
||||
var its_patients_seen = []
|
||||
var patient_id
|
||||
|
||||
#Variables for UI
|
||||
var save_slot_count = 4 #How many save slots there are in the game, in addition to the autosave slot
|
||||
|
||||
#Variables for text
|
||||
var interfloor_dialogue = load("res://Dialogues/interfloor.dialogue")
|
||||
var directives = "\n[center][font_size=22]INSTRUCTIONS[/font_size][/center]
|
||||
\n\n[font_size=18][color=forest_green]RELEASE[/color] HUMANS, [color=red]TERMINATE[/color] ABNORMALS
|
||||
|
||||
+19
-23
@@ -29,13 +29,13 @@ func _ready() -> void:
|
||||
title_screen.show()
|
||||
|
||||
#Connecting Signals
|
||||
title_screen.connect("new_game_pressed", self._on_new_game_pressed)
|
||||
UI.connect("save_slot_pressed", self._on_save_slot_pressed)
|
||||
UI.connect("load_slot_pressed", self._on_load_slot_pressed)
|
||||
UI.connect("main_menu_pressed", self._on_main_menu_pressed)
|
||||
title_screen.new_game_pressed.connect(self._on_new_game_pressed)
|
||||
UI.save_slot_pressed.connect(self._on_save_slot_pressed)
|
||||
UI.load_slot_pressed.connect(self._on_load_slot_pressed)
|
||||
UI.main_menu_pressed.connect(self._on_main_menu_pressed)
|
||||
|
||||
UI.connect("text_value_changed", self._on_text_value_changed)
|
||||
UI.connect("auto_value_changed", self._on_auto_value_changed)
|
||||
UI.text_value_changed.connect(self._on_text_value_changed)
|
||||
UI.auto_value_changed.connect(self._on_auto_value_changed)
|
||||
|
||||
UI.its_game_over.back_to_menu.pressed.connect(self._on_main_menu_pressed)
|
||||
|
||||
@@ -83,7 +83,7 @@ func play_intro():
|
||||
func start_day():
|
||||
|
||||
#Hiding Menu for cinematic impact
|
||||
UI.get_node("UI/UpperContainer").hide()
|
||||
UI.pause_menu.menu_button.hide()
|
||||
|
||||
#Transitioning to day screen
|
||||
$TextScreens/Day.text = "[center]DAY " + str(Globals.day_count) + "[/center]"
|
||||
@@ -104,7 +104,7 @@ func start_day():
|
||||
|
||||
#Transitioning to the screening desk
|
||||
scenes_to_hide = scenes_to_show
|
||||
scenes_to_show = [$ScreeningDesk, UI, UI.get_node("UI/UpperContainer")]
|
||||
scenes_to_show = [$ScreeningDesk, UI.pause_menu.menu_button]
|
||||
UI.masks.transition(scenes_to_hide, scenes_to_show)
|
||||
await UI.masks.transition_finished
|
||||
|
||||
@@ -145,12 +145,12 @@ func save_game(save_slot_number:int):
|
||||
print("Failed to open file for saving.")
|
||||
|
||||
#Updating save/load slots information
|
||||
var save_slot_path = "UI/Save/MarginContainer/VBoxContainer/SaveSlot" + str(save_slot_number)
|
||||
var load_slot_path = "UI/Load/MarginContainer/VBoxContainer/LoadSlot" + str(save_slot_number)
|
||||
var save_slot_path = "Menu/Save/MarginContainer/VBoxContainer/SaveSlot" + str(save_slot_number)
|
||||
var load_slot_path = "Menu/Load/MarginContainer/VBoxContainer/LoadSlot" + str(save_slot_number)
|
||||
var save_slot = UI.get_node(save_slot_path)
|
||||
var load_slot = UI.get_node(load_slot_path)
|
||||
|
||||
save_slot.text = "DAY " + str(save_data["day_count"]) + ", FLOOR " + str(save_data["floor_count"]) + "\nSAVE DATE : " + str(save_data["save_date"])
|
||||
save_slot.text = "FLOOR " + str(save_data["floor_count"]) + "\nSAVE DATE : " + str(save_data["save_date"])
|
||||
load_slot.text = save_slot.text
|
||||
|
||||
|
||||
@@ -162,10 +162,8 @@ func load_game(load_slot_number:int):
|
||||
clear_balloon()
|
||||
|
||||
#Hiding loading menus and masks
|
||||
UI.masks.mask.visible = false
|
||||
UI.get_node("UI/Menu").hide()
|
||||
UI.get_node("UI/UpperContainer").hide()
|
||||
UI.get_node("UI/Load").hide()
|
||||
UI.masks.mask.hide()
|
||||
UI.pause_menu.reset()
|
||||
|
||||
#Opening save file
|
||||
var file = FileAccess.open("res://Saves/save_" + str(load_slot_number) + ".json", FileAccess.READ)
|
||||
@@ -213,8 +211,8 @@ func _on_main_menu_pressed():
|
||||
clear_balloon()
|
||||
|
||||
#Hiding menus
|
||||
UI.get_node("UI/Menu").hide()
|
||||
UI.get_node("UI/UpperContainer").hide()
|
||||
UI.get_node("Menu/Menu").hide()
|
||||
UI.get_node("Menu/UpperContainer").hide()
|
||||
|
||||
#Going back to main menu
|
||||
var scenes_to_hide = [$ScreeningDesk, $TextScreens, $TextScreens/Day, UI.its_game_over]
|
||||
@@ -232,13 +230,11 @@ func _on_main_menu_pressed():
|
||||
func update_slots():
|
||||
|
||||
#Loops over the 4 save/load slots
|
||||
for save_number in range(1, 5):
|
||||
for save_number in range(1, Globals.save_slot_count + 1):
|
||||
|
||||
#Retrieves save and load slots
|
||||
var save_slot_path = "UI/Save/MarginContainer/VBoxContainer/SaveSlot" + str(save_number)
|
||||
var load_slot_path = "UI/Load/MarginContainer/VBoxContainer/LoadSlot" + str(save_number)
|
||||
var save_slot = UI.get_node(save_slot_path)
|
||||
var load_slot = UI.get_node(load_slot_path)
|
||||
var save_slot = UI.pause_menu.save.save_slot[save_number]
|
||||
var load_slot = UI.pause_menu.load.load_slot[save_number]
|
||||
|
||||
#Retrieves save path
|
||||
var save_path = "res://Saves/save_" + str(save_number) + ".json"
|
||||
@@ -252,7 +248,7 @@ func update_slots():
|
||||
if typeof(load_data) == 27: #Checks if loaded data is a Dictionary
|
||||
#Updates save and load slots texts
|
||||
print("Initializing save slot #" + str(save_number) + " : " + str(load_data))
|
||||
save_slot.text = "DAY " + str(load_data["day_count"]) + ", FLOOR " + str(load_data["floor_count"]) + "\nSAVE DATE : " + str(load_data["save_date"])
|
||||
save_slot.text = "FLOOR " + str(load_data["floor_count"]) + "\nSAVE DATE : " + str(load_data["save_date"])
|
||||
load_slot.text = save_slot.text
|
||||
else:
|
||||
print("Failed to parse Loading Data.")
|
||||
|
||||
Reference in New Issue
Block a user