diff --git a/core/audio/audio_manager.gd b/core/audio/audio_manager.gd index 2d0a6f0..f95324f 100644 --- a/core/audio/audio_manager.gd +++ b/core/audio/audio_manager.gd @@ -1,5 +1,7 @@ extends Node +signal volume_changed(bus_name: StringName, linear_value: float) + const MIN_VOLUME: float = 0.0 const MAX_VOLUME: float = 1.0 @@ -17,6 +19,7 @@ func set_audio_bus_volume(bus_name: StringName, linear_value: float) -> void: GameState.save_data.audio_bus_volumes[normalized_bus_name] = clamped_value _apply_audio_bus_volume(normalized_bus_name, clamped_value) GameState.save_game() + volume_changed.emit(bus_name, clamped_value) func get_audio_bus_volume(bus_name: StringName, default_value: float = 1.0) -> float: return float(GameState.save_data.audio_bus_volumes.get(str(bus_name), default_value)) diff --git a/core/game_menu/audio_option.gd b/core/game_menu/audio_option.gd index 42ef7df..2fde41b 100644 --- a/core/game_menu/audio_option.gd +++ b/core/game_menu/audio_option.gd @@ -28,6 +28,7 @@ func _ready() -> void: slider.max_value = MAX_VOLUME slider.step = 0.01 slider.value_changed.connect(_on_slider_value_changed) + AudioManager.volume_changed.connect(_on_audio_manager_volume_changed) refresh() func refresh() -> void: @@ -65,3 +66,7 @@ func _set_bus_volume(linear_value: float) -> void: func _on_slider_value_changed(value: float) -> void: _set_bus_volume(value) + +func _on_audio_manager_volume_changed(changed_bus_name: StringName, volume: float) -> void: + if changed_bus_name == bus_name: + slider.set_value_no_signal(volume) diff --git a/core/game_menu/game_menu.gd b/core/game_menu/game_menu.gd index a8d6eb0..e3e47af 100644 --- a/core/game_menu/game_menu.gd +++ b/core/game_menu/game_menu.gd @@ -5,19 +5,27 @@ extends Control func _ready() -> void: for tab: GameMenuTab in tabs: - tab.on_tab_selected.connect(_on_tab_pressed) + tab.on_tab_selected.connect(on_tab_pressed) - tabs[0].select_without_animation() - pages[0].show() + on_tab_pressed(0, true) -func _on_tab_pressed(index: int): +func on_tab_pressed(index: int, disable_animation: bool = false) -> void: for page in pages: page.hide() for tab in tabs: if tab.index == index: - tab.select() + if disable_animation: + tab.select_without_animation() + else: + tab.select() else: - tab.deselect() + if disable_animation: + tab.deselect_without_animation() + else: + tab.deselect() pages[index].show() + +func _on_resume_button_on_button_pressed() -> void: + hide() diff --git a/core/game_menu/game_menu.tscn b/core/game_menu/game_menu.tscn index 65d1826..1f94771 100644 --- a/core/game_menu/game_menu.tscn +++ b/core/game_menu/game_menu.tscn @@ -20,6 +20,14 @@ grow_vertical = 2 mouse_filter = 2 script = ExtResource("1_57vaj") +[node name="Panel" type="Panel" parent="." unique_id=992567199] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + [node name="Tabs" type="HBoxContainer" parent="." unique_id=1745270897] layout_mode = 1 offset_left = 1138.0 @@ -75,3 +83,8 @@ layout_mode = 1 unique_name_in_owner = true visible = false layout_mode = 1 + +[connection signal="on_button_pressed" from="Pages/Page3/OptionMenu/VBoxContainer/ResumeButton" to="." method="_on_resume_button_on_button_pressed"] + +[editable path="Pages/Page3"] +[editable path="Pages/Page3/OptionMenu"] diff --git a/core/game_menu/game_menu_tab.gd b/core/game_menu/game_menu_tab.gd index 36c23eb..b1b8dd2 100644 --- a/core/game_menu/game_menu_tab.gd +++ b/core/game_menu/game_menu_tab.gd @@ -38,6 +38,10 @@ func deselect(): func select_without_animation(): is_selected = true texture.position.y = -bob_height + +func deselect_without_animation(): + is_selected = false + texture.position.y = 0 func _move_up(): if hover_tween: hover_tween.kill() diff --git a/core/game_state/game_state.gd b/core/game_state/game_state.gd index e95a1e7..8478080 100644 --- a/core/game_state/game_state.gd +++ b/core/game_state/game_state.gd @@ -6,6 +6,10 @@ signal on_game_paused signal on_game_resumed @warning_ignore("unused_signal") signal on_photo_highlighted(teture: Texture) +@warning_ignore("unused_signal") +signal on_enable_photo_mode_request +@warning_ignore("unused_signal") +signal on_disable_photo_mode_request const SAVE_PATH: String = "user://savegame.json" diff --git a/core/main_scene_ui/assets/weather_test.png b/core/main_scene_ui/assets/weather_test.png new file mode 100644 index 0000000..089c57b Binary files /dev/null and b/core/main_scene_ui/assets/weather_test.png differ diff --git a/core/main_scene_ui/assets/weather_test.png.import b/core/main_scene_ui/assets/weather_test.png.import new file mode 100644 index 0000000..dc6062e --- /dev/null +++ b/core/main_scene_ui/assets/weather_test.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dldg826x1kkoe" +path="res://.godot/imported/weather_test.png-b32f5910d510365f593b180d50dbe815.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://core/main_scene_ui/assets/weather_test.png" +dest_files=["res://.godot/imported/weather_test.png-b32f5910d510365f593b180d50dbe815.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 diff --git a/core/main_scene_ui/audio_player.gd b/core/main_scene_ui/audio_player.gd new file mode 100644 index 0000000..6259ef2 --- /dev/null +++ b/core/main_scene_ui/audio_player.gd @@ -0,0 +1,43 @@ +extends Control + +@export var radio: Radio + +@onready var track_label: Label = $%TrackLabel + +func _ready() -> void: + if radio: + radio.track_changed.connect(_on_radio_track_changed) + if radio.stream and radio.stream.resource_path: + track_label.text = radio.stream.resource_path.get_file().get_basename().capitalize() + else: + track_label.text = "Unknown Track" + +func _on_radio_track_changed(track_name: String) -> void: + track_label.text = track_name + +func _on_prev_track_icon_button_on_pressed() -> void: + if radio: + radio.prev_track() + + +func _on_play_pause_icon_button_on_pressed() -> void: + radio.toggle_pause() + #if radio.stream_paused: + #button_pause_resume.text = "Resume" + #else: + #button_pause_resume.text = "Pause" + + +func _on_next_track_icon_button_on_pressed() -> void: + if radio: + radio.next_track() + + +func _on_increase_volume_icon_button_on_pressed() -> void: + var current_vol = AudioManager.get_audio_bus_volume("Music", 1.0) + AudioManager.set_audio_bus_volume("Music", current_vol + 0.1) + + +func _on_decrease_volume_icon_button_on_pressed() -> void: + var current_vol = AudioManager.get_audio_bus_volume("Music", 1.0) + AudioManager.set_audio_bus_volume("Music", current_vol - 0.1) diff --git a/core/main_scene_ui/audio_player.gd.uid b/core/main_scene_ui/audio_player.gd.uid new file mode 100644 index 0000000..60b9c7e --- /dev/null +++ b/core/main_scene_ui/audio_player.gd.uid @@ -0,0 +1 @@ +uid://c4kekqicrv4m8 diff --git a/core/main_scene_ui/audio_player.tscn b/core/main_scene_ui/audio_player.tscn new file mode 100644 index 0000000..b5ba34a --- /dev/null +++ b/core/main_scene_ui/audio_player.tscn @@ -0,0 +1,142 @@ +[gd_scene format=3 uid="uid://dg4f3v0ukpmay"] + +[ext_resource type="Script" uid="uid://c4kekqicrv4m8" path="res://core/main_scene_ui/audio_player.gd" id="1_i2mrl"] +[ext_resource type="PackedScene" uid="uid://2tqofxxxnvhv" path="res://core/main_scene_ui/icon_button.tscn" id="1_ucnyb"] + +[node name="AudioPlayer" type="Control" unique_id=425192018] +custom_minimum_size = Vector2(292, 142) +layout_mode = 3 +anchor_right = 0.15208334 +anchor_bottom = 0.13148148 +offset_right = -292.0 +offset_bottom = -142.0 +script = ExtResource("1_i2mrl") +metadata/_edit_use_anchors_ = true + +[node name="HBoxContainer" type="HBoxContainer" parent="." unique_id=1300382168] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer" unique_id=1923985665] +layout_mode = 2 +metadata/_edit_use_anchors_ = true + +[node name="TrackLabel" type="Label" parent="HBoxContainer/VBoxContainer" unique_id=1430240022] +unique_name_in_owner = true +layout_mode = 2 +theme_override_font_sizes/font_size = 42 +text = "Test Test" +horizontal_alignment = 1 + +[node name="IconButtonsRow" type="HBoxContainer" parent="HBoxContainer/VBoxContainer" unique_id=1734127019] +layout_mode = 2 +size_flags_vertical = 3 +alignment = 1 + +[node name="PrevTrackIconButton" parent="HBoxContainer/VBoxContainer/IconButtonsRow" unique_id=1750448019 instance=ExtResource("1_ucnyb")] +unique_name_in_owner = true +custom_minimum_size = Vector2(80, 80) +layout_mode = 2 +size_flags_horizontal = 0 +size_flags_vertical = 3 + +[node name="Texture" parent="HBoxContainer/VBoxContainer/IconButtonsRow/PrevTrackIconButton" index="0" unique_id=1071359322] +custom_minimum_size = Vector2(80, 80) +anchor_left = 0.0 +anchor_top = 0.24999991 +anchor_right = 1.0 +anchor_bottom = 0.7499999 +offset_left = 116.66667 +offset_top = 108.14813 +offset_right = -116.666664 +offset_bottom = -108.14813 + +[node name="PlayPauseIconButton" parent="HBoxContainer/VBoxContainer/IconButtonsRow" unique_id=1533336956 instance=ExtResource("1_ucnyb")] +unique_name_in_owner = true +custom_minimum_size = Vector2(80, 80) +layout_mode = 2 +size_flags_horizontal = 0 +size_flags_vertical = 3 + +[node name="Texture" parent="HBoxContainer/VBoxContainer/IconButtonsRow/PlayPauseIconButton" index="0" unique_id=1071359322] +custom_minimum_size = Vector2(80, 80) +anchor_left = 0.0 +anchor_top = 0.24999991 +anchor_right = 1.0 +anchor_bottom = 0.7499999 +offset_left = 116.66667 +offset_top = 108.14813 +offset_right = -116.666664 +offset_bottom = -108.14813 + +[node name="NextTrackIconButton" parent="HBoxContainer/VBoxContainer/IconButtonsRow" unique_id=2108379455 instance=ExtResource("1_ucnyb")] +unique_name_in_owner = true +custom_minimum_size = Vector2(80, 80) +layout_mode = 2 +size_flags_horizontal = 0 +size_flags_vertical = 3 + +[node name="Texture" parent="HBoxContainer/VBoxContainer/IconButtonsRow/NextTrackIconButton" index="0" unique_id=1071359322] +custom_minimum_size = Vector2(80, 80) +anchor_left = 0.0 +anchor_top = 0.24999991 +anchor_right = 1.0 +anchor_bottom = 0.7499999 +offset_left = 116.66667 +offset_top = 108.14813 +offset_right = -116.666664 +offset_bottom = -108.14813 + +[node name="VBoxContainer2" type="VBoxContainer" parent="HBoxContainer" unique_id=1843266535] +layout_mode = 2 +size_flags_vertical = 4 + +[node name="IncreaseVolumeIconButton" parent="HBoxContainer/VBoxContainer2" unique_id=1788399963 instance=ExtResource("1_ucnyb")] +custom_minimum_size = Vector2(40, 40) +layout_mode = 2 +size_flags_horizontal = 0 +size_flags_vertical = 3 + +[node name="Texture" parent="HBoxContainer/VBoxContainer2/IncreaseVolumeIconButton" index="0" unique_id=1071359322] +custom_minimum_size = Vector2(40, 40) +anchor_left = 0.25 +anchor_top = 0.35915482 +anchor_right = 0.75 +anchor_bottom = 0.64084494 +offset_left = 96.66667 +offset_top = 92.64813 +offset_right = -96.666664 +offset_bottom = -92.64813 + +[node name="DecreaseVolumeIconButton" parent="HBoxContainer/VBoxContainer2" unique_id=399629327 instance=ExtResource("1_ucnyb")] +custom_minimum_size = Vector2(40, 40) +layout_mode = 2 +size_flags_horizontal = 0 +size_flags_vertical = 3 + +[node name="Texture" parent="HBoxContainer/VBoxContainer2/DecreaseVolumeIconButton" index="0" unique_id=1071359322] +custom_minimum_size = Vector2(40, 40) +anchor_left = 0.25 +anchor_top = 0.35915482 +anchor_right = 0.75 +anchor_bottom = 0.64084494 +offset_left = 96.66667 +offset_top = 92.64813 +offset_right = -96.666664 +offset_bottom = -92.64813 + +[connection signal="on_pressed" from="HBoxContainer/VBoxContainer/IconButtonsRow/PrevTrackIconButton" to="." method="_on_prev_track_icon_button_on_pressed"] +[connection signal="on_pressed" from="HBoxContainer/VBoxContainer/IconButtonsRow/PlayPauseIconButton" to="." method="_on_play_pause_icon_button_on_pressed"] +[connection signal="on_pressed" from="HBoxContainer/VBoxContainer/IconButtonsRow/NextTrackIconButton" to="." method="_on_next_track_icon_button_on_pressed"] +[connection signal="on_pressed" from="HBoxContainer/VBoxContainer2/IncreaseVolumeIconButton" to="." method="_on_increase_volume_icon_button_on_pressed"] +[connection signal="on_pressed" from="HBoxContainer/VBoxContainer2/DecreaseVolumeIconButton" to="." method="_on_decrease_volume_icon_button_on_pressed"] + +[editable path="HBoxContainer/VBoxContainer/IconButtonsRow/PrevTrackIconButton"] +[editable path="HBoxContainer/VBoxContainer/IconButtonsRow/PlayPauseIconButton"] +[editable path="HBoxContainer/VBoxContainer/IconButtonsRow/NextTrackIconButton"] +[editable path="HBoxContainer/VBoxContainer2/IncreaseVolumeIconButton"] +[editable path="HBoxContainer/VBoxContainer2/DecreaseVolumeIconButton"] diff --git a/core/main_scene_ui/icon_button.gd b/core/main_scene_ui/icon_button.gd new file mode 100644 index 0000000..df20e6c --- /dev/null +++ b/core/main_scene_ui/icon_button.gd @@ -0,0 +1,22 @@ +@tool +extends Control + +class_name IconButton + +signal on_pressed + +@export var image: Texture: + set(value): + image = value + if is_inside_tree() and has_node("%Texture"): + $%Texture.texture = image + + +func _ready(): + if image != null and has_node("%Texture"): + $%Texture.texture = image + + +func _on_gui_input(event: InputEvent) -> void: + if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed: + on_pressed.emit() diff --git a/core/main_scene_ui/icon_button.gd.uid b/core/main_scene_ui/icon_button.gd.uid new file mode 100644 index 0000000..faee11d --- /dev/null +++ b/core/main_scene_ui/icon_button.gd.uid @@ -0,0 +1 @@ +uid://bpbgecvan0a5k diff --git a/core/main_scene_ui/icon_button.tscn b/core/main_scene_ui/icon_button.tscn new file mode 100644 index 0000000..93e8216 --- /dev/null +++ b/core/main_scene_ui/icon_button.tscn @@ -0,0 +1,35 @@ +[gd_scene format=3 uid="uid://2tqofxxxnvhv"] + +[ext_resource type="Script" uid="uid://bpbgecvan0a5k" path="res://core/main_scene_ui/icon_button.gd" id="1_r8gxt"] +[ext_resource type="Texture2D" uid="uid://dldg826x1kkoe" path="res://core/main_scene_ui/assets/weather_test.png" id="1_upldh"] + +[node name="IconButton" type="Control" unique_id=1750448019] +custom_minimum_size = Vector2(160, 160) +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_r8gxt") + +[node name="Texture" type="TextureRect" parent="." unique_id=1071359322] +unique_name_in_owner = true +custom_minimum_size = Vector2(160, 160) +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.45833334 +anchor_top = 0.42592594 +anchor_right = 0.5416667 +anchor_bottom = 0.5740741 +offset_left = 80.0 +offset_top = 79.99997 +offset_right = -80.0 +offset_bottom = -80.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("1_upldh") +expand_mode = 1 +metadata/_edit_use_anchors_ = true + +[connection signal="gui_input" from="." to="." method="_on_gui_input"] diff --git a/core/main_scene_ui/icon_buttons_row.gd b/core/main_scene_ui/icon_buttons_row.gd new file mode 100644 index 0000000..50bc8ae --- /dev/null +++ b/core/main_scene_ui/icon_buttons_row.gd @@ -0,0 +1,46 @@ +extends HBoxContainer + +signal on_option_changed + +@onready var current_icon_button: IconButton +@onready var icon_buttons_options: Array[IconButton] + +var is_menu_open: bool = false + + +func _ready() -> void: + for i in range(get_child_count()): + var icon_button: IconButton = get_child(i) + if i == 0: + current_icon_button = icon_button + icon_button.on_pressed.connect(on_current_icon_button_pressed) + else: + icon_buttons_options.append(icon_button) + icon_button.on_pressed.connect(_on_icon_pressed_changed.bind(icon_button)) + + +func _on_icon_pressed_changed(in_icon_button: IconButton): + for icon_button in icon_buttons_options: + if icon_button == in_icon_button: + current_icon_button.image = in_icon_button.image + on_option_changed.emit() + break + hide_options() + + +func on_current_icon_button_pressed() -> void: + if is_menu_open: + hide_options() + else: + show_options() + is_menu_open = !is_menu_open + + +func show_options() -> void: + for icon_button in icon_buttons_options: + icon_button.show() + + +func hide_options() -> void: + for icon_button in icon_buttons_options: + icon_button.hide() diff --git a/core/main_scene_ui/icon_buttons_row.gd.uid b/core/main_scene_ui/icon_buttons_row.gd.uid new file mode 100644 index 0000000..1757cdb --- /dev/null +++ b/core/main_scene_ui/icon_buttons_row.gd.uid @@ -0,0 +1 @@ +uid://cpf5rwmd0kaa6 diff --git a/core/main_scene_ui/icon_buttons_row.tscn b/core/main_scene_ui/icon_buttons_row.tscn new file mode 100644 index 0000000..99b64be --- /dev/null +++ b/core/main_scene_ui/icon_buttons_row.tscn @@ -0,0 +1,43 @@ +[gd_scene format=3 uid="uid://ir8nke8o6ssm"] + +[ext_resource type="PackedScene" uid="uid://2tqofxxxnvhv" path="res://core/main_scene_ui/icon_button.tscn" id="1_lnxme"] +[ext_resource type="Script" uid="uid://cpf5rwmd0kaa6" path="res://core/main_scene_ui/icon_buttons_row.gd" id="1_xq3mw"] + +[node name="IconButtonsRow" type="HBoxContainer" unique_id=1734127019] +custom_minimum_size = Vector2(800, 0) +size_flags_vertical = 3 +script = ExtResource("1_xq3mw") + +[node name="IconButton" parent="." unique_id=1750448019 instance=ExtResource("1_lnxme")] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 0 +size_flags_vertical = 3 + +[node name="IconButton2" parent="." unique_id=638856991 instance=ExtResource("1_lnxme")] +unique_name_in_owner = true +visible = false +layout_mode = 2 +size_flags_horizontal = 0 +size_flags_vertical = 3 + +[node name="IconButton3" parent="." unique_id=1662483962 instance=ExtResource("1_lnxme")] +unique_name_in_owner = true +visible = false +layout_mode = 2 +size_flags_horizontal = 0 +size_flags_vertical = 3 + +[node name="IconButton4" parent="." unique_id=1375190490 instance=ExtResource("1_lnxme")] +unique_name_in_owner = true +visible = false +layout_mode = 2 +size_flags_horizontal = 0 +size_flags_vertical = 3 + +[node name="IconButton5" parent="." unique_id=315412403 instance=ExtResource("1_lnxme")] +unique_name_in_owner = true +visible = false +layout_mode = 2 +size_flags_horizontal = 0 +size_flags_vertical = 3 diff --git a/core/main_scene_ui/main_menu_ui.gd b/core/main_scene_ui/main_menu_ui.gd new file mode 100644 index 0000000..4e6ca20 --- /dev/null +++ b/core/main_scene_ui/main_menu_ui.gd @@ -0,0 +1,15 @@ +extends Control + +@onready var game_menu: Control = $%GameMenu + +func _on_menu_icon_button_on_pressed() -> void: + game_menu.show() + + +func _on_photo_icon_button_on_pressed() -> void: + GameState.on_enable_photo_mode_request.emit() + + +func _on_collectible_icon_button_on_pressed() -> void: + game_menu.on_tab_pressed(1, true) + game_menu.show() diff --git a/core/main_scene_ui/main_menu_ui.gd.uid b/core/main_scene_ui/main_menu_ui.gd.uid new file mode 100644 index 0000000..ffccd99 --- /dev/null +++ b/core/main_scene_ui/main_menu_ui.gd.uid @@ -0,0 +1 @@ +uid://bhad1id8jr8jw diff --git a/core/main_scene_ui/main_menu_ui.tscn b/core/main_scene_ui/main_menu_ui.tscn new file mode 100644 index 0000000..8cf660f --- /dev/null +++ b/core/main_scene_ui/main_menu_ui.tscn @@ -0,0 +1,99 @@ +[gd_scene format=3 uid="uid://bei7fscn77p1p"] + +[ext_resource type="PackedScene" uid="uid://ir8nke8o6ssm" path="res://core/main_scene_ui/icon_buttons_row.tscn" id="1_87dkt"] +[ext_resource type="Script" uid="uid://bhad1id8jr8jw" path="res://core/main_scene_ui/main_menu_ui.gd" id="1_aurcl"] +[ext_resource type="PackedScene" uid="uid://2tqofxxxnvhv" path="res://core/main_scene_ui/icon_button.tscn" id="1_fjauj"] +[ext_resource type="PackedScene" uid="uid://dqqm4o8j45tr6" path="res://core/game_menu/game_menu.tscn" id="4_7q818"] +[ext_resource type="PackedScene" uid="uid://cpeyt1dgrtglc" path="res://core/radio/radio.tscn" id="5_21kh1"] +[ext_resource type="PackedScene" uid="uid://dg4f3v0ukpmay" path="res://core/main_scene_ui/audio_player.tscn" id="6_1h1a0"] +[ext_resource type="AudioStream" uid="uid://70cc8she43re" path="res://docs/gyms/radio/lofi_01.ogg" id="6_vhlrw"] + +[node name="MainMenuUi" type="Control" unique_id=1359391222] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_aurcl") + +[node name="VBoxContainer" type="VBoxContainer" parent="." unique_id=2071886807] +custom_minimum_size = Vector2(160, 320) +layout_mode = 1 +anchors_preset = 2 +anchor_top = 1.0 +anchor_bottom = 1.0 +offset_top = -320.0 +offset_right = 160.0 +grow_vertical = 0 + +[node name="TimeOfDayRow" parent="VBoxContainer" unique_id=1734127019 instance=ExtResource("1_87dkt")] +layout_mode = 2 + +[node name="WeatherRow" parent="VBoxContainer" unique_id=1803637359 instance=ExtResource("1_87dkt")] +layout_mode = 2 + +[node name="IconButton6" parent="VBoxContainer/WeatherRow" unique_id=1750448019 instance=ExtResource("1_fjauj")] +unique_name_in_owner = true +visible = false +layout_mode = 2 +size_flags_horizontal = 0 +size_flags_vertical = 3 + +[node name="MenuIconButton" parent="." unique_id=707872474 instance=ExtResource("1_fjauj")] +layout_mode = 1 +anchors_preset = 1 +anchor_left = 1.0 +anchor_bottom = 0.0 +offset_left = -160.0 +offset_bottom = 160.0 +grow_horizontal = 0 +grow_vertical = 1 + +[node name="CollectionOptions" type="VBoxContainer" parent="." unique_id=542153805] +layout_mode = 1 +anchors_preset = 6 +anchor_left = 1.0 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +offset_left = -40.0 +offset_top = -20.0 +offset_bottom = 20.0 +grow_horizontal = 0 +grow_vertical = 2 + +[node name="PhotoIconButton" parent="CollectionOptions" unique_id=1863476241 instance=ExtResource("1_fjauj")] +layout_mode = 2 + +[node name="CollectibleIconButton" parent="CollectionOptions" unique_id=520235552 instance=ExtResource("1_fjauj")] +layout_mode = 2 + +[node name="GameMenu" parent="." unique_id=2124096517 instance=ExtResource("4_7q818")] +unique_name_in_owner = true +visible = false +layout_mode = 1 + +[node name="Radio" parent="." unique_id=1234112225 instance=ExtResource("5_21kh1")] +playlist = Array[AudioStream]([ExtResource("6_vhlrw")]) + +[node name="AudioPlayer" parent="." unique_id=425192018 node_paths=PackedStringArray("radio") instance=ExtResource("6_1h1a0")] +layout_mode = 1 +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -292.0 +offset_top = -142.0 +offset_right = 0.0 +offset_bottom = 0.0 +grow_horizontal = 0 +grow_vertical = 0 +radio = NodePath("../Radio") + +[connection signal="on_pressed" from="MenuIconButton" to="." method="_on_menu_icon_button_on_pressed"] +[connection signal="on_pressed" from="CollectionOptions/PhotoIconButton" to="." method="_on_photo_icon_button_on_pressed"] +[connection signal="on_pressed" from="CollectionOptions/CollectibleIconButton" to="." method="_on_collectible_icon_button_on_pressed"] + +[editable path="VBoxContainer/WeatherRow"] diff --git a/core/photo_mode/runtime/photo_mode_controller.gd b/core/photo_mode/runtime/photo_mode_controller.gd index e4e1c52..038cf0a 100644 --- a/core/photo_mode/runtime/photo_mode_controller.gd +++ b/core/photo_mode/runtime/photo_mode_controller.gd @@ -9,32 +9,48 @@ extends Node3D @export_group("Ref") @export var rotation_target: Node3D +@export var iso_camera: Node3D @onready var camera: Camera3D = $%Camera3D var total_yaw: float = 0.0 -var total_pitch: float = 0.0 -var orbit_distance: float = 0.0 var current_pan: Vector2 = Vector2.ZERO var is_active: bool = false +var previous_camera: Camera3D + +var initial_local_pos: Vector3 +var initial_local_basis: Basis func _ready() -> void: - total_yaw = global_rotation.y - total_pitch = global_rotation.x + GameState.on_enable_photo_mode_request.connect(enable_photo_mode) + GameState.on_disable_photo_mode_request.connect(disable_photo_mode) - if rotation_target: - orbit_distance = global_position.distance_to(rotation_target.global_position) + initial_local_pos = position + initial_local_basis = basis -func _unhandled_input(event: InputEvent) -> void: +func enable_photo_mode() -> void: + is_active = true + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) + previous_camera = get_viewport().get_camera_3d() + + total_yaw = 0.0 + current_pan = Vector2.ZERO + + if camera: + camera.make_current() + +func disable_photo_mode() -> void: + is_active = false + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) + if previous_camera: + previous_camera.make_current() + +func _input(event: InputEvent) -> void: if event.is_action_pressed("toggle_photo_mode"): - is_active = !is_active - - #get_tree().paused = is_active - - if !is_active: - Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) + if not is_active: + enable_photo_mode() else: - Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) + disable_photo_mode() if event is InputEventMouseMotion and is_active: total_yaw -= event.relative.x * rotation_speed @@ -43,14 +59,12 @@ func _unhandled_input(event: InputEvent) -> void: take_photo_async() func _process(delta: float) -> void: - if not rotation_target: + if not is_active: return - var pan_input = Input.get_vector("photo_pan_left", "photo_pan_right", "photo_pan_up", "photo_pan_down") - var rot_basis = Basis.from_euler(Vector3(total_pitch, total_yaw, 0)) - if pan_input != Vector2.ZERO and is_active: + if pan_input != Vector2.ZERO: current_pan.x += pan_input.x * pan_speed * delta current_pan.y += -pan_input.y * pan_speed * delta @@ -58,15 +72,13 @@ func _process(delta: float) -> void: current_pan.x = clampf(current_pan.x, movement_bounds.position.x, movement_bounds.position.x + movement_bounds.size.x) current_pan.y = clampf(current_pan.y, movement_bounds.position.y, movement_bounds.position.y + movement_bounds.size.y) - var right_dir = rot_basis.x.normalized() - var up_dir = rot_basis.y.normalized() + var rotated_basis = Basis(Vector3.UP, total_yaw) * initial_local_basis + var rotated_pos = Basis(Vector3.UP, total_yaw) * initial_local_pos - var final_pan_offset = (right_dir * current_pan.x) + (up_dir * current_pan.y) + var local_pos = rotated_pos + (rotated_basis.x * current_pan.x) + (rotated_basis.y * current_pan.y) - var orbit_pos = rotation_target.global_position + (rot_basis * Vector3(0, 0, orbit_distance)) - - global_position = orbit_pos + final_pan_offset - global_basis = rot_basis + position = local_pos + basis = rotated_basis.orthonormalized() func take_photo_async() -> void: if !is_active: diff --git a/core/photo_mode/runtime/photo_mode_controller.tscn b/core/photo_mode/runtime/photo_mode_controller.tscn index d048e34..6b0630b 100644 --- a/core/photo_mode/runtime/photo_mode_controller.tscn +++ b/core/photo_mode/runtime/photo_mode_controller.tscn @@ -5,6 +5,13 @@ [node name="PhotoModeController" type="Node3D" unique_id=695158870] process_mode = 3 script = ExtResource("1_uhpya") +movement_bounds = AABB(-20, -20, 0, 40, 30, 0) -[node name="Camera3D" type="Camera3D" parent="." unique_id=1369039645] +[node name="Camera3D" type="Camera3D" parent="." unique_id=1044424562] unique_name_in_owner = true +transform = Transform3D(1, 0, 0, 0, 0.99999994, 0, 0, 0, 0.99999994, 0, 0, 0) +projection = 1 +fov = 96.6 +size = 35.0 +near = 0.001 +far = 500.0 diff --git a/core/radio/radio.gd b/core/radio/radio.gd index 0cdaf0f..5c79d5c 100644 --- a/core/radio/radio.gd +++ b/core/radio/radio.gd @@ -2,11 +2,16 @@ extends AudioStreamPlayer class_name Radio +signal track_changed(track_name: String) + + @export var playlist: Array[AudioStream] = [] var current_track_index: int = 0 func _ready(): finished.connect(next_track) + if !playlist.is_empty(): + play_track(0) func play_track(index: int = current_track_index): if playlist.is_empty(): @@ -14,6 +19,10 @@ func play_track(index: int = current_track_index): current_track_index = posmod(index, playlist.size()) stream = playlist[current_track_index] + if stream and stream.resource_path: + track_changed.emit(stream.resource_path.get_file().get_basename().capitalize()) + else: + track_changed.emit("Unknown Track") play() stream_paused = false diff --git a/core/scene_manager/scene_config.gd b/core/scene_manager/scene_config.gd index 2d53629..de99aea 100644 --- a/core/scene_manager/scene_config.gd +++ b/core/scene_manager/scene_config.gd @@ -3,5 +3,4 @@ extends Resource enum SceneName { MAIN_MENU, GAME } -@export var scenes: Dictionary[SceneName, PackedScene] = { -} +@export var scenes: Dictionary[SceneName, PackedScene] diff --git a/core/scene_manager/scene_config.tres b/core/scene_manager/scene_config.tres index 7a878e5..e585995 100644 --- a/core/scene_manager/scene_config.tres +++ b/core/scene_manager/scene_config.tres @@ -2,7 +2,7 @@ [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"] +[ext_resource type="PackedScene" uid="uid://vjf4bdxd8saj" path="res://tgcc/main_scene.tscn" id="2_prsyo"] [resource] script = ExtResource("1_km45g") diff --git a/tgcc/main_scene.tscn b/tgcc/main_scene.tscn index 9bcb603..07fae64 100644 --- a/tgcc/main_scene.tscn +++ b/tgcc/main_scene.tscn @@ -48,6 +48,8 @@ [ext_resource type="PackedScene" uid="uid://0kgjaqijaqku" path="res://docs/museums/biome_generator/rails.tscn" id="46_lbmv2"] [ext_resource type="PackedScene" uid="uid://dn1btv0e0ses7" path="res://core/fireworks.tscn" id="47_q7p65"] [ext_resource type="Script" uid="uid://cx2tlvxhvatj5" path="res://docs/museums/daynight/control.gd" id="48_r5xyi"] +[ext_resource type="PackedScene" uid="uid://bei7fscn77p1p" path="res://core/main_scene_ui/main_menu_ui.tscn" id="49_exdk1"] +[ext_resource type="PackedScene" uid="uid://vni5kjalum6d" path="res://core/photo_mode/runtime/photo_mode_controller.tscn" id="50_57hhv"] [sub_resource type="FastNoiseLite" id="FastNoiseLite_wjpfq"] fractal_lacunarity = 1.915 @@ -172,6 +174,12 @@ mesh = SubResource("BoxMesh_xtogr") [node name="cameras" parent="." unique_id=310254818 instance=ExtResource("35_f2l8p")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 28.635147, 0) +[node name="PhotoModeController" parent="cameras" unique_id=695158870 node_paths=PackedStringArray("rotation_target", "iso_camera") instance=ExtResource("50_57hhv")] +transform = Transform3D(0.57785755, -0.57709646, 0.5770964, 0, 0.7071067, 0.7071068, -0.8161376, -0.40860704, 0.40860695, 225, 290, 173.7) +movement_bounds = AABB(-20, -20, 0, 40, 30, 0) +rotation_target = NodePath("../pivot") +iso_camera = NodePath("../camera_iso") + [node name="DayNight" parent="." unique_id=1611939731 node_paths=PackedStringArray("camera_pivot") instance=ExtResource("36_qwsp8")] camera_pivot = NodePath("../cameras") thunder_sounds = Array[AudioStream]([SubResource("AudioStreamMP3_ra0ar"), SubResource("AudioStreamMP3_j8mxr"), ExtResource("37_pdfkp"), ExtResource("38_fpbvh"), ExtResource("39_hxtdl")]) @@ -212,6 +220,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -91.191925, 0, 539.03174) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -312.19193, 0, 349.03174) [node name="Control" type="Control" parent="." unique_id=630650980] +visible = false layout_mode = 3 anchors_preset = 0 offset_right = 40.0 @@ -442,6 +451,8 @@ theme_override_colors/font_hover_pressed_color = Color(1, 1, 1, 1) theme_override_colors/font_outline_color = Color(1, 1, 1, 1) text = "Update Rails" +[node name="MainMenuUi" parent="." unique_id=1359391222 instance=ExtResource("49_exdk1")] + [connection signal="toggled" from="Control/Snow" to="Control" method="_on_snow_toggled"] [connection signal="toggled" from="Control/Rain" to="Control" method="_on_rain_toggled"] [connection signal="toggled" from="Control/Wind" to="Control" method="_on_wind_toggled"] @@ -457,3 +468,5 @@ text = "Update Rails" [connection signal="pressed" from="Control/RandomWeather" to="Control" method="_on_random_weather_pressed"] [connection signal="toggled" from="Control/Fog" to="Control" method="_on_fog_toggled"] [connection signal="pressed" from="Control/UpdateRails" to="Control" method="_on_update_rails_pressed"] + +[editable path="cameras"]