From 25157165916cecc76e36566fbf33db14baa315b6 Mon Sep 17 00:00:00 2001 From: Fujita Date: Mon, 16 Jun 2025 01:12:48 +0200 Subject: [PATCH] small changes --- Dialogues/{balloon.tscn => balloon_big.tscn} | 28 +++++++++--------- bedroom.gd | 6 ---- current_patient.gd | 6 ---- dialogue_screens.gd | 25 ++++++++++++++-- globals.gd | 6 ---- main_hub.gd | 30 +++++++++++++------- project.godot | 2 +- screening_desk.gd | 23 +++++++++------ text_screens.gd | 10 ++----- title_screen.gd | 15 ++++------ transition_screen.gd | 11 +++++-- transition_screen.tscn | 2 -- ui.gd | 9 ------ 13 files changed, 86 insertions(+), 87 deletions(-) rename Dialogues/{balloon.tscn => balloon_big.tscn} (87%) diff --git a/Dialogues/balloon.tscn b/Dialogues/balloon_big.tscn similarity index 87% rename from Dialogues/balloon.tscn rename to Dialogues/balloon_big.tscn index ac33f56..51beefa 100644 --- a/Dialogues/balloon.tscn +++ b/Dialogues/balloon_big.tscn @@ -1,10 +1,10 @@ [gd_scene load_steps=11 format=3 uid="uid://bh0e0uhmtk0ck"] -[ext_resource type="Script" path="res://Dialogues/balloon.gd" id="1_36de5"] -[ext_resource type="PackedScene" uid="uid://ckvgyvclnwggo" path="res://addons/dialogue_manager/dialogue_label.tscn" id="2_a8ve6"] -[ext_resource type="FontFile" uid="uid://mi5v1uq78g7o" path="res://Art/XanhMono-Italic.ttf" id="2_qju6n"] -[ext_resource type="FontFile" uid="uid://ckg5x0oonnjtn" path="res://Art/XanhMono-Regular.ttf" id="3_66oah"] -[ext_resource type="Script" path="res://addons/dialogue_manager/dialogue_reponses_menu.gd" id="3_72ixx"] +[ext_resource type="Script" path="res://Dialogues/balloon.gd" id="1_trhxk"] +[ext_resource type="FontFile" uid="uid://mi5v1uq78g7o" path="res://Art/XanhMono-Italic.ttf" id="2_8uhga"] +[ext_resource type="PackedScene" uid="uid://ckvgyvclnwggo" path="res://addons/dialogue_manager/dialogue_label.tscn" id="3_ek02p"] +[ext_resource type="FontFile" uid="uid://ckg5x0oonnjtn" path="res://Art/XanhMono-Regular.ttf" id="4_ovm88"] +[ext_resource type="Script" path="res://addons/dialogue_manager/dialogue_reponses_menu.gd" id="5_s4c7i"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_spyqn"] bg_color = Color(0, 0, 0, 1) @@ -67,7 +67,7 @@ Panel/styles/panel = SubResource("StyleBoxFlat_uy0d5") [node name="ExampleBalloon" type="CanvasLayer"] layer = 100 -script = ExtResource("1_36de5") +script = ExtResource("1_trhxk") [node name="Balloon" type="Control" parent="."] unique_name_in_owner = true @@ -107,22 +107,22 @@ unique_name_in_owner = true modulate = Color(1, 1, 1, 0.501961) layout_mode = 2 mouse_filter = 1 -theme_override_fonts/normal_font = ExtResource("2_qju6n") +theme_override_fonts/normal_font = ExtResource("2_8uhga") theme_override_font_sizes/normal_font_size = 25 bbcode_enabled = true text = "Character" fit_content = true scroll_active = false -[node name="DialogueLabel" parent="Balloon/Panel/Dialogue/VBoxContainer" instance=ExtResource("2_a8ve6")] +[node name="DialogueLabel" parent="Balloon/Panel/Dialogue/VBoxContainer" instance=ExtResource("3_ek02p")] unique_name_in_owner = true layout_mode = 2 size_flags_vertical = 3 -theme_override_fonts/normal_font = ExtResource("3_66oah") -theme_override_fonts/mono_font = ExtResource("3_66oah") -theme_override_fonts/italics_font = ExtResource("2_qju6n") -theme_override_fonts/bold_italics_font = ExtResource("2_qju6n") -theme_override_fonts/bold_font = ExtResource("3_66oah") +theme_override_fonts/normal_font = ExtResource("4_ovm88") +theme_override_fonts/mono_font = ExtResource("4_ovm88") +theme_override_fonts/italics_font = ExtResource("2_8uhga") +theme_override_fonts/bold_italics_font = ExtResource("2_8uhga") +theme_override_fonts/bold_font = ExtResource("4_ovm88") theme_override_font_sizes/bold_italics_font_size = 30 theme_override_font_sizes/italics_font_size = 30 theme_override_font_sizes/mono_font_size = 30 @@ -149,7 +149,7 @@ unique_name_in_owner = true layout_mode = 2 size_flags_vertical = 8 theme_override_constants/separation = 2 -script = ExtResource("3_72ixx") +script = ExtResource("5_s4c7i") response_template = NodePath("ResponseExample") [node name="ResponseExample" type="Button" parent="Balloon/Responses/ResponsesMenu"] diff --git a/bedroom.gd b/bedroom.gd index 982056e..76fd58b 100644 --- a/bedroom.gd +++ b/bedroom.gd @@ -4,9 +4,3 @@ extends Control # Called when the node enters the scene tree for the first time. func _ready() -> void: self.hide() - pass # Replace with function body. - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: - pass diff --git a/current_patient.gd b/current_patient.gd index 49e1bcb..ec43588 100644 --- a/current_patient.gd +++ b/current_patient.gd @@ -22,9 +22,3 @@ func build_dialog_tree(tree_model: Array[int]) -> Dictionary: tree.merge(branch) return tree - - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: - pass diff --git a/dialogue_screens.gd b/dialogue_screens.gd index 7865b6e..574fdf3 100644 --- a/dialogue_screens.gd +++ b/dialogue_screens.gd @@ -1,5 +1,6 @@ extends Control +var balloon: Node # Called when the node enters the scene tree for the first time. func _ready() -> void: @@ -7,6 +8,24 @@ func _ready() -> void: -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: - pass +func start_balloon(dialogue_resource: Resource, start_title: String): + + #Freeing Previous Balloon and Disconnecting DialogueManager signals + clean_balloon() + + #Instantiating a custom balloon + var balloon_path = "res://Dialogues/balloon_big.tscn" + var Balloon: Resource = load(balloon_path) + balloon = Balloon.instantiate() + get_tree().current_scene.add_child(balloon) + + #Starting dialogue + balloon.start(dialogue_resource, start_title) + + + +func clean_balloon(): + + #Freeing Previous Balloon + if is_instance_valid(balloon): + balloon.queue_free() diff --git a/globals.gd b/globals.gd index a792529..be33eeb 100644 --- a/globals.gd +++ b/globals.gd @@ -21,9 +21,3 @@ func get_save_date() -> String: dt.month, dt.day, dt.year, dt.hour, dt.minute ] - - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: - pass diff --git a/main_hub.gd b/main_hub.gd index f998da9..d7f1301 100644 --- a/main_hub.gd +++ b/main_hub.gd @@ -6,6 +6,9 @@ extends Control @export var TextScreens: PackedScene @export var DialogueScreens: PackedScene +var balloon: Node + + # Called when the node enters the scene tree for the first time. func _ready() -> void: @@ -45,12 +48,6 @@ func _ready() -> void: -# 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(): Globals.day_count = 1 @@ -76,7 +73,7 @@ func play_intro(): TransitionScreen.transition("big", [$TextScreens, $TextScreens/MarginContainer, text_container.get_child(4), UI, UI.get_node("UI/SkipContainer")], [$DialogueScreens]) await TransitionScreen.transition_finished - DialogueManager.show_dialogue_balloon(Globals.dialogue_intro, "start") + $DialogueScreens.start_balloon(Globals.dialogue_intro, "start") await DialogueManager.dialogue_ended #Starting the day @@ -115,7 +112,7 @@ func _on_recovery_pressed(): await TransitionScreen.transition_finished #End of day dialogue - DialogueManager.show_dialogue_balloon(Globals.dialogue_recovery, "end_of_day_" + str(Globals.day_count)) + $DialogueScreens.start_balloon(Globals.dialogue_recovery, "end_of_day_" + str(Globals.day_count)) await DialogueManager.dialogue_ended #Start of the next day @@ -160,11 +157,16 @@ func save_game(save_slot_number:int): #Loads save file from the selected load slot func load_game(load_slot_number:int): + #CLeaning balloons + $DialogueScreens.clean_balloon() + $ScreeningDesk.clean_balloon() + #Hiding loading menus and masks TransitionScreen.mask.visible = false + UI.get_node("UI/Menu").hide() + UI.get_node("UI/UpperContainer").hide() UI.get_node("UI/Load").hide() UI.get_node("UI/LoadTitle").hide() - UI.get_node("UI/Menu").hide() #Opening save file var file = FileAccess.open("res://Saves/save_" + str(load_slot_number) + ".json", FileAccess.READ) @@ -202,10 +204,16 @@ func _on_load_slot_pressed(load_slot): func _on_main_menu_pressed(): - #Hiding menu + #Removing mask + TransitionScreen.mask.visible = false + + #Cleaning balloons + $DialogueScreens.clean_balloon() + $ScreeningDesk.clean_balloon() + + #Hiding menus UI.get_node("UI/Menu").hide() UI.get_node("UI/UpperContainer").hide() - TransitionScreen.mask.visible = false #Going back to main menu var scenes_to_hide = [$ScreeningDesk, $Bedroom, $TextScreens, $TextScreens/Day, $ScreeningDesk.patient_controls, $ScreeningDesk.end_of_day_controls, $ScreeningDesk.patient_texture, $ScreeningDesk.panel_container, $ScreeningDesk.face_zoom] + $ScreeningDesk.margin_container.get_children() diff --git a/project.godot b/project.godot index b20dc53..7cbd853 100644 --- a/project.godot +++ b/project.godot @@ -24,7 +24,7 @@ CurrentPatient="*res://current_patient.gd" [dialogue_manager] -general/balloon_path="res://Dialogues/balloon.tscn" +general/balloon_path="res://Dialogues/balloon_big.tscn" [display] diff --git a/screening_desk.gd b/screening_desk.gd index 54b0332..2647e41 100644 --- a/screening_desk.gd +++ b/screening_desk.gd @@ -93,6 +93,7 @@ func new_patient(patient_id): +#Show patient file func _on_patient_file_pressed(): for node in margin_container.get_children(): @@ -103,6 +104,7 @@ func _on_patient_file_pressed(): +#Show guidebook func _on_guidebook_pressed(): for node in margin_container.get_children(): @@ -113,6 +115,7 @@ func _on_guidebook_pressed(): +#Brings in next patient func _on_call_next_patient_pressed(): #Hiding and Showing appropriate scenes @@ -126,6 +129,7 @@ func _on_call_next_patient_pressed(): +#Shows patient recording func _on_patient_recording_pressed(): for node in margin_container.get_children(): @@ -136,6 +140,7 @@ func _on_patient_recording_pressed(): +#Records the dialogues func _recording_text(dialogue_line): var line = dialogue_line.text @@ -151,11 +156,12 @@ func _recording_text(dialogue_line): else : character_colour = "[color=darkred]" patient_recording.append_text(character_colour + character + "[/color]\n") - + patient_recording.append_text(line) +#Show face zoom func _on_examine_pressed(): for node in margin_container.get_children(): @@ -165,6 +171,7 @@ func _on_examine_pressed(): +#Change emotions following dialogue tags func _change_emotion(dialogue_line) -> void: var line_tag = dialogue_line.tags @@ -178,6 +185,7 @@ func _change_emotion(dialogue_line) -> void: func _on_containment_pressed(): + #Ask for confirmation var lambda = func(): clear_patient("containment") var choice_text = "[center]Do you really want to send this patient to [color=darkred]Containment[/color] ?[/center]" @@ -187,6 +195,7 @@ func _on_containment_pressed(): func _on_psych_ward_pressed(): + #Ask for confirmation var lambda = func(): clear_patient("psych_ward") var choice_text = "[center]Do you really want to send this patient to the [color=darkgreen]Psych Ward[/color] ?[/center]" @@ -194,6 +203,7 @@ func _on_psych_ward_pressed(): +#Starting dialogue func start_balloon(dialogue_resource: Resource, start_title: String): #Freeing Previous Balloon and Disconnecting DialogueManager signals @@ -211,6 +221,7 @@ func start_balloon(dialogue_resource: Resource, start_title: String): +#Clears patient and transitions towards next patient or end of day func clear_patient(choice:String): #Hiding Patient Controls and showing Patient Face @@ -234,7 +245,7 @@ func clear_patient(choice:String): TransitionScreen.transition("big", scenes_to_hide, scenes_to_show) await TransitionScreen.transition_finished - + if Globals.patient_count < Globals.daily_patient_limit: #Setting Up Next Patient new_patient("564") @@ -254,6 +265,7 @@ func _on_recovery_pressed(): +#Cleaning balloon func clean_balloon(): #Freeing Previous Balloon and Disconnecting DialogueManager signals @@ -263,10 +275,3 @@ func clean_balloon(): DialogueManager.disconnect("got_dialogue", _change_emotion) if DialogueManager.is_connected("got_dialogue", _recording_text): DialogueManager.disconnect("got_dialogue", _recording_text) - - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: - pass - diff --git a/text_screens.gd b/text_screens.gd index e0dbc90..fa6a446 100644 --- a/text_screens.gd +++ b/text_screens.gd @@ -6,16 +6,10 @@ extends CanvasLayer # Called when the node enters the scene tree for the first time. func _ready() -> void: - + + #Hiding everything self.hide() for node in intro_text_container.get_children(): node.hide() $MarginContainer/IntroBoxContainer/Header.hide() - $Day.hide() - - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: - pass diff --git a/title_screen.gd b/title_screen.gd index a21f88f..cff596e 100644 --- a/title_screen.gd +++ b/title_screen.gd @@ -1,30 +1,25 @@ extends CanvasLayer signal new_game_pressed -signal load_pressed signal settings_pressed # Called when the node enters the scene tree for the first time. func _ready() -> void: + + #Connecting signals $TitleScreen/MenuContainer/NewGame.pressed.connect(_on_new_game_pressed) $TitleScreen/MenuContainer/Load.pressed.connect(_on_load_pressed) $TitleScreen/MenuContainer/Settings.pressed.connect(_on_settings_pressed) $TitleScreen/MenuContainer/QuitGame.pressed.connect(_on_quit_game_pressed) + + #Hiding everything self.hide() - pass - - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: - pass func _on_new_game_pressed() -> void: new_game_pressed.emit() - print("Starting New Game...") @@ -33,9 +28,9 @@ func _on_load_pressed(): TransitionScreen.mask.visible = true + func _on_settings_pressed() -> void: settings_pressed.emit() - pass diff --git a/transition_screen.gd b/transition_screen.gd index 2e766f4..05dce65 100644 --- a/transition_screen.gd +++ b/transition_screen.gd @@ -14,20 +14,26 @@ signal transition_finished # Called when the node enters the scene tree for the first time. func _ready() -> void: + #Hiding masks big_fading.visible = false small_fading.visible = false mask.visible = false + + #Connecting signals big_animation.connect("animation_finished", _on_animation_finished) small_animation.connect("animation_finished", _on_animation_finished) func _on_animation_finished(anim_name): + + #Fades back to normal when fade_to_black is done if anim_name == "fade_to_black": fading_finished.emit() big_animation.play("fade_to_normal") small_animation.play("fade_to_normal") - + + #Resets everything when fading_to_normal is done elif anim_name == "fade_to_normal": transition_finished.emit() Globals.is_transitioning = false @@ -53,10 +59,11 @@ func fading(size): #Transitions the scenes func transition(fading_screen_size, scenes_to_hide, scenes_to_show): + #Fade in and out fading(fading_screen_size) - await self.fading_finished + #When the screen is black from fading, change the shown scenes before it fades back to normal for scene in scenes_to_hide: scene.hide() for scene in scenes_to_show: diff --git a/transition_screen.tscn b/transition_screen.tscn index 8fd41d2..ef2a9b6 100644 --- a/transition_screen.tscn +++ b/transition_screen.tscn @@ -19,7 +19,6 @@ tracks/0/keys = { [sub_resource type="Animation" id="Animation_20bx3"] resource_name = "fade_to_black" -length = 2.0 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true @@ -35,7 +34,6 @@ tracks/0/keys = { [sub_resource type="Animation" id="Animation_in743"] resource_name = "fade_to_normal" -length = 2.0 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true diff --git a/ui.gd b/ui.gd index cd24d27..5c2004d 100644 --- a/ui.gd +++ b/ui.gd @@ -204,12 +204,3 @@ func _on_load_slot_pressed(load_slot_number: int): ask_confirmation(lambda, Callable(), choice_text) else: pass - - - - - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: - pass