Files
imnotsick/main_hub.gd
T
2025-06-12 00:35:23 +02:00

109 lines
3.1 KiB
GDScript

extends Control
@export var TitleScreen: PackedScene
@export var ScreeningDesk: PackedScene
@export var Bedroom: PackedScene
@export var TextScreens: PackedScene
@export var DialogueScreens: PackedScene
var dialogue_intro = load("res://Dialogues/intro.dialogue")
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
#Adding Scenes
var title_screen = TitleScreen.instantiate()
var screening_desk = ScreeningDesk.instantiate()
var bedroom = Bedroom.instantiate()
var text_screens = TextScreens.instantiate()
var dialogue_screens = DialogueScreens.instantiate()
add_child(title_screen)
add_child(screening_desk)
add_child(bedroom)
add_child(text_screens)
add_child(dialogue_screens)
#Naming Scenes
title_screen.name = "TitleScreen"
screening_desk.name = "ScreeningDesk"
bedroom.name = "Bedroom"
text_screens.name = "TextScreens"
dialogue_screens.name = "DialogueScreens"
#Showing TitleScreen
title_screen.show()
#Connecting Signals
title_screen.connect("new_game_pressed", _on_new_game_pressed)
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
# Starts a new game
func _on_new_game_pressed():
#Offering to skip Introduction
UI.confirmation_text.text = "[center]Do you wish to skip the introduction ?[/center]"
UI.confirmation_yes.pressed.connect(skip_intro, CONNECT_ONE_SHOT)
UI.confirmation_no.pressed.connect(play_intro, CONNECT_ONE_SHOT)
UI.confirmation_dialog.show()
TransitionScreen.mask.visible = true
#Skips the introduction
func skip_intro():
#Disconnecting the other Signal from the Confirmation Dialogue
UI.confirmation_no.disconnect("pressed", play_intro)
#Transitioning to Screening Desk
TransitionScreen.transition("big", [$TitleScreen], [$ScreeningDesk, UI, UI.get_node("UI/UpperContainer")])
await TransitionScreen.transition_finished
#Launching the gameplay loop
$ScreeningDesk.gameplay_loop("564")
#Plays the entire introduction
func play_intro():
#Disconnecting the other Signal from the Confirmation Dialogue
UI.confirmation_yes.disconnect("pressed", skip_intro)
#Introduction First slides
var text_container = $TextScreens/MarginContainer/IntroBoxContainer/TextContainer
TransitionScreen.transition("big", [$TitleScreen], [$TextScreens, text_container.get_child(0), UI, UI.get_node("UI/SkipContainer")])
await UI.next_slide
for i in 4:
TransitionScreen.transition("small", [text_container.get_child(i)], [text_container.get_child(i+1)])
await UI.next_slide
#Dialogue in the Meeting Room
TransitionScreen.transition("big", [$TextScreens, text_container.get_child(4), UI, UI.get_node("UI/SkipContainer")], [$DialogueScreens])
await TransitionScreen.transition_finished
DialogueManager.show_dialogue_balloon(dialogue_intro, "start")
await DialogueManager.dialogue_ended
#Transitioning to the Screening Desk
TransitionScreen.transition("big", [$DialogueScreens], [$ScreeningDesk, UI, UI.get_node("UI/UpperContainer")])
await TransitionScreen.transition_finished
#Launching the gameplay loop
$ScreeningDesk.gameplay_loop("564")