diff --git a/autoloads/signal_manager.gd b/autoloads/signal_manager.gd index 32e012b..80b5ad4 100644 --- a/autoloads/signal_manager.gd +++ b/autoloads/signal_manager.gd @@ -2,8 +2,10 @@ extends Node -#signal pause_game +signal pause_game signal resume_game +signal hide_ui +signal show_ui signal open_pause_menu signal close_pause_menu diff --git a/resources/game_settings/game_options_settings_resource.tres b/resources/game_settings/game_options_settings_resource.tres index 24c323d..0bab8c6 100644 --- a/resources/game_settings/game_options_settings_resource.tres +++ b/resources/game_settings/game_options_settings_resource.tres @@ -6,4 +6,8 @@ script = ExtResource("1_wnf6r") enable_waila = true enable_block_highlight = true +enable_quickslots_ui = true +enable_held_block = true +enable_save_screenshots = true +enable_autosaves = true metadata/_custom_type_script = "uid://7yv740somgqf" diff --git a/resources/pause_menu_theme.tres b/resources/pause_menu_theme.tres index af3d5d8..af1ee3e 100644 --- a/resources/pause_menu_theme.tres +++ b/resources/pause_menu_theme.tres @@ -4,3 +4,5 @@ Button/colors/font_color = Color(0.839216, 0.933333, 1, 1) Button/constants/outline_size = 2 Button/font_sizes/font_size = 20 +MenuTitle/base_type = &"Label" +MenuTitle/font_sizes/font_size = 40 diff --git a/scenes/player/player.gd b/scenes/player/player.gd index 5bd4c6c..3ef9d0d 100644 --- a/scenes/player/player.gd +++ b/scenes/player/player.gd @@ -58,6 +58,8 @@ func _ready() -> void: InventoryManager.quick_slot_item_changed.connect(_on_quick_slot_item_changed) SignalManager.resume_game.connect(_on_resume_game) SignalManager.open_pause_menu.connect(_on_open_pause_menu) + SignalManager.hide_ui.connect(_on_hide_ui) + SignalManager.show_ui.connect(_on_show_ui) _update_held_block_mesh(InventoryManager.quick_slot_item_id) @@ -150,3 +152,10 @@ func _on_open_pause_menu() -> void: func _on_resume_game() -> void: block_mesh.visible = GameSettingsManager.settings.game_options.enable_held_block + + +func _on_hide_ui() -> void: + block_mesh.visible = false + +func _on_show_ui() -> void: + block_mesh.visible = true and GameSettingsManager.settings.game_options.enable_held_block diff --git a/scenes/ui/menus/pause_menu.gd b/scenes/ui/menus/pause_menu.gd deleted file mode 100644 index 921b179..0000000 --- a/scenes/ui/menus/pause_menu.gd +++ /dev/null @@ -1,32 +0,0 @@ -class_name PauseMenu -extends Panel - -@export var save_load_ui: SaveLoadUI - - -func _unhandled_input(event: InputEvent) -> void: - if event.is_action_pressed("ui_cancel") and self.visible: - hide_menu() - elif event.is_action_pressed("ui_cancel") and !self.visible: - show_menu() - - -func hide_menu() -> void: - SignalManager.close_pause_menu.emit() - -func show_menu() -> void: - SignalManager.open_pause_menu.emit() - - -# Signals -func _on_exit_game_button_pressed() -> void: - get_tree().quit() - -func _on_resume_button_pressed() -> void: - hide_menu() - -func _on_settings_button_pressed() -> void: - SignalManager.open_settings_menu.emit() - -func _on_saves_button_pressed() -> void: - save_load_ui.open_save_list.emit() diff --git a/scenes/ui/menus/pause_menu.gd.uid b/scenes/ui/menus/pause_menu.gd.uid deleted file mode 100644 index 9c7340d..0000000 --- a/scenes/ui/menus/pause_menu.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://d3ysjgxxmyqpw diff --git a/scenes/ui/menus/pause_menu.tscn b/scenes/ui/menus/pause_menu.tscn deleted file mode 100644 index 9b7974f..0000000 --- a/scenes/ui/menus/pause_menu.tscn +++ /dev/null @@ -1,75 +0,0 @@ -[gd_scene load_steps=3 format=3 uid="uid://bopvfwcgnnawg"] - -[ext_resource type="Theme" uid="uid://b5q8b0l6qp1dt" path="res://resources/pause_menu_theme.tres" id="1_6tw0m"] -[ext_resource type="Script" uid="uid://d3ysjgxxmyqpw" path="res://scenes/ui/menus/pause_menu.gd" id="2_0lmf7"] - -[node name="PauseMenu" type="Panel"] -process_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -theme = ExtResource("1_6tw0m") -script = ExtResource("2_0lmf7") - -[node name="Background" type="ColorRect" parent="."] -custom_minimum_size = Vector2(400, 0) -layout_mode = 1 -anchors_preset = 13 -anchor_left = 0.5 -anchor_right = 0.5 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -color = Color(0.192157, 0.239216, 0.352941, 1) - -[node name="MarginContainer" type="MarginContainer" parent="Background"] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -theme_override_constants/margin_left = 10 -theme_override_constants/margin_top = 10 -theme_override_constants/margin_right = 10 -theme_override_constants/margin_bottom = 10 - -[node name="MenuContainer" type="VBoxContainer" parent="Background/MarginContainer"] -layout_mode = 2 -size_flags_horizontal = 4 -theme_override_constants/separation = 20 - -[node name="Title" type="Label" parent="Background/MarginContainer/MenuContainer"] -layout_mode = 2 -theme_override_font_sizes/font_size = 40 -text = "Paused" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="ButtonsContainer" type="VBoxContainer" parent="Background/MarginContainer/MenuContainer"] -layout_mode = 2 -size_flags_vertical = 6 -theme_override_constants/separation = 20 - -[node name="ResumeButton" type="Button" parent="Background/MarginContainer/MenuContainer/ButtonsContainer"] -layout_mode = 2 -text = "Resume" - -[node name="SavesButton" type="Button" parent="Background/MarginContainer/MenuContainer/ButtonsContainer"] -layout_mode = 2 -text = "Saves" - -[node name="SettingsButton" type="Button" parent="Background/MarginContainer/MenuContainer/ButtonsContainer"] -layout_mode = 2 -text = "Settings" - -[node name="ExitGameButton" type="Button" parent="Background/MarginContainer/MenuContainer/ButtonsContainer"] -layout_mode = 2 -text = "Exit Game" - -[connection signal="pressed" from="Background/MarginContainer/MenuContainer/ButtonsContainer/ResumeButton" to="." method="_on_resume_button_pressed"] -[connection signal="pressed" from="Background/MarginContainer/MenuContainer/ButtonsContainer/SavesButton" to="." method="_on_saves_button_pressed"] -[connection signal="pressed" from="Background/MarginContainer/MenuContainer/ButtonsContainer/SettingsButton" to="." method="_on_settings_button_pressed"] -[connection signal="pressed" from="Background/MarginContainer/MenuContainer/ButtonsContainer/ExitGameButton" to="." method="_on_exit_game_button_pressed"] diff --git a/scenes/ui/menus/saves_manager/save_load_ui.gd.uid b/scenes/ui/menus/saves_manager/save_load_ui.gd.uid deleted file mode 100644 index d3bf6a0..0000000 --- a/scenes/ui/menus/saves_manager/save_load_ui.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://b6831eygibii7 diff --git a/scenes/ui/menus/saves_manager/save_load_ui.tscn b/scenes/ui/menus/saves_manager/save_load_ui.tscn deleted file mode 100644 index 0e70e6c..0000000 --- a/scenes/ui/menus/saves_manager/save_load_ui.tscn +++ /dev/null @@ -1,133 +0,0 @@ -[gd_scene load_steps=7 format=3 uid="uid://dauchkhmnyk7n"] - -[ext_resource type="Script" uid="uid://b6831eygibii7" path="res://scenes/ui/menus/saves_manager/save_load_ui.gd" id="1_lo08d"] -[ext_resource type="PackedScene" uid="uid://cyxieflejsggu" path="res://scenes/ui/menus/saves_manager/save_files_list.tscn" id="1_tqtxm"] -[ext_resource type="PackedScene" uid="uid://bb7poutsn4ex2" path="res://scenes/ui/menus/saves_manager/save_file.tscn" id="2_6uxbh"] -[ext_resource type="Texture2D" uid="uid://ja8bc1h5x85o" path="res://assets/ui/save-normal.png" id="3_lo08d"] -[ext_resource type="Texture2D" uid="uid://crqgyft4gfilt" path="res://assets/ui/save-pressed.png" id="4_md7la"] -[ext_resource type="Texture2D" uid="uid://o3l0j53mgkan" path="res://assets/ui/save-hover.png" id="5_hmxxn"] - -[node name="SaveLoadUI" type="Control" node_paths=PackedStringArray("show_save_ui_button", "new_save_ui", "save_name_input", "create_save_button", "create_save_cancel_button")] -process_mode = 3 -layout_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -size_flags_horizontal = 6 -size_flags_vertical = 4 -script = ExtResource("1_lo08d") -show_save_ui_button = NodePath("Panel/MarginContainer/VBoxContainer/BottomRow/SaveButton") -new_save_ui = NodePath("Panel/NewSaveUI") -save_name_input = NodePath("Panel/NewSaveUI/MarginContainer/VBoxContainer/SaveNameInput") -create_save_button = NodePath("Panel/NewSaveUI/MarginContainer/VBoxContainer/SaveButton") -create_save_cancel_button = NodePath("Panel/NewSaveUI/MarginContainer/VBoxContainer/CancelButton") - -[node name="Panel" type="Panel" parent="."] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 - -[node name="MarginContainer" type="MarginContainer" parent="Panel"] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -theme_override_constants/margin_left = 20 -theme_override_constants/margin_top = 20 -theme_override_constants/margin_right = 20 -theme_override_constants/margin_bottom = 20 - -[node name="VBoxContainer" type="VBoxContainer" parent="Panel/MarginContainer"] -layout_mode = 2 - -[node name="Label" type="Label" parent="Panel/MarginContainer/VBoxContainer"] -layout_mode = 2 -theme_override_font_sizes/font_size = 40 -text = "Save/Load Game" -horizontal_alignment = 1 - -[node name="ScrollContainer" type="ScrollContainer" parent="Panel/MarginContainer/VBoxContainer"] -custom_minimum_size = Vector2(0, 500) -layout_mode = 2 -horizontal_scroll_mode = 0 - -[node name="SaveFilesList" parent="Panel/MarginContainer/VBoxContainer/ScrollContainer" node_paths=PackedStringArray("save_load_ui") instance=ExtResource("1_tqtxm")] -layout_mode = 2 -size_flags_horizontal = 6 -save_load_ui = NodePath("../../../../..") - -[node name="SaveFilePanel" parent="Panel/MarginContainer/VBoxContainer/ScrollContainer/SaveFilesList" instance=ExtResource("2_6uxbh")] -layout_mode = 2 - -[node name="BottomRow" type="HBoxContainer" parent="Panel/MarginContainer/VBoxContainer"] -layout_mode = 2 -alignment = 1 - -[node name="SaveButton" type="TextureButton" parent="Panel/MarginContainer/VBoxContainer/BottomRow"] -clip_contents = true -custom_minimum_size = Vector2(32, 32) -layout_mode = 2 -tooltip_text = "New Save" -texture_normal = ExtResource("3_lo08d") -texture_pressed = ExtResource("4_md7la") -texture_hover = ExtResource("5_hmxxn") -ignore_texture_size = true -stretch_mode = 5 - -[node name="NewSaveUI" type="Panel" parent="Panel"] -visible = false -custom_minimum_size = Vector2(450, 100) -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 - -[node name="MarginContainer" type="MarginContainer" parent="Panel/NewSaveUI"] -layout_mode = 1 -anchors_preset = 8 -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -offset_left = -205.0 -offset_top = -29.5 -offset_right = 205.0 -offset_bottom = 29.5 -grow_horizontal = 2 -grow_vertical = 2 -theme_override_constants/margin_left = 5 -theme_override_constants/margin_top = 5 -theme_override_constants/margin_right = 5 -theme_override_constants/margin_bottom = 5 - -[node name="VBoxContainer" type="VBoxContainer" parent="Panel/NewSaveUI/MarginContainer"] -layout_mode = 2 -size_flags_horizontal = 4 -size_flags_vertical = 4 - -[node name="SaveNameLabel" type="Label" parent="Panel/NewSaveUI/MarginContainer/VBoxContainer"] -layout_mode = 2 -theme_override_font_sizes/font_size = 20 -text = "Create New Save" - -[node name="SaveNameInput" type="LineEdit" parent="Panel/NewSaveUI/MarginContainer/VBoxContainer"] -custom_minimum_size = Vector2(400, 0) -layout_mode = 2 -placeholder_text = "New Save File Name" - -[node name="SaveButton" type="Button" parent="Panel/NewSaveUI/MarginContainer/VBoxContainer"] -layout_mode = 2 -text = "Create Save" - -[node name="CancelButton" type="Button" parent="Panel/NewSaveUI/MarginContainer/VBoxContainer"] -layout_mode = 2 -text = "Cancel" diff --git a/scenes/ui/menus/settings_menu.gd.uid b/scenes/ui/menus/settings_menu.gd.uid deleted file mode 100644 index 9866805..0000000 --- a/scenes/ui/menus/settings_menu.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://37ftrpj14msn diff --git a/scenes/ui/menus/settings_menu.tscn b/scenes/ui/menus/settings_menu.tscn deleted file mode 100644 index 746ed71..0000000 --- a/scenes/ui/menus/settings_menu.tscn +++ /dev/null @@ -1,283 +0,0 @@ -[gd_scene load_steps=4 format=3 uid="uid://4bdgwwx27m71"] - -[ext_resource type="Script" uid="uid://37ftrpj14msn" path="res://scenes/ui/menus/settings_menu.gd" id="1_qwcqe"] -[ext_resource type="Theme" uid="uid://b5q8b0l6qp1dt" path="res://resources/pause_menu_theme.tres" id="2_mhswj"] - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_80b2v"] -content_margin_left = 10.0 -content_margin_top = 10.0 -content_margin_right = 10.0 -content_margin_bottom = 10.0 -bg_color = Color(0, 0, 0, 0.27451) -corner_radius_top_left = 2 -corner_radius_top_right = 2 -corner_radius_bottom_right = 2 -corner_radius_bottom_left = 2 - -[node name="SettingsMenu" type="Panel" node_paths=PackedStringArray("autosaves_input", "block_highlight_input", "held_block_ui_input", "quick_slots_ui_input", "screenshot_icon_input", "waila_input", "resolution_input", "fullscreen_input", "vsync_input", "fov_slider", "fov_value_label")] -process_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -script = ExtResource("1_qwcqe") -autosaves_input = NodePath("Background/MarginContainer/VBoxContainer/TabContainer/Game/Autosaves/CheckButton") -block_highlight_input = NodePath("Background/MarginContainer/VBoxContainer/TabContainer/Game/BlockHighlight/CheckButton") -held_block_ui_input = NodePath("Background/MarginContainer/VBoxContainer/TabContainer/Game/HeldBlockUI/CheckButton") -quick_slots_ui_input = NodePath("Background/MarginContainer/VBoxContainer/TabContainer/Game/QuickslotsUI/CheckButton") -screenshot_icon_input = NodePath("Background/MarginContainer/VBoxContainer/TabContainer/Game/ScreenshotIcon/CheckButton") -waila_input = NodePath("Background/MarginContainer/VBoxContainer/TabContainer/Game/Waila/CheckButton") -resolution_input = NodePath("Background/MarginContainer/VBoxContainer/TabContainer/Graphics/Resolution/OptionButton") -fullscreen_input = NodePath("Background/MarginContainer/VBoxContainer/TabContainer/Graphics/Fullscreen/CheckBox") -vsync_input = NodePath("Background/MarginContainer/VBoxContainer/TabContainer/Graphics/VSync/CheckBox") -fov_slider = NodePath("Background/MarginContainer/VBoxContainer/TabContainer/Graphics/FOV/HSlider") -fov_value_label = NodePath("Background/MarginContainer/VBoxContainer/TabContainer/Graphics/FOV/Value") -metadata/_edit_vertical_guides_ = [349.0] - -[node name="Background" type="ColorRect" parent="."] -custom_minimum_size = Vector2(400, 0) -layout_mode = 1 -anchors_preset = 13 -anchor_left = 0.5 -anchor_right = 0.5 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -color = Color(0.192157, 0.239216, 0.352941, 1) - -[node name="MarginContainer" type="MarginContainer" parent="Background"] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -theme_override_constants/margin_left = 10 -theme_override_constants/margin_top = 10 -theme_override_constants/margin_right = 10 -theme_override_constants/margin_bottom = 10 - -[node name="VBoxContainer" type="VBoxContainer" parent="Background/MarginContainer"] -layout_mode = 2 -size_flags_horizontal = 4 -theme_override_constants/separation = 20 - -[node name="Title" type="Label" parent="Background/MarginContainer/VBoxContainer"] -layout_mode = 2 -theme_override_font_sizes/font_size = 40 -text = "Settings" -horizontal_alignment = 1 - -[node name="TabContainer" type="TabContainer" parent="Background/MarginContainer/VBoxContainer"] -layout_mode = 2 -theme_override_constants/side_margin = 0 -theme_override_styles/panel = SubResource("StyleBoxFlat_80b2v") -current_tab = 0 -clip_tabs = false - -[node name="Game" type="VBoxContainer" parent="Background/MarginContainer/VBoxContainer/TabContainer"] -layout_mode = 2 -metadata/_tab_index = 0 - -[node name="BlockHighlight" type="HBoxContainer" parent="Background/MarginContainer/VBoxContainer/TabContainer/Game"] -layout_mode = 2 - -[node name="Label" type="Label" parent="Background/MarginContainer/VBoxContainer/TabContainer/Game/BlockHighlight"] -layout_mode = 2 -size_flags_horizontal = 3 -text = "Enable Block Highlighting" - -[node name="CheckButton" type="CheckButton" parent="Background/MarginContainer/VBoxContainer/TabContainer/Game/BlockHighlight"] -layout_mode = 2 -button_pressed = true - -[node name="Waila" type="HBoxContainer" parent="Background/MarginContainer/VBoxContainer/TabContainer/Game"] -layout_mode = 2 - -[node name="Label" type="Label" parent="Background/MarginContainer/VBoxContainer/TabContainer/Game/Waila"] -layout_mode = 2 -size_flags_horizontal = 3 -text = "Enable Waila" - -[node name="CheckButton" type="CheckButton" parent="Background/MarginContainer/VBoxContainer/TabContainer/Game/Waila"] -layout_mode = 2 -button_pressed = true - -[node name="QuickslotsUI" type="HBoxContainer" parent="Background/MarginContainer/VBoxContainer/TabContainer/Game"] -layout_mode = 2 - -[node name="Label" type="Label" parent="Background/MarginContainer/VBoxContainer/TabContainer/Game/QuickslotsUI"] -layout_mode = 2 -size_flags_horizontal = 3 -text = "Enable Quickslots UI" - -[node name="CheckButton" type="CheckButton" parent="Background/MarginContainer/VBoxContainer/TabContainer/Game/QuickslotsUI"] -layout_mode = 2 -button_pressed = true - -[node name="HeldBlockUI" type="HBoxContainer" parent="Background/MarginContainer/VBoxContainer/TabContainer/Game"] -layout_mode = 2 - -[node name="Label" type="Label" parent="Background/MarginContainer/VBoxContainer/TabContainer/Game/HeldBlockUI"] -layout_mode = 2 -size_flags_horizontal = 3 -text = "Enable Player Held Block" - -[node name="CheckButton" type="CheckButton" parent="Background/MarginContainer/VBoxContainer/TabContainer/Game/HeldBlockUI"] -layout_mode = 2 -button_pressed = true - -[node name="ScreenshotIcon" type="HBoxContainer" parent="Background/MarginContainer/VBoxContainer/TabContainer/Game"] -layout_mode = 2 - -[node name="Label" type="Label" parent="Background/MarginContainer/VBoxContainer/TabContainer/Game/ScreenshotIcon"] -layout_mode = 2 -size_flags_horizontal = 3 -tooltip_text = "Enable/Disable the taking of a screenshot to utilize as the save icon." -mouse_filter = 1 -text = "Enable Save Screenshot" - -[node name="CheckButton" type="CheckButton" parent="Background/MarginContainer/VBoxContainer/TabContainer/Game/ScreenshotIcon"] -layout_mode = 2 -tooltip_text = "Enable/Disable the taking of a screenshot to utilize as the save icon." -button_pressed = true - -[node name="Autosaves" type="HBoxContainer" parent="Background/MarginContainer/VBoxContainer/TabContainer/Game"] -layout_mode = 2 - -[node name="Label" type="Label" parent="Background/MarginContainer/VBoxContainer/TabContainer/Game/Autosaves"] -layout_mode = 2 -size_flags_horizontal = 3 -tooltip_text = "Enable/Disable the taking of a screenshot to utilize as the save icon." -mouse_filter = 1 -text = "Enable Autosaves" - -[node name="CheckButton" type="CheckButton" parent="Background/MarginContainer/VBoxContainer/TabContainer/Game/Autosaves"] -layout_mode = 2 -tooltip_text = "Enable/Disable the taking of a screenshot to utilize as the save icon." -button_pressed = true - -[node name="Graphics" type="VBoxContainer" parent="Background/MarginContainer/VBoxContainer/TabContainer"] -visible = false -layout_mode = 2 -metadata/_tab_index = 1 - -[node name="Resolution" type="HBoxContainer" parent="Background/MarginContainer/VBoxContainer/TabContainer/Graphics"] -layout_mode = 2 - -[node name="Label" type="Label" parent="Background/MarginContainer/VBoxContainer/TabContainer/Graphics/Resolution"] -layout_mode = 2 -size_flags_horizontal = 3 -text = "Resolution" - -[node name="OptionButton" type="OptionButton" parent="Background/MarginContainer/VBoxContainer/TabContainer/Graphics/Resolution"] -layout_mode = 2 -selected = 0 -item_count = 6 -popup/item_0/text = "1280x720" -popup/item_0/id = 0 -popup/item_1/text = "1280x800" -popup/item_1/id = 4 -popup/item_2/text = "1920x1080" -popup/item_2/id = 1 -popup/item_3/text = "2560x1440" -popup/item_3/id = 2 -popup/item_4/text = "3440x1440" -popup/item_4/id = 3 -popup/item_5/text = "3840 x 2160" -popup/item_5/id = 5 - -[node name="Fullscreen" type="HBoxContainer" parent="Background/MarginContainer/VBoxContainer/TabContainer/Graphics"] -layout_mode = 2 - -[node name="Label" type="Label" parent="Background/MarginContainer/VBoxContainer/TabContainer/Graphics/Fullscreen"] -layout_mode = 2 -size_flags_horizontal = 3 -text = "Fullscreen" - -[node name="CheckBox" type="CheckBox" parent="Background/MarginContainer/VBoxContainer/TabContainer/Graphics/Fullscreen"] -layout_mode = 2 - -[node name="VSync" type="HBoxContainer" parent="Background/MarginContainer/VBoxContainer/TabContainer/Graphics"] -layout_mode = 2 - -[node name="Label" type="Label" parent="Background/MarginContainer/VBoxContainer/TabContainer/Graphics/VSync"] -layout_mode = 2 -size_flags_horizontal = 3 -text = "VSync" - -[node name="CheckBox" type="CheckBox" parent="Background/MarginContainer/VBoxContainer/TabContainer/Graphics/VSync"] -layout_mode = 2 - -[node name="FOV" type="HBoxContainer" parent="Background/MarginContainer/VBoxContainer/TabContainer/Graphics"] -layout_mode = 2 - -[node name="Label" type="Label" parent="Background/MarginContainer/VBoxContainer/TabContainer/Graphics/FOV"] -layout_mode = 2 -size_flags_horizontal = 3 -text = "FOV" - -[node name="HSlider" type="HSlider" parent="Background/MarginContainer/VBoxContainer/TabContainer/Graphics/FOV"] -layout_mode = 2 -size_flags_horizontal = 3 -min_value = 60.0 -max_value = 120.0 -value = 75.0 -rounded = true -ticks_on_borders = true - -[node name="Value" type="Label" parent="Background/MarginContainer/VBoxContainer/TabContainer/Graphics/FOV"] -layout_mode = 2 -text = "75" - -[node name="HSeparator" type="HSeparator" parent="Background/MarginContainer/VBoxContainer/TabContainer/Graphics"] -layout_mode = 2 -theme_override_constants/separation = 20 - -[node name="CenterContainer" type="CenterContainer" parent="Background/MarginContainer/VBoxContainer/TabContainer/Graphics"] -layout_mode = 2 - -[node name="ApplyButton" type="Button" parent="Background/MarginContainer/VBoxContainer/TabContainer/Graphics/CenterContainer"] -layout_mode = 2 -text = "Apply/Save" - -[node name="Audio" type="VBoxContainer" parent="Background/MarginContainer/VBoxContainer/TabContainer"] -visible = false -layout_mode = 2 -metadata/_tab_index = 2 - -[node name="Inputs" type="VBoxContainer" parent="Background/MarginContainer/VBoxContainer/TabContainer"] -visible = false -layout_mode = 2 -metadata/_tab_index = 3 - -[node name="BottomRow" type="MarginContainer" parent="Background"] -layout_mode = 1 -anchors_preset = 7 -anchor_left = 0.5 -anchor_top = 1.0 -anchor_right = 0.5 -anchor_bottom = 1.0 -offset_left = -82.5 -offset_top = -46.0 -offset_right = 82.5 -grow_horizontal = 2 -grow_vertical = 0 -theme_override_constants/margin_bottom = 10 - -[node name="CloseButton" type="Button" parent="Background/BottomRow"] -custom_minimum_size = Vector2(141, 36) -layout_mode = 2 -theme = ExtResource("2_mhswj") -text = "Close Settings" - -[connection signal="toggled" from="Background/MarginContainer/VBoxContainer/TabContainer/Game/BlockHighlight/CheckButton" to="." method="_on_block_highlighting_toggled"] -[connection signal="toggled" from="Background/MarginContainer/VBoxContainer/TabContainer/Game/Waila/CheckButton" to="." method="_on_enable_waila_toggled"] -[connection signal="toggled" from="Background/MarginContainer/VBoxContainer/TabContainer/Game/QuickslotsUI/CheckButton" to="." method="_on_quickslots_ui_toggled"] -[connection signal="toggled" from="Background/MarginContainer/VBoxContainer/TabContainer/Game/HeldBlockUI/CheckButton" to="." method="_on_held_block_ui_toggled"] -[connection signal="toggled" from="Background/MarginContainer/VBoxContainer/TabContainer/Game/ScreenshotIcon/CheckButton" to="." method="_on_screenshot_icon_button_toggled"] -[connection signal="toggled" from="Background/MarginContainer/VBoxContainer/TabContainer/Game/Autosaves/CheckButton" to="." method="_on_autosaves_button_toggled"] -[connection signal="value_changed" from="Background/MarginContainer/VBoxContainer/TabContainer/Graphics/FOV/HSlider" to="." method="_on_fov_slider_changed"] -[connection signal="pressed" from="Background/MarginContainer/VBoxContainer/TabContainer/Graphics/CenterContainer/ApplyButton" to="." method="_on_graphics_apply_button_pressed"] -[connection signal="pressed" from="Background/BottomRow/CloseButton" to="." method="_on_close_button_pressed"] diff --git a/scenes/ui/pause_menu/base_menu.gd b/scenes/ui/pause_menu/base_menu.gd new file mode 100644 index 0000000..4a8178f --- /dev/null +++ b/scenes/ui/pause_menu/base_menu.gd @@ -0,0 +1,33 @@ +class_name BaseMenu +extends ColorRect + + +@export var animation_player: AnimationPlayer + +var pause_menu: PauseMenu + + +func init() -> void: + reset_menu() + update_animation_tracks() + +func close_menu() -> void: + animation_player.play("hide") + +func open_menu() -> void: + animation_player.play("show") + +func reset_menu() -> void: + animation_player.play("RESET") + +## Update the animation tracks to account for the varying sizes of the menu container[br] +## Requires:[br] +## Track 1 - Must be for the content_container[br] +## First Property - Must be position[br] +## Second Property - Visibility +func update_animation_tracks() -> void: + var hide_animation: Animation = animation_player.get_animation("hide") + var show_animation: Animation = animation_player.get_animation("show") + + hide_animation.track_set_key_value(0, 1, Vector2(-size.x, hide_animation.track_get_key_value(0, 1).y)) + show_animation.track_set_key_value(0, 0, Vector2(-size.x, show_animation.track_get_key_value(0, 0).y)) diff --git a/scenes/ui/pause_menu/base_menu.gd.uid b/scenes/ui/pause_menu/base_menu.gd.uid new file mode 100644 index 0000000..c607592 --- /dev/null +++ b/scenes/ui/pause_menu/base_menu.gd.uid @@ -0,0 +1 @@ +uid://c71f7fatmvsra diff --git a/scenes/ui/pause_menu/base_menu.tscn b/scenes/ui/pause_menu/base_menu.tscn new file mode 100644 index 0000000..d70fc6e --- /dev/null +++ b/scenes/ui/pause_menu/base_menu.tscn @@ -0,0 +1,152 @@ +[gd_scene load_steps=7 format=3 uid="uid://4itp2hjp14n2"] + +[ext_resource type="Theme" uid="uid://b5q8b0l6qp1dt" path="res://resources/pause_menu_theme.tres" id="1_3sxei"] +[ext_resource type="Script" uid="uid://c71f7fatmvsra" path="res://scenes/ui/pause_menu/base_menu.gd" id="2_3sxei"] + +[sub_resource type="Animation" id="Animation_vx2qe"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(-400, 0)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath(".:visible") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] +} + +[sub_resource type="Animation" id="Animation_q12vw"] +resource_name = "hide" +length = 0.2 +step = 0.05 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.2), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Vector2(0, 0), Vector2(-400, 0)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath(".:visible") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.2), +"transitions": PackedFloat32Array(1, 1), +"update": 1, +"values": [true, false] +} + +[sub_resource type="Animation" id="Animation_3mo8w"] +resource_name = "show" +length = 0.2 +step = 0.05 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.2), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Vector2(-400, 0), Vector2(0, 0)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath(".:visible") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [true] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_q12vw"] +_data = { +&"RESET": SubResource("Animation_vx2qe"), +&"hide": SubResource("Animation_q12vw"), +&"show": SubResource("Animation_3mo8w") +} + +[node name="BaseMenu" type="ColorRect" node_paths=PackedStringArray("animation_player")] +custom_minimum_size = Vector2(400, 0) +anchors_preset = 9 +anchor_bottom = 1.0 +offset_left = -400.0 +grow_vertical = 2 +theme = ExtResource("1_3sxei") +color = Color(0.133333, 0.133333, 0.133333, 0.784314) +script = ExtResource("2_3sxei") +animation_player = NodePath("AnimationPlayer") + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +reset_on_save = false +libraries = { +&"": SubResource("AnimationLibrary_q12vw") +} +autoplay = "show" + +[node name="MainContent" type="MarginContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_left = 10 +theme_override_constants/margin_top = 10 +theme_override_constants/margin_right = 10 +theme_override_constants/margin_bottom = 10 + +[node name="MenuContainer" type="VBoxContainer" parent="MainContent"] +layout_mode = 2 +size_flags_horizontal = 4 +theme_override_constants/separation = 20 + +[node name="Title" type="Label" parent="MainContent/MenuContainer"] +layout_mode = 2 +theme_type_variation = &"MenuTitle" +text = "Menu Title" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="BottomRow" type="MarginContainer" parent="."] +layout_mode = 1 +anchors_preset = 7 +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +offset_left = -82.5 +offset_top = -46.0 +offset_right = 82.5 +grow_horizontal = 2 +grow_vertical = 0 +theme_override_constants/margin_bottom = 10 diff --git a/scenes/ui/pause_menu/main_menu.gd b/scenes/ui/pause_menu/main_menu.gd new file mode 100644 index 0000000..bc2574f --- /dev/null +++ b/scenes/ui/pause_menu/main_menu.gd @@ -0,0 +1,16 @@ +class_name PauseMenuMain +extends BaseMenu + + +# Signals +func _on_exit_game_button_pressed() -> void: + get_tree().quit() + +func _on_resume_button_pressed() -> void: + close_menu() + +func _on_saves_button_pressed() -> void: + pause_menu.open_menu.emit("SavesMenu") + +func _on_settings_button_pressed() -> void: + pause_menu.open_menu.emit("SettingsMenu") diff --git a/scenes/ui/pause_menu/main_menu.gd.uid b/scenes/ui/pause_menu/main_menu.gd.uid new file mode 100644 index 0000000..1bcdd3e --- /dev/null +++ b/scenes/ui/pause_menu/main_menu.gd.uid @@ -0,0 +1 @@ +uid://bwvwpiwhp52e diff --git a/scenes/ui/pause_menu/main_menu.tscn b/scenes/ui/pause_menu/main_menu.tscn new file mode 100644 index 0000000..67a8a70 --- /dev/null +++ b/scenes/ui/pause_menu/main_menu.tscn @@ -0,0 +1,36 @@ +[gd_scene load_steps=3 format=3 uid="uid://xy8pdtxcepqf"] + +[ext_resource type="PackedScene" uid="uid://4itp2hjp14n2" path="res://scenes/ui/pause_menu/base_menu.tscn" id="1_6fgdx"] +[ext_resource type="Script" uid="uid://bwvwpiwhp52e" path="res://scenes/ui/pause_menu/main_menu.gd" id="2_4i143"] + +[node name="MainMenu" instance=ExtResource("1_6fgdx")] +script = ExtResource("2_4i143") + +[node name="Title" parent="MainContent/MenuContainer" index="0"] +text = "Paused" + +[node name="ButtonsContainer" type="VBoxContainer" parent="MainContent/MenuContainer" index="1"] +layout_mode = 2 +size_flags_vertical = 6 +theme_override_constants/separation = 20 + +[node name="ResumeButton" type="Button" parent="MainContent/MenuContainer/ButtonsContainer" index="0"] +layout_mode = 2 +text = "Resume" + +[node name="SavesButton" type="Button" parent="MainContent/MenuContainer/ButtonsContainer" index="1"] +layout_mode = 2 +text = "Saves" + +[node name="SettingsButton" type="Button" parent="MainContent/MenuContainer/ButtonsContainer" index="2"] +layout_mode = 2 +text = "Settings" + +[node name="ExitGameButton" type="Button" parent="MainContent/MenuContainer/ButtonsContainer" index="3"] +layout_mode = 2 +text = "Exit Game" + +[connection signal="pressed" from="MainContent/MenuContainer/ButtonsContainer/ResumeButton" to="." method="_on_resume_button_pressed"] +[connection signal="pressed" from="MainContent/MenuContainer/ButtonsContainer/SavesButton" to="." method="_on_saves_button_pressed"] +[connection signal="pressed" from="MainContent/MenuContainer/ButtonsContainer/SettingsButton" to="." method="_on_settings_button_pressed"] +[connection signal="pressed" from="MainContent/MenuContainer/ButtonsContainer/ExitGameButton" to="." method="_on_exit_game_button_pressed"] diff --git a/scenes/ui/pause_menu/pause_menu.gd b/scenes/ui/pause_menu/pause_menu.gd new file mode 100644 index 0000000..f3dfc21 --- /dev/null +++ b/scenes/ui/pause_menu/pause_menu.gd @@ -0,0 +1,87 @@ +## Handle changing changing menus and running the show/hide animations for each menu. +## Each menu should extend BaseMenu +class_name PauseMenu +extends Panel + + +signal open_menu(menu_name: String) + + +@onready var menu_mapping: Dictionary[String, BaseMenu] = { + "MainMenu": $MainMenu, + "SettingsMenu": $SettingsMenu, + "SavesMenu": $SavesMenu, +} + +var _active_menu: String = "MainMenu" +var _next_menu: String = "" + + +func _ready() -> void: + open_menu.connect(_on_change_menu) + + for menu: BaseMenu in get_children(): + menu.animation_player.animation_finished.connect(_on_animation_finished) + menu.pause_menu = self + menu.init() + + SaveGameManager.create_save.connect(_on_create_save) + SaveGameManager.load_save.connect(_on_load_save) + +func _unhandled_input(event: InputEvent) -> void: + if event.is_action_pressed("ui_cancel") and !visible: + _open_pause_menu() + elif event.is_action_pressed("ui_cancel") and visible and _active_menu == "MainMenu": + menu_mapping["MainMenu"].animation_player.play("hide") + elif event.is_action_pressed("ui_cancel"): ## Always back out to the MainMenu - Future, maybe add _previous_menu to allow backing out to any menu + open_menu.emit("MainMenu") + + +## Start the `hide` animation for the current menu. +## The `show` animation will play after the `hide` has completed, from `_on_animation_finished()`. +func _change_menu(menu_name: String) -> void: + visible = true + _next_menu = menu_name + if _next_menu == "": + menu_mapping["MainMenu"].animation_player.play("hide") + else: + menu_mapping[_active_menu].animation_player.play("hide") + +func _close_pause_menu() -> void: + visible = false + _next_menu = "" + Input.mouse_mode = Input.MOUSE_MODE_CAPTURED + SignalManager.resume_game.emit() + +## Run the `show` animation for the next menu +## If there is no next menu, close the pause menu +func _handle_next_menu() -> void: + if _next_menu == "": + _active_menu = "MainMenu" + _close_pause_menu() + else: + _active_menu = _next_menu + _next_menu = "" + menu_mapping[_active_menu].animation_player.play("show") + +func _open_pause_menu() -> void: + Input.mouse_mode = Input.MOUSE_MODE_VISIBLE + SignalManager.pause_game.emit() + menu_mapping["MainMenu"].animation_player.play("show") + + +## When the hide animation finished, start show `show` animation for the next menu +func _on_animation_finished(animation_name: String) -> void: + if animation_name == "hide": + _handle_next_menu() + +func _on_change_menu(menu_name: String) -> void: + _change_menu(menu_name) + +func _on_create_save(_save: String) -> void: + menu_mapping["SavesMenu"].reset_menu() + _close_pause_menu() + +func _on_load_save(_save: String) -> void: + menu_mapping["SavesMenu"].reset_menu() + _close_pause_menu() diff --git a/scenes/ui/pause_menu/pause_menu.gd.uid b/scenes/ui/pause_menu/pause_menu.gd.uid new file mode 100644 index 0000000..b426a1f --- /dev/null +++ b/scenes/ui/pause_menu/pause_menu.gd.uid @@ -0,0 +1 @@ +uid://domfn2obgmavw diff --git a/scenes/ui/pause_menu/pause_menu.tscn b/scenes/ui/pause_menu/pause_menu.tscn new file mode 100644 index 0000000..e2476cb --- /dev/null +++ b/scenes/ui/pause_menu/pause_menu.tscn @@ -0,0 +1,37 @@ +[gd_scene load_steps=6 format=3 uid="uid://by0gd600mbcr5"] + +[ext_resource type="Script" uid="uid://domfn2obgmavw" path="res://scenes/ui/pause_menu/pause_menu.gd" id="1_ugqbi"] +[ext_resource type="PackedScene" uid="uid://xy8pdtxcepqf" path="res://scenes/ui/pause_menu/main_menu.tscn" id="2_rv5mv"] +[ext_resource type="PackedScene" uid="uid://uwlutbmfp8dv" path="res://scenes/ui/pause_menu/settings_menu.tscn" id="3_rv5mv"] +[ext_resource type="PackedScene" uid="uid://dq83yv2um7sci" path="res://scenes/ui/pause_menu/saves_menu.tscn" id="4_rv5mv"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_4xojl"] +bg_color = Color(0.176419, 0.176419, 0.176419, 0.462745) + +[node name="PauseMenu" type="Panel"] +process_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_4xojl") +script = ExtResource("1_ugqbi") + +[node name="MainMenu" parent="." instance=ExtResource("2_rv5mv")] +visible = false +layout_mode = 1 +offset_left = 0.0 +offset_right = 400.0 + +[node name="SettingsMenu" parent="." instance=ExtResource("3_rv5mv")] +visible = false +layout_mode = 1 +offset_left = 0.0 +offset_right = 400.0 + +[node name="SavesMenu" parent="." instance=ExtResource("4_rv5mv")] +visible = false +layout_mode = 1 +offset_left = 0.0 +offset_right = 450.0 diff --git a/scenes/ui/menus/saves_manager/save_file.gd b/scenes/ui/pause_menu/saves_manager/save_file.gd similarity index 100% rename from scenes/ui/menus/saves_manager/save_file.gd rename to scenes/ui/pause_menu/saves_manager/save_file.gd diff --git a/scenes/ui/menus/saves_manager/save_file.gd.uid b/scenes/ui/pause_menu/saves_manager/save_file.gd.uid similarity index 100% rename from scenes/ui/menus/saves_manager/save_file.gd.uid rename to scenes/ui/pause_menu/saves_manager/save_file.gd.uid diff --git a/scenes/ui/menus/saves_manager/save_file.tscn b/scenes/ui/pause_menu/saves_manager/save_file.tscn similarity index 98% rename from scenes/ui/menus/saves_manager/save_file.tscn rename to scenes/ui/pause_menu/saves_manager/save_file.tscn index f5ec354..7eeed73 100644 --- a/scenes/ui/menus/saves_manager/save_file.tscn +++ b/scenes/ui/pause_menu/saves_manager/save_file.tscn @@ -2,7 +2,7 @@ [ext_resource type="StyleBox" uid="uid://biousyggn7iua" path="res://resources/save_file_panel_theme.tres" id="1_cqw77"] [ext_resource type="Texture2D" uid="uid://cmq51cgasug81" path="res://assets/ui/folder-open-normal.png" id="1_k6haa"] -[ext_resource type="Script" uid="uid://dcfdyua5gwpw4" path="res://scenes/ui/menus/saves_manager/save_file.gd" id="2_5g2eu"] +[ext_resource type="Script" uid="uid://dcfdyua5gwpw4" path="res://scenes/ui/pause_menu/saves_manager/save_file.gd" id="2_5g2eu"] [ext_resource type="Texture2D" uid="uid://blyryo60jydgi" path="res://assets/ui/folder-open-pressed.png" id="2_714lu"] [ext_resource type="StyleBox" uid="uid://bwm315lqbbb87" path="res://resources/save_file_highlight_panel_theme.tres" id="3_om23c"] [ext_resource type="Texture2D" uid="uid://by4w5ll3le7g6" path="res://assets/ui/folder-open-hover.png" id="3_ubfnn"] diff --git a/scenes/ui/menus/saves_manager/save_files_list.gd b/scenes/ui/pause_menu/saves_manager/save_files_list.gd similarity index 73% rename from scenes/ui/menus/saves_manager/save_files_list.gd rename to scenes/ui/pause_menu/saves_manager/save_files_list.gd index ebe9209..0d92c25 100644 --- a/scenes/ui/menus/saves_manager/save_files_list.gd +++ b/scenes/ui/pause_menu/saves_manager/save_files_list.gd @@ -1,12 +1,8 @@ +class_name SaveFilesListUI extends VBoxContainer @export var save_file_scene: PackedScene -@export var save_load_ui: SaveLoadUI - - -func _ready() -> void: - save_load_ui.open_save_list.connect(_on_open_save_list) # TODO: Reconsider this setup ## Clear the SaveFilesList node of all saves and load most recent saves @@ -24,6 +20,3 @@ func refresh_saves_list() -> void: func _clear_save_files_list() -> void: for _panel: SaveFilePanel in get_children(): _panel.queue_free() - -func _on_open_save_list() -> void: - refresh_saves_list() diff --git a/scenes/ui/menus/saves_manager/save_files_list.gd.uid b/scenes/ui/pause_menu/saves_manager/save_files_list.gd.uid similarity index 100% rename from scenes/ui/menus/saves_manager/save_files_list.gd.uid rename to scenes/ui/pause_menu/saves_manager/save_files_list.gd.uid diff --git a/scenes/ui/menus/saves_manager/save_files_list.tscn b/scenes/ui/pause_menu/saves_manager/save_files_list.tscn similarity index 71% rename from scenes/ui/menus/saves_manager/save_files_list.tscn rename to scenes/ui/pause_menu/saves_manager/save_files_list.tscn index 0e4ffd0..0b91b86 100644 --- a/scenes/ui/menus/saves_manager/save_files_list.tscn +++ b/scenes/ui/pause_menu/saves_manager/save_files_list.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=3 format=3 uid="uid://cyxieflejsggu"] -[ext_resource type="Script" uid="uid://cqabj86bq8whn" path="res://scenes/ui/menus/saves_manager/save_files_list.gd" id="1_sh1p7"] -[ext_resource type="PackedScene" uid="uid://bb7poutsn4ex2" path="res://scenes/ui/menus/saves_manager/save_file.tscn" id="2_kb5u8"] +[ext_resource type="Script" uid="uid://cqabj86bq8whn" path="res://scenes/ui/pause_menu/saves_manager/save_files_list.gd" id="1_sh1p7"] +[ext_resource type="PackedScene" uid="uid://bb7poutsn4ex2" path="res://scenes/ui/pause_menu/saves_manager/save_file.tscn" id="2_kb5u8"] [node name="SaveFilesList" type="VBoxContainer"] clip_contents = true diff --git a/scenes/ui/menus/saves_manager/save_load_ui.gd b/scenes/ui/pause_menu/saves_menu.gd similarity index 68% rename from scenes/ui/menus/saves_manager/save_load_ui.gd rename to scenes/ui/pause_menu/saves_menu.gd index 6b718a3..8260b6c 100644 --- a/scenes/ui/menus/saves_manager/save_load_ui.gd +++ b/scenes/ui/pause_menu/saves_menu.gd @@ -1,6 +1,5 @@ -class_name SaveLoadUI -extends Control - +class_name PauseMenuSaves +extends BaseMenu signal close_save_list signal open_save_list @@ -12,15 +11,16 @@ signal open_save_list @export var create_save_button: BaseButton @export var create_save_cancel_button: BaseButton -@export var ui_node: CanvasLayer ## The UI to Show/Hide when taking screenshot (e.g. save icon generation) +@export var save_files_list_ui: SaveFilesListUI -func _ready() -> void: - show_save_ui_button.pressed.connect(_on_show_save_ui_button_pressed) +func init() -> void: + super.init() + create_save_button.pressed.connect(_on_create_save_button_pressed) create_save_cancel_button.pressed.connect(_on_create_save_cancel_button_pressed) - - new_save_ui.hide() + show_save_ui_button.pressed.connect(_on_show_save_ui_button_pressed) + pause_menu.open_menu.connect(_on_open_menu) func _on_create_save_button_pressed() -> void: @@ -28,18 +28,22 @@ func _on_create_save_button_pressed() -> void: if save_name.strip_edges() == "": save_name = Time.get_datetime_string_from_system(false, true) - if ui_node != null: - ui_node.visible = false - await get_tree().create_timer(.150).timeout # A hack to allow time for UI to hide before taking screenshot - SaveGameManager.create_save.emit(save_name) - if ui_node != null: - ui_node.visible = true new_save_ui.hide() + + SignalManager.hide_ui.emit() + await get_tree().create_timer(.150).timeout # A hack to allow time for UI to hide before taking screenshot + SaveGameManager.create_save.emit(save_name) + + pause_menu.open_menu.emit("") SignalManager.resume_game.emit() func _on_create_save_cancel_button_pressed() -> void: new_save_ui.hide() +func _on_open_menu(menu_name: String) -> void: + if menu_name == name: + save_files_list_ui.refresh_saves_list() + func _on_show_save_ui_button_pressed() -> void: save_name_input.text = Time.get_datetime_string_from_system(false, true) new_save_ui.show() diff --git a/scenes/ui/pause_menu/saves_menu.gd.uid b/scenes/ui/pause_menu/saves_menu.gd.uid new file mode 100644 index 0000000..48e64f4 --- /dev/null +++ b/scenes/ui/pause_menu/saves_menu.gd.uid @@ -0,0 +1 @@ +uid://di8dm3fdxfwo1 diff --git a/scenes/ui/pause_menu/saves_menu.tscn b/scenes/ui/pause_menu/saves_menu.tscn new file mode 100644 index 0000000..f8b3b36 --- /dev/null +++ b/scenes/ui/pause_menu/saves_menu.tscn @@ -0,0 +1,97 @@ +[gd_scene load_steps=8 format=3 uid="uid://dq83yv2um7sci"] + +[ext_resource type="PackedScene" uid="uid://4itp2hjp14n2" path="res://scenes/ui/pause_menu/base_menu.tscn" id="1_i4hg7"] +[ext_resource type="Script" uid="uid://di8dm3fdxfwo1" path="res://scenes/ui/pause_menu/saves_menu.gd" id="2_q3hp2"] +[ext_resource type="PackedScene" uid="uid://cyxieflejsggu" path="res://scenes/ui/pause_menu/saves_manager/save_files_list.tscn" id="3_0ok72"] +[ext_resource type="Texture2D" uid="uid://ja8bc1h5x85o" path="res://assets/ui/save-normal.png" id="3_urnjr"] +[ext_resource type="Texture2D" uid="uid://crqgyft4gfilt" path="res://assets/ui/save-pressed.png" id="4_31dcc"] +[ext_resource type="PackedScene" uid="uid://bb7poutsn4ex2" path="res://scenes/ui/pause_menu/saves_manager/save_file.tscn" id="4_v5wg2"] +[ext_resource type="Texture2D" uid="uid://o3l0j53mgkan" path="res://assets/ui/save-hover.png" id="5_0ok72"] + +[node name="SavesMenu" node_paths=PackedStringArray("show_save_ui_button", "new_save_ui", "save_name_input", "create_save_button", "create_save_cancel_button", "save_files_list_ui") instance=ExtResource("1_i4hg7")] +custom_minimum_size = Vector2(450, 0) +offset_left = -450.0 +script = ExtResource("2_q3hp2") +show_save_ui_button = NodePath("BottomRow/SaveButton") +new_save_ui = NodePath("NewSaveUI") +save_name_input = NodePath("NewSaveUI/MarginContainer/VBoxContainer/SaveNameInput") +create_save_button = NodePath("NewSaveUI/MarginContainer/VBoxContainer/SaveButton") +create_save_cancel_button = NodePath("NewSaveUI/MarginContainer/VBoxContainer/CancelButton") +save_files_list_ui = NodePath("MainContent/MenuContainer/ScrollContainer/SaveFilesList") + +[node name="Title" parent="MainContent/MenuContainer" index="0"] +text = "Save/Load Game" + +[node name="ScrollContainer" type="ScrollContainer" parent="MainContent/MenuContainer" index="1"] +custom_minimum_size = Vector2(0, 500) +layout_mode = 2 +horizontal_scroll_mode = 0 + +[node name="SaveFilesList" parent="MainContent/MenuContainer/ScrollContainer" index="0" instance=ExtResource("3_0ok72")] +layout_mode = 2 +size_flags_horizontal = 6 + +[node name="SaveFilePanel" parent="MainContent/MenuContainer/ScrollContainer/SaveFilesList" index="0" instance=ExtResource("4_v5wg2")] +layout_mode = 2 + +[node name="SaveButton" type="TextureButton" parent="BottomRow" index="0"] +clip_contents = true +custom_minimum_size = Vector2(32, 32) +layout_mode = 2 +tooltip_text = "New Save" +texture_normal = ExtResource("3_urnjr") +texture_pressed = ExtResource("4_31dcc") +texture_hover = ExtResource("5_0ok72") +ignore_texture_size = true +stretch_mode = 5 + +[node name="NewSaveUI" type="Panel" parent="." index="3"] +visible = false +custom_minimum_size = Vector2(450, 100) +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="MarginContainer" type="MarginContainer" parent="NewSaveUI" index="0"] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -205.0 +offset_top = -29.5 +offset_right = 205.0 +offset_bottom = 29.5 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_left = 5 +theme_override_constants/margin_top = 5 +theme_override_constants/margin_right = 5 +theme_override_constants/margin_bottom = 5 + +[node name="VBoxContainer" type="VBoxContainer" parent="NewSaveUI/MarginContainer" index="0"] +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 4 + +[node name="SaveNameLabel" type="Label" parent="NewSaveUI/MarginContainer/VBoxContainer" index="0"] +layout_mode = 2 +theme_override_font_sizes/font_size = 20 +text = "Create New Save" + +[node name="SaveNameInput" type="LineEdit" parent="NewSaveUI/MarginContainer/VBoxContainer" index="1"] +custom_minimum_size = Vector2(400, 0) +layout_mode = 2 +placeholder_text = "New Save File Name" + +[node name="SaveButton" type="Button" parent="NewSaveUI/MarginContainer/VBoxContainer" index="2"] +layout_mode = 2 +text = "Create Save" + +[node name="CancelButton" type="Button" parent="NewSaveUI/MarginContainer/VBoxContainer" index="3"] +layout_mode = 2 +text = "Cancel" diff --git a/scenes/ui/menus/settings_menu.gd b/scenes/ui/pause_menu/settings_menu.gd similarity index 92% rename from scenes/ui/menus/settings_menu.gd rename to scenes/ui/pause_menu/settings_menu.gd index 0d5588e..d275a63 100644 --- a/scenes/ui/menus/settings_menu.gd +++ b/scenes/ui/pause_menu/settings_menu.gd @@ -1,5 +1,5 @@ -class_name SettingsMenu -extends Panel +class_name PauseMenuSettings +extends BaseMenu @export_group("Game Option Nodes") @@ -18,14 +18,16 @@ extends Panel @export var fov_value_label: Label -func _ready() -> void: +func init() -> void: + super.init() + apply_default_values() ## Sets the default values of all the inputs func apply_default_values() -> void: #region Game Options - autosaves_input.set_pressed_no_signal(GameSettingsManager.settings.game_options.enable_autosaves) + autosaves_input.button_pressed = GameSettingsManager.settings.game_options.enable_autosaves block_highlight_input.set_pressed_no_signal(GameSettingsManager.settings.game_options.enable_block_highlight) held_block_ui_input.set_pressed_no_signal(GameSettingsManager.settings.game_options.enable_held_block) quick_slots_ui_input.set_pressed_no_signal(GameSettingsManager.settings.game_options.enable_quickslots_ui) @@ -44,6 +46,7 @@ func apply_default_values() -> void: #endregion + #region Game Settings func _on_block_highlighting_toggled(toggled_on: bool) -> void: GameSettingsManager.game_options_block_highlight_changed.emit(toggled_on) @@ -62,6 +65,7 @@ func _on_screenshot_icon_button_toggled(toggled_on: bool) -> void: SaveGameManager.toggle_save_icon_generation.emit(toggled_on) func _on_autosaves_button_toggled(toggled_on: bool) -> void: + GameSettingsManager.game_options_autosaves_changed.emit(toggled_on) if toggled_on: SaveGameManager.enable_autosaves.emit() else: @@ -91,4 +95,4 @@ func _on_graphics_apply_button_pressed() -> void: func _on_close_button_pressed() -> void: - SignalManager.resume_game.emit() + pause_menu.open_menu.emit("MainMenu") diff --git a/scenes/ui/pause_menu/settings_menu.gd.uid b/scenes/ui/pause_menu/settings_menu.gd.uid new file mode 100644 index 0000000..5c86812 --- /dev/null +++ b/scenes/ui/pause_menu/settings_menu.gd.uid @@ -0,0 +1 @@ +uid://ccei1q7fb022x diff --git a/scenes/ui/pause_menu/settings_menu.tscn b/scenes/ui/pause_menu/settings_menu.tscn new file mode 100644 index 0000000..e962f0a --- /dev/null +++ b/scenes/ui/pause_menu/settings_menu.tscn @@ -0,0 +1,230 @@ +[gd_scene load_steps=4 format=3 uid="uid://uwlutbmfp8dv"] + +[ext_resource type="Script" uid="uid://ccei1q7fb022x" path="res://scenes/ui/pause_menu/settings_menu.gd" id="1_govsn"] +[ext_resource type="PackedScene" uid="uid://4itp2hjp14n2" path="res://scenes/ui/pause_menu/base_menu.tscn" id="1_oec81"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_830fb"] +content_margin_left = 10.0 +content_margin_top = 10.0 +content_margin_right = 10.0 +content_margin_bottom = 10.0 +bg_color = Color(0, 0, 0, 0.27451) +corner_radius_top_left = 2 +corner_radius_top_right = 2 +corner_radius_bottom_right = 2 +corner_radius_bottom_left = 2 + +[node name="SettingsMenu" node_paths=PackedStringArray("autosaves_input", "block_highlight_input", "held_block_ui_input", "quick_slots_ui_input", "screenshot_icon_input", "waila_input", "resolution_input", "fullscreen_input", "vsync_input", "fov_slider", "fov_value_label") instance=ExtResource("1_oec81")] +script = ExtResource("1_govsn") +autosaves_input = NodePath("MainContent/MenuContainer/TabContainer/Game/Autosaves/CheckButton") +block_highlight_input = NodePath("MainContent/MenuContainer/TabContainer/Game/BlockHighlight/CheckButton") +held_block_ui_input = NodePath("MainContent/MenuContainer/TabContainer/Game/HeldBlockUI/CheckButton") +quick_slots_ui_input = NodePath("MainContent/MenuContainer/TabContainer/Game/QuickslotsUI/CheckButton") +screenshot_icon_input = NodePath("MainContent/MenuContainer/TabContainer/Game/ScreenshotIcon/CheckButton") +waila_input = NodePath("MainContent/MenuContainer/TabContainer/Game/Waila/CheckButton") +resolution_input = NodePath("MainContent/MenuContainer/TabContainer/Graphics/Resolution/OptionButton") +fullscreen_input = NodePath("MainContent/MenuContainer/TabContainer/Graphics/Fullscreen/CheckBox") +vsync_input = NodePath("MainContent/MenuContainer/TabContainer/Graphics/VSync/CheckBox") +fov_slider = NodePath("MainContent/MenuContainer/TabContainer/Graphics/FOV/HSlider") +fov_value_label = NodePath("MainContent/MenuContainer/TabContainer/Graphics/FOV/Value") + +[node name="Title" parent="MainContent/MenuContainer" index="0"] +text = "Settings" + +[node name="TabContainer" type="TabContainer" parent="MainContent/MenuContainer" index="1"] +layout_mode = 2 +theme_override_constants/side_margin = 0 +theme_override_styles/panel = SubResource("StyleBoxFlat_830fb") +current_tab = 0 +clip_tabs = false + +[node name="Game" type="VBoxContainer" parent="MainContent/MenuContainer/TabContainer" index="1"] +layout_mode = 2 +metadata/_tab_index = 0 + +[node name="BlockHighlight" type="HBoxContainer" parent="MainContent/MenuContainer/TabContainer/Game" index="0"] +layout_mode = 2 + +[node name="Label" type="Label" parent="MainContent/MenuContainer/TabContainer/Game/BlockHighlight" index="0"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Enable Block Highlighting" + +[node name="CheckButton" type="CheckButton" parent="MainContent/MenuContainer/TabContainer/Game/BlockHighlight" index="1"] +layout_mode = 2 +button_pressed = true + +[node name="Waila" type="HBoxContainer" parent="MainContent/MenuContainer/TabContainer/Game" index="1"] +layout_mode = 2 + +[node name="Label" type="Label" parent="MainContent/MenuContainer/TabContainer/Game/Waila" index="0"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Enable Waila" + +[node name="CheckButton" type="CheckButton" parent="MainContent/MenuContainer/TabContainer/Game/Waila" index="1"] +layout_mode = 2 +button_pressed = true + +[node name="QuickslotsUI" type="HBoxContainer" parent="MainContent/MenuContainer/TabContainer/Game" index="2"] +layout_mode = 2 + +[node name="Label" type="Label" parent="MainContent/MenuContainer/TabContainer/Game/QuickslotsUI" index="0"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Enable Quickslots UI" + +[node name="CheckButton" type="CheckButton" parent="MainContent/MenuContainer/TabContainer/Game/QuickslotsUI" index="1"] +layout_mode = 2 +button_pressed = true + +[node name="HeldBlockUI" type="HBoxContainer" parent="MainContent/MenuContainer/TabContainer/Game" index="3"] +layout_mode = 2 + +[node name="Label" type="Label" parent="MainContent/MenuContainer/TabContainer/Game/HeldBlockUI" index="0"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Enable Player Held Block" + +[node name="CheckButton" type="CheckButton" parent="MainContent/MenuContainer/TabContainer/Game/HeldBlockUI" index="1"] +layout_mode = 2 +button_pressed = true + +[node name="ScreenshotIcon" type="HBoxContainer" parent="MainContent/MenuContainer/TabContainer/Game" index="4"] +layout_mode = 2 + +[node name="Label" type="Label" parent="MainContent/MenuContainer/TabContainer/Game/ScreenshotIcon" index="0"] +layout_mode = 2 +size_flags_horizontal = 3 +tooltip_text = "Enable/Disable the taking of a screenshot to utilize as the save icon." +mouse_filter = 1 +text = "Enable Save Screenshot" + +[node name="CheckButton" type="CheckButton" parent="MainContent/MenuContainer/TabContainer/Game/ScreenshotIcon" index="1"] +layout_mode = 2 +tooltip_text = "Enable/Disable the taking of a screenshot to utilize as the save icon." +button_pressed = true + +[node name="Autosaves" type="HBoxContainer" parent="MainContent/MenuContainer/TabContainer/Game" index="5"] +layout_mode = 2 + +[node name="Label" type="Label" parent="MainContent/MenuContainer/TabContainer/Game/Autosaves" index="0"] +layout_mode = 2 +size_flags_horizontal = 3 +tooltip_text = "Enable/Disable the taking of a screenshot to utilize as the save icon." +mouse_filter = 1 +text = "Enable Autosaves" + +[node name="CheckButton" type="CheckButton" parent="MainContent/MenuContainer/TabContainer/Game/Autosaves" index="1"] +layout_mode = 2 +tooltip_text = "Enable/Disable the taking of a screenshot to utilize as the save icon." +button_pressed = true + +[node name="Graphics" type="VBoxContainer" parent="MainContent/MenuContainer/TabContainer" index="2"] +visible = false +layout_mode = 2 +metadata/_tab_index = 1 + +[node name="Resolution" type="HBoxContainer" parent="MainContent/MenuContainer/TabContainer/Graphics" index="0"] +layout_mode = 2 + +[node name="Label" type="Label" parent="MainContent/MenuContainer/TabContainer/Graphics/Resolution" index="0"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Resolution" + +[node name="OptionButton" type="OptionButton" parent="MainContent/MenuContainer/TabContainer/Graphics/Resolution" index="1"] +layout_mode = 2 +selected = 0 +item_count = 6 +popup/item_0/text = "1280x720" +popup/item_0/id = 0 +popup/item_1/text = "1280x800" +popup/item_1/id = 4 +popup/item_2/text = "1920x1080" +popup/item_2/id = 1 +popup/item_3/text = "2560x1440" +popup/item_3/id = 2 +popup/item_4/text = "3440x1440" +popup/item_4/id = 3 +popup/item_5/text = "3840 x 2160" +popup/item_5/id = 5 + +[node name="Fullscreen" type="HBoxContainer" parent="MainContent/MenuContainer/TabContainer/Graphics" index="1"] +layout_mode = 2 + +[node name="Label" type="Label" parent="MainContent/MenuContainer/TabContainer/Graphics/Fullscreen" index="0"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Fullscreen" + +[node name="CheckBox" type="CheckBox" parent="MainContent/MenuContainer/TabContainer/Graphics/Fullscreen" index="1"] +layout_mode = 2 + +[node name="VSync" type="HBoxContainer" parent="MainContent/MenuContainer/TabContainer/Graphics" index="2"] +layout_mode = 2 + +[node name="Label" type="Label" parent="MainContent/MenuContainer/TabContainer/Graphics/VSync" index="0"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "VSync" + +[node name="CheckBox" type="CheckBox" parent="MainContent/MenuContainer/TabContainer/Graphics/VSync" index="1"] +layout_mode = 2 + +[node name="FOV" type="HBoxContainer" parent="MainContent/MenuContainer/TabContainer/Graphics" index="3"] +layout_mode = 2 + +[node name="Label" type="Label" parent="MainContent/MenuContainer/TabContainer/Graphics/FOV" index="0"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "FOV" + +[node name="HSlider" type="HSlider" parent="MainContent/MenuContainer/TabContainer/Graphics/FOV" index="1"] +layout_mode = 2 +size_flags_horizontal = 3 +min_value = 60.0 +max_value = 120.0 +value = 75.0 +rounded = true +ticks_on_borders = true + +[node name="Value" type="Label" parent="MainContent/MenuContainer/TabContainer/Graphics/FOV" index="2"] +layout_mode = 2 +text = "75" + +[node name="HSeparator" type="HSeparator" parent="MainContent/MenuContainer/TabContainer/Graphics" index="4"] +layout_mode = 2 +theme_override_constants/separation = 20 + +[node name="CenterContainer" type="CenterContainer" parent="MainContent/MenuContainer/TabContainer/Graphics" index="5"] +layout_mode = 2 + +[node name="ApplyButton" type="Button" parent="MainContent/MenuContainer/TabContainer/Graphics/CenterContainer" index="0"] +layout_mode = 2 +text = "Apply/Save" + +[node name="Audio" type="VBoxContainer" parent="MainContent/MenuContainer/TabContainer" index="3"] +visible = false +layout_mode = 2 +metadata/_tab_index = 2 + +[node name="Inputs" type="VBoxContainer" parent="MainContent/MenuContainer/TabContainer" index="4"] +visible = false +layout_mode = 2 +metadata/_tab_index = 3 + +[node name="CloseButton" type="Button" parent="BottomRow" index="0"] +custom_minimum_size = Vector2(141, 36) +layout_mode = 2 +text = "Close Settings" + +[connection signal="toggled" from="MainContent/MenuContainer/TabContainer/Game/BlockHighlight/CheckButton" to="." method="_on_block_highlighting_toggled"] +[connection signal="toggled" from="MainContent/MenuContainer/TabContainer/Game/Waila/CheckButton" to="." method="_on_enable_waila_toggled"] +[connection signal="toggled" from="MainContent/MenuContainer/TabContainer/Game/QuickslotsUI/CheckButton" to="." method="_on_quickslots_ui_toggled"] +[connection signal="toggled" from="MainContent/MenuContainer/TabContainer/Game/HeldBlockUI/CheckButton" to="." method="_on_held_block_ui_toggled"] +[connection signal="toggled" from="MainContent/MenuContainer/TabContainer/Game/ScreenshotIcon/CheckButton" to="." method="_on_screenshot_icon_button_toggled"] +[connection signal="toggled" from="MainContent/MenuContainer/TabContainer/Game/Autosaves/CheckButton" to="." method="_on_autosaves_button_toggled"] +[connection signal="value_changed" from="MainContent/MenuContainer/TabContainer/Graphics/FOV/HSlider" to="." method="_on_fov_slider_changed"] +[connection signal="pressed" from="MainContent/MenuContainer/TabContainer/Graphics/CenterContainer/ApplyButton" to="." method="_on_graphics_apply_button_pressed"] +[connection signal="pressed" from="BottomRow/CloseButton" to="." method="_on_close_button_pressed"] diff --git a/scenes/ui/ui.gd b/scenes/ui/ui.gd index 3bf674d..c005e6d 100644 --- a/scenes/ui/ui.gd +++ b/scenes/ui/ui.gd @@ -5,82 +5,62 @@ extends CanvasLayer @onready var crosshair: CenterContainer = $Crosshair @onready var quick_slots: MarginContainer = $QuickSlots @onready var pause_menu: PauseMenu = $PauseMenu -@onready var save_load_ui: SaveLoadUI = $SaveLoadUI -@onready var settings_menu: SettingsMenu = $SettingsMenu @onready var waila: Waila = $Waila func _ready() -> void: - SignalManager.close_pause_menu.connect(_on_close_pause_menu) - SignalManager.open_pause_menu.connect(_on_open_pause_menu) - SignalManager.close_settings_menu.connect(_on_close_settings_menu) - SignalManager.open_settings_menu.connect(_on_open_settings_menu) - SignalManager.resume_game.connect(_on_resume_game) - - save_load_ui.close_save_list.connect(_on_close_save_list_ui) - save_load_ui.open_save_list.connect(_on_open_save_list_ui) - SaveGameManager.load_complete.connect(_on_load_complete) + SignalManager.pause_game.connect(_on_pause_game) + SignalManager.resume_game.connect(_on_resume_game) + SignalManager.hide_ui.connect(_on_hide_ui) + SignalManager.show_ui.connect(_on_show_ui) - _on_resume_game() + resume_game() func hide_menus() -> void: pause_menu.visible = false - settings_menu.visible = false - save_load_ui.visible = false + +func show_menus() -> void: + pause_menu.visible = true + func hide_ui_elements() -> void: crosshair.visible = false quick_slots.visible = false waila.visible = false +func show_ui_elements() -> void: + crosshair.visible = true + quick_slots.visible = true and GameSettingsManager.settings.game_options.enable_quickslots_ui + waila.visible = true and GameSettingsManager.settings.game_options.enable_waila -func _on_close_pause_menu() -> void: - SignalManager.resume_game.emit() - -func _on_close_save_list_ui() -> void: - SignalManager.open_settings_menu.emit() - -func _on_close_settings_menu() -> void: - SignalManager.resume_game.emit() - -func _on_load_complete() -> void: - _on_resume_game() - -func _on_open_pause_menu() -> void: - Input.mouse_mode = Input.MOUSE_MODE_VISIBLE - - hide_ui_elements() - hide_menus() - pause_menu.visible = true +func pause_game() -> void: + show_menus() get_tree().paused = true - -func _on_open_save_list_ui() -> void: - Input.mouse_mode = Input.MOUSE_MODE_VISIBLE - hide_ui_elements() + +func resume_game() -> void: hide_menus() - save_load_ui.visible = true + show_ui_elements() - get_tree().paused = true + get_tree().paused = false -func _on_open_settings_menu() -> void: - Input.mouse_mode = Input.MOUSE_MODE_VISIBLE - hide_ui_elements() - hide_menus() - settings_menu.visible = true +func _on_load_complete() -> void: + resume_game() - get_tree().paused = true +func _on_pause_game() -> void: + pause_game() func _on_resume_game() -> void: - Input.mouse_mode = Input.MOUSE_MODE_CAPTURED + resume_game() + +func _on_hide_ui() -> void: hide_menus() - crosshair.visible = true - quick_slots.visible = true and GameSettingsManager.settings.game_options.enable_quickslots_ui - waila.visible = true + hide_ui_elements() - get_tree().paused = false +func _on_show_ui() -> void: + show_ui_elements() diff --git a/scenes/ui/ui.tscn b/scenes/ui/ui.tscn index 3db600e..3109d97 100644 --- a/scenes/ui/ui.tscn +++ b/scenes/ui/ui.tscn @@ -1,12 +1,10 @@ -[gd_scene load_steps=8 format=3 uid="uid://c7fj7wla8bd70"] +[gd_scene load_steps=6 format=3 uid="uid://c7fj7wla8bd70"] [ext_resource type="Script" uid="uid://bslimr2y4lnvq" path="res://scenes/ui/ui.gd" id="1_aac20"] [ext_resource type="PackedScene" uid="uid://dvogu3djluqsn" path="res://scenes/ui/waila.tscn" id="1_u7n8c"] [ext_resource type="PackedScene" uid="uid://cbiygbgpfk220" path="res://scenes/ui/quick_slots.tscn" id="4_g5kmx"] -[ext_resource type="PackedScene" uid="uid://bopvfwcgnnawg" path="res://scenes/ui/menus/pause_menu.tscn" id="6_7vp6q"] -[ext_resource type="PackedScene" uid="uid://4bdgwwx27m71" path="res://scenes/ui/menus/settings_menu.tscn" id="7_7vp6q"] +[ext_resource type="PackedScene" uid="uid://by0gd600mbcr5" path="res://scenes/ui/pause_menu/pause_menu.tscn" id="5_0dwhk"] [ext_resource type="PackedScene" uid="uid://rfknvv8b0d4i" path="res://scenes/ui/autosave_notification.tscn" id="7_jcn1r"] -[ext_resource type="PackedScene" uid="uid://dauchkhmnyk7n" path="res://scenes/ui/menus/saves_manager/save_load_ui.tscn" id="8_jcn1r"] [node name="UI" type="CanvasLayer"] script = ExtResource("1_aac20") @@ -32,16 +30,8 @@ mouse_filter = 2 [node name="QuickSlots" parent="." instance=ExtResource("4_g5kmx")] -[node name="PauseMenu" parent="." node_paths=PackedStringArray("save_load_ui") instance=ExtResource("6_7vp6q")] -visible = false -save_load_ui = NodePath("../SaveLoadUI") - -[node name="SettingsMenu" parent="." instance=ExtResource("7_7vp6q")] -visible = false - -[node name="SaveLoadUI" parent="." node_paths=PackedStringArray("ui_node") instance=ExtResource("8_jcn1r")] +[node name="AutosaveNotification" parent="." instance=ExtResource("7_jcn1r")] visible = false -ui_node = NodePath("..") -[node name="AutosaveNotification" parent="." instance=ExtResource("7_jcn1r")] +[node name="PauseMenu" parent="." instance=ExtResource("5_0dwhk")] visible = false