add game_menu and scene_manager

This commit is contained in:
2026-05-15 23:36:10 +02:00
parent 0e56a84a95
commit f6266cb69e
19 changed files with 253 additions and 26 deletions

View File

@@ -4,26 +4,6 @@ extends Control
@onready var resume_button: Control = $%ResumeButton @onready var resume_button: Control = $%ResumeButton
func _ready() -> void:
GameState.on_game_paused.connect(_on_game_paused)
GameState.on_game_resumed.connect(_on_game_resumed)
resume_button.hide()
func _on_game_paused() -> void:
play_button.hide()
resume_button.show()
func _on_game_resumed() -> void:
play_button.show()
resume_button.hide()
func _on_play_button_on_button_pressed() -> void:
pass # Replace with function body.
func _on_resume_button_on_button_pressed() -> void: func _on_resume_button_on_button_pressed() -> void:
GameState.resume_game() GameState.resume_game()

View File

@@ -4,6 +4,7 @@
[ext_resource type="PackedScene" uid="uid://c3alhtb3083qs" path="res://core/game_menu/option_menu_button.tscn" id="2_cd2sv"] [ext_resource type="PackedScene" uid="uid://c3alhtb3083qs" path="res://core/game_menu/option_menu_button.tscn" id="2_cd2sv"]
[ext_resource type="Texture2D" uid="uid://dd1exrppb6bjq" path="res://core/game_menu/assets/page_3/resume_button.png" id="2_htoi2"] [ext_resource type="Texture2D" uid="uid://dd1exrppb6bjq" path="res://core/game_menu/assets/page_3/resume_button.png" id="2_htoi2"]
[ext_resource type="Texture2D" uid="uid://cmhx3mscwrwft" path="res://core/game_menu/assets/page_3/save_button.png" id="3_vwpol"] [ext_resource type="Texture2D" uid="uid://cmhx3mscwrwft" path="res://core/game_menu/assets/page_3/save_button.png" id="3_vwpol"]
[ext_resource type="Texture2D" uid="uid://cu8e7pl0y4owq" path="res://core/game_menu/assets/page_3/settings_button.png" id="4_8w45m"]
[ext_resource type="Texture2D" uid="uid://v7e7467fkdec" path="res://core/game_menu/assets/page_3/quit_button.png" id="4_cd2sv"] [ext_resource type="Texture2D" uid="uid://v7e7467fkdec" path="res://core/game_menu/assets/page_3/quit_button.png" id="4_cd2sv"]
[node name="OptionMenu" type="Control" unique_id=1055457221] [node name="OptionMenu" type="Control" unique_id=1055457221]
@@ -20,12 +21,15 @@ script = ExtResource("1_cd2sv")
layout_mode = 1 layout_mode = 1
anchors_preset = -1 anchors_preset = -1
anchor_left = 0.41927084 anchor_left = 0.41927084
anchor_top = 0.30925927 anchor_top = 0.2537037
anchor_right = 0.5807292 anchor_right = 0.5807292
anchor_bottom = 0.69074076 anchor_bottom = 0.7462963
offset_top = 60.0
offset_bottom = -60.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
mouse_filter = 2 mouse_filter = 2
theme_override_constants/separation = 8
metadata/_edit_use_anchors_ = true metadata/_edit_use_anchors_ = true
[node name="PlayButton" parent="VBoxContainer" unique_id=1990327704 instance=ExtResource("2_cd2sv")] [node name="PlayButton" parent="VBoxContainer" unique_id=1990327704 instance=ExtResource("2_cd2sv")]
@@ -39,6 +43,12 @@ custom_minimum_size = Vector2(310, 100)
layout_mode = 2 layout_mode = 2
image = ExtResource("2_htoi2") image = ExtResource("2_htoi2")
[node name="SettingsButton" parent="VBoxContainer" unique_id=1931222561 instance=ExtResource("2_cd2sv")]
unique_name_in_owner = true
custom_minimum_size = Vector2(310, 100)
layout_mode = 2
image = ExtResource("4_8w45m")
[node name="SaveButton" parent="VBoxContainer" unique_id=1161034414 instance=ExtResource("2_cd2sv")] [node name="SaveButton" parent="VBoxContainer" unique_id=1161034414 instance=ExtResource("2_cd2sv")]
unique_name_in_owner = true unique_name_in_owner = true
custom_minimum_size = Vector2(310, 100) custom_minimum_size = Vector2(310, 100)
@@ -51,7 +61,6 @@ custom_minimum_size = Vector2(310, 100)
layout_mode = 2 layout_mode = 2
image = ExtResource("4_cd2sv") image = ExtResource("4_cd2sv")
[connection signal="on_button_pressed" from="VBoxContainer/PlayButton" to="." method="_on_play_button_on_button_pressed"]
[connection signal="on_button_pressed" from="VBoxContainer/ResumeButton" to="." method="_on_resume_button_on_button_pressed"] [connection signal="on_button_pressed" from="VBoxContainer/ResumeButton" to="." method="_on_resume_button_on_button_pressed"]
[connection signal="on_button_pressed" from="VBoxContainer/SaveButton" to="." method="_on_save_button_on_button_pressed"] [connection signal="on_button_pressed" from="VBoxContainer/SaveButton" to="." method="_on_save_button_on_button_pressed"]
[connection signal="on_button_pressed" from="VBoxContainer/QuitButton" to="." method="_on_quit_button_on_button_pressed"] [connection signal="on_button_pressed" from="VBoxContainer/QuitButton" to="." method="_on_quit_button_on_button_pressed"]

View File

@@ -27,7 +27,6 @@ grow_vertical = 2
pivot_offset_ratio = Vector2(0.5, 0.5) pivot_offset_ratio = Vector2(0.5, 0.5)
mouse_filter = 2 mouse_filter = 2
texture = ExtResource("1_movd1") texture = ExtResource("1_movd1")
stretch_mode = 5
metadata/_edit_use_anchors_ = true metadata/_edit_use_anchors_ = true
[node name="HooverTween" parent="." unique_id=160227524 node_paths=PackedStringArray("detector_node", "visual_node") instance=ExtResource("3_am666")] [node name="HooverTween" parent="." unique_id=160227524 node_paths=PackedStringArray("detector_node", "visual_node") instance=ExtResource("3_am666")]

View File

@@ -35,9 +35,17 @@ offset_bottom = 563.0
grow_horizontal = 1 grow_horizontal = 1
grow_vertical = 1 grow_vertical = 1
[node name="PlayButton" parent="OptionMenu/VBoxContainer" parent_id_path=PackedInt32Array(1055457221, 508055524) index="0" unique_id=1990327704]
visible = false
[node name="SettingsButton" parent="OptionMenu/VBoxContainer" parent_id_path=PackedInt32Array(1055457221, 508055524) index="2" unique_id=1931222561]
visible = false
[node name="SettingsMenu" parent="." index="3" unique_id=1639777294 instance=ExtResource("4_twko7")] [node name="SettingsMenu" parent="." index="3" unique_id=1639777294 instance=ExtResource("4_twko7")]
layout_mode = 1 layout_mode = 1
offset_left = 365.0 offset_left = 365.0
offset_top = 304.0 offset_top = 304.0
offset_right = 365.0 offset_right = 365.0
offset_bottom = 304.0 offset_bottom = 304.0
[editable path="OptionMenu"]

View File

@@ -45,4 +45,4 @@ func resume_game() -> void:
get_tree().paused = false get_tree().paused = false
func quit_game() -> void: func quit_game() -> void:
get_tree().quit() SceneManager.quit_game()

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b1wg4lif82dxp"
path="res://.godot/imported/photo_2025-08-27_17-35-14.jpg-78d5e1b9cf2d920968331a684da2ca42.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://core/main_menu/assets/photo_2025-08-27_17-35-14.jpg"
dest_files=["res://.godot/imported/photo_2025-08-27_17-35-14.jpg-78d5e1b9cf2d920968331a684da2ca42.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -0,0 +1,10 @@
extends Control
@onready var settings_menu: Control = $%SettingsMenu
func _on_play_button_on_button_pressed() -> void:
SceneManager.change_scene(SceneConfig.SceneName.GAME)
func _on_settings_button_on_button_pressed() -> void:
$%SettingsMenu.visible = !$%SettingsMenu.visible

View File

@@ -0,0 +1 @@
uid://csqxuftsnv1br

View File

@@ -0,0 +1,62 @@
[gd_scene format=3 uid="uid://btcpge7cj2041"]
[ext_resource type="Script" uid="uid://csqxuftsnv1br" path="res://core/main_menu/main_menu.gd" id="1_g1whv"]
[ext_resource type="PackedScene" uid="uid://cxf8s80ivwj1p" path="res://core/game_menu/option_menu.tscn" id="1_uvy4f"]
[ext_resource type="Texture2D" uid="uid://b1wg4lif82dxp" path="res://core/main_menu/assets/photo_2025-08-27_17-35-14.jpg" id="2_mloc8"]
[ext_resource type="PackedScene" uid="uid://caqf471x0kttc" path="res://core/game_menu/settings_menu.tscn" id="3_26agx"]
[node name="MainMenu" type="Control" unique_id=889720172]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_g1whv")
[node name="TextureRect" type="TextureRect" parent="." unique_id=11805511]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("2_mloc8")
[node name="OptionMenu" parent="." unique_id=1055457221 instance=ExtResource("1_uvy4f")]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = 492.0
offset_top = 274.0
offset_right = 492.0
offset_bottom = 274.0
[node name="VBoxContainer" parent="OptionMenu" index="0" unique_id=508055524]
anchor_top = 0.3037037
anchor_bottom = 0.6962963
offset_top = 6.0
offset_bottom = -6.0
[node name="ResumeButton" parent="OptionMenu/VBoxContainer" index="1" unique_id=635721927]
visible = false
[node name="SaveButton" parent="OptionMenu/VBoxContainer" index="3" unique_id=1161034414]
visible = false
[node name="SettingsMenu" parent="." unique_id=1639777294 instance=ExtResource("3_26agx")]
unique_name_in_owner = true
visible = false
layout_mode = 1
offset_left = 639.0
offset_top = 566.0
offset_right = 639.0
offset_bottom = 566.0
[connection signal="on_button_pressed" from="OptionMenu/VBoxContainer/PlayButton" to="." method="_on_play_button_on_button_pressed"]
[connection signal="on_button_pressed" from="OptionMenu/VBoxContainer/SettingsButton" to="." method="_on_settings_button_on_button_pressed"]
[editable path="OptionMenu"]

View File

@@ -3,7 +3,7 @@ extends Node
signal on_collectible_unlocked(collectible_id: StringName) signal on_collectible_unlocked(collectible_id: StringName)
signal on_photo_saved(filePath: String) signal on_photo_saved(filePath: String)
var collectibles_library: CollectibleLibrary = preload("res://core/photo_mode/data/collectible_library.tres") @export var collectibles_library: CollectibleLibrary
var unlocked_collectibles_ids: Array[StringName] = [] var unlocked_collectibles_ids: Array[StringName] = []
var saved_photos: Array[String] = [] var saved_photos: Array[String] = []

View File

@@ -0,0 +1,8 @@
[gd_scene format=3 uid="uid://22orqdm34hfm"]
[ext_resource type="Script" uid="uid://c3kq1qddpm8tf" path="res://core/photo_mode/managers/collection_manager.gd" id="1_qf21s"]
[ext_resource type="Resource" uid="uid://c6pkpvsvimafb" path="res://core/photo_mode/data/collectible_library.tres" id="2_pxvtd"]
[node name="CollectionManager" type="Node" unique_id=1532057831]
script = ExtResource("1_qf21s")
collectibles_library = ExtResource("2_pxvtd")

View File

@@ -0,0 +1,7 @@
class_name SceneConfig
extends Resource
enum SceneName { MAIN_MENU, GAME }
@export var scenes: Dictionary[SceneName, PackedScene] = {
}

View File

@@ -0,0 +1 @@
uid://bbgyhmb8a17i7

View File

@@ -0,0 +1,13 @@
[gd_resource type="Resource" script_class="SceneConfig" format=3 uid="uid://dr612tmciq8pg"]
[ext_resource type="PackedScene" uid="uid://btcpge7cj2041" path="res://core/main_menu/main_menu.tscn" id="1_72aup"]
[ext_resource type="Script" uid="uid://bbgyhmb8a17i7" path="res://core/scene_manager/scene_config.gd" id="1_km45g"]
[ext_resource type="PackedScene" uid="uid://cae0mnf353dy3" path="res://docs/museums/biome_generator/museum_biome_generator.tscn" id="2_prsyo"]
[resource]
script = ExtResource("1_km45g")
scenes = Dictionary[int, PackedScene]({
0: ExtResource("1_72aup"),
1: ExtResource("2_prsyo")
})
metadata/_custom_type_script = "uid://bbgyhmb8a17i7"

View File

@@ -0,0 +1,43 @@
extends CanvasLayer
@export var config: SceneConfig
@onready var color_rect = $ColorRect
@onready var loading_screen = $LoadingScreen
@export var transition_duration: float = 1
func _ready() -> void:
color_rect.color.a = 0.0
color_rect.mouse_filter = Control.MOUSE_FILTER_IGNORE
loading_screen.hide()
func change_scene(scene_enum: SceneConfig.SceneName) -> void:
if not config or not config.scenes.has(scene_enum):
return
var target_scene: PackedScene = config.scenes[scene_enum]
color_rect.mouse_filter = Control.MOUSE_FILTER_STOP
var tween_in = create_tween()
tween_in.tween_property(color_rect, "color:a", 1.0, transition_duration)
await tween_in.finished
loading_screen.show()
await get_tree().process_frame
get_tree().change_scene_to_packed(target_scene)
loading_screen.hide()
var tween_out = create_tween()
tween_out.tween_property(color_rect, "color:a", 0.0, transition_duration)
await tween_out.finished
color_rect.mouse_filter = Control.MOUSE_FILTER_IGNORE
func quit_game() -> void:
color_rect.mouse_filter = Control.MOUSE_FILTER_STOP
var tween = create_tween()
tween.tween_property(color_rect, "color:a", 1.0, transition_duration)
await tween.finished
get_tree().quit()

View File

@@ -0,0 +1 @@
uid://bf1f2kp8ghtei

View File

@@ -0,0 +1,44 @@
[gd_scene format=3 uid="uid://bw8hwkw55j675"]
[ext_resource type="Script" uid="uid://bf1f2kp8ghtei" path="res://core/scene_manager/scene_manager.gd" id="1_7resu"]
[ext_resource type="Resource" uid="uid://dr612tmciq8pg" path="res://core/scene_manager/scene_config.tres" id="2_vtdwt"]
[node name="SceneManager" type="CanvasLayer" unique_id=399843239]
layer = 100
script = ExtResource("1_7resu")
config = ExtResource("2_vtdwt")
[node name="ColorRect" type="ColorRect" parent="." unique_id=1075660170]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
color = Color(0, 0, 0, 0)
[node name="LoadingScreen" type="Control" parent="." unique_id=1075176512]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
[node name="Label" type="Label" parent="LoadingScreen" unique_id=887425331]
layout_mode = 1
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -169.0
offset_top = -65.0
offset_right = -20.0
offset_bottom = -20.0
grow_horizontal = 0
grow_vertical = 0
theme_override_constants/outline_size = 24
theme_override_font_sizes/font_size = 32
text = "Loading..."

View File

@@ -22,6 +22,7 @@ UIEvents="*uid://dehu28iq27mbn"
GameState="*uid://b17g2w2g101o6" GameState="*uid://b17g2w2g101o6"
CollectionManager="*uid://c3kq1qddpm8tf" CollectionManager="*uid://c3kq1qddpm8tf"
AudioManager="*uid://dcttbbavtwtsg" AudioManager="*uid://dcttbbavtwtsg"
SceneManager="*uid://bw8hwkw55j675"
[display] [display]