полная мета-структура игры: pause + settings + save/load
Some checks failed
Godot CI / Import + smoke test (push) Failing after 13s

PAUSE-МЕНЮ (autoload PauseMenu CanvasLayer):
- ESC во время геймплея открывает оверлей с тёмным фоном
  и центральной панелью в Шиндовс-стиле.
- 4 кнопки: Продолжить / Настройки / В главное меню /
  Сохранить и выйти.
- process_mode = ALWAYS чтобы работать при tree.paused = true.
- При закрытии меню в 3D-сценах автоматически возвращает
  Input.mouse_mode = CAPTURED.
- В главном меню pause не активируется (_can_pause false).
- set_input_as_handled блокирует FPV-контроллер от перехвата
  ESC одновременно.

НАСТРОЙКИ (под-панель в Pause-меню):
- Слайдер «Чувствительность мыши» 0.001-0.010 (по умолчанию 0.0025).
- Слайдер «Громкость» 0-100% — связан с AudioServer Bus 0 Master
  через linear_to_db (audio ассетов пока нет, но шкала рабочая).
- Кнопки Назад / Применить. Применить пишет в user://settings.json.
- settings.json грузится автоматически при старте GameState._ready.

SAVE/LOAD:
- GameState.save_game(scene_path) → user://save01.json в JSON
  с player_name, прогрессом актов 1-2, ачивками, текущей сценой.
- GameState.load_game() читает и восстанавливает state, заполняет
  last_scene_path для перехода.
- has_save() / delete_save() помощники.
- Кнопка «Продолжить» в главном меню активна только если есть
  save и грузит игрока в сохранённую сцену.
- Кнопка «Новая игра» удаляет старый save и сбрасывает state.

AUTO-SAVE:
- При закрытии окна через X (NOTIFICATION_WM_CLOSE_REQUEST) —
  save_game перед quit.
- Кнопка Q в FPV-контроллере — save+quit.
- Кнопка «Сохранить и выйти» в pause-меню — save+quit.
- Кнопка «В главное меню» — save перед переходом.

FPV-КОНТРОЛЛЕР:
- mouse_sensitivity больше не локальное @export, читается из
  GameState.mouse_sensitivity каждый mouse_motion event
  (применяется живьём после Apply).
- _input → _unhandled_input чтобы PauseMenu мог перехватить ESC
  через set_input_as_handled.
- Убран ESC-toggle захвата мыши (теперь это делает PauseMenu).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dmitrii Bykov 2026-05-24 18:28:58 +03:00
parent a6f6785188
commit f8040fb399
7 changed files with 442 additions and 12 deletions

View file

@ -0,0 +1,179 @@
[gd_scene load_steps=4 format=3]
[ext_resource type="Script" path="res://scripts/ui/pause_menu.gd" id="1_pause"]
[sub_resource type="StyleBoxFlat" id="style_panel"]
bg_color = Color(0.12, 0.13, 0.16, 0.98)
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
border_color = Color(0.42, 0.44, 0.5, 1)
corner_radius_top_left = 6
corner_radius_top_right = 6
corner_radius_bottom_left = 6
corner_radius_bottom_right = 6
content_margin_left = 20.0
content_margin_top = 16.0
content_margin_right = 20.0
content_margin_bottom = 18.0
[sub_resource type="StyleBoxFlat" id="style_btn"]
bg_color = Color(0.18, 0.19, 0.23, 1)
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color(0.4, 0.42, 0.48, 1)
corner_radius_top_left = 2
corner_radius_top_right = 2
corner_radius_bottom_left = 2
corner_radius_bottom_right = 2
content_margin_left = 12.0
content_margin_top = 4.0
content_margin_right = 12.0
content_margin_bottom = 4.0
[node name="PauseMenu" type="CanvasLayer"]
layer = 100
script = ExtResource("1_pause")
[node name="BG" type="ColorRect" parent="."]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
color = Color(0, 0, 0, 0.65)
mouse_filter = 0
[node name="MainPanel" type="PanelContainer" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -110.0
offset_top = -100.0
offset_right = 110.0
offset_bottom = 100.0
theme_override_styles/panel = SubResource("style_panel")
[node name="V" type="VBoxContainer" parent="MainPanel"]
layout_mode = 2
theme_override_constants/separation = 6
[node name="Title" type="Label" parent="MainPanel/V"]
layout_mode = 2
text = "ПАУЗА"
horizontal_alignment = 1
modulate = Color(0.94, 0.71, 0.1, 1)
[node name="Spacer" type="Control" parent="MainPanel/V"]
custom_minimum_size = Vector2(0, 8)
layout_mode = 2
[node name="BtnResume" type="Button" parent="MainPanel/V"]
custom_minimum_size = Vector2(180, 28)
layout_mode = 2
theme_override_styles/normal = SubResource("style_btn")
text = "Продолжить"
[node name="BtnSettings" type="Button" parent="MainPanel/V"]
custom_minimum_size = Vector2(180, 28)
layout_mode = 2
theme_override_styles/normal = SubResource("style_btn")
text = "Настройки"
[node name="BtnMainMenu" type="Button" parent="MainPanel/V"]
custom_minimum_size = Vector2(180, 28)
layout_mode = 2
theme_override_styles/normal = SubResource("style_btn")
text = "В главное меню"
[node name="BtnQuit" type="Button" parent="MainPanel/V"]
custom_minimum_size = Vector2(180, 28)
layout_mode = 2
theme_override_styles/normal = SubResource("style_btn")
text = "Сохранить и выйти"
[node name="SettingsPanel" type="PanelContainer" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -180.0
offset_top = -110.0
offset_right = 180.0
offset_bottom = 110.0
theme_override_styles/panel = SubResource("style_panel")
[node name="V" type="VBoxContainer" parent="SettingsPanel"]
layout_mode = 2
theme_override_constants/separation = 8
[node name="Title" type="Label" parent="SettingsPanel/V"]
layout_mode = 2
text = "Настройки"
horizontal_alignment = 1
modulate = Color(0.94, 0.71, 0.1, 1)
[node name="SensRow" type="HBoxContainer" parent="SettingsPanel/V"]
layout_mode = 2
[node name="Label" type="Label" parent="SettingsPanel/V/SensRow"]
custom_minimum_size = Vector2(150, 0)
layout_mode = 2
text = "Чувствительность мыши"
[node name="Slider" type="HSlider" parent="SettingsPanel/V/SensRow"]
custom_minimum_size = Vector2(140, 18)
layout_mode = 2
min_value = 1.0
max_value = 10.0
step = 0.1
value = 2.5
[node name="Value" type="Label" parent="SettingsPanel/V/SensRow"]
custom_minimum_size = Vector2(50, 0)
layout_mode = 2
text = "0.0025"
[node name="VolRow" type="HBoxContainer" parent="SettingsPanel/V"]
layout_mode = 2
[node name="Label" type="Label" parent="SettingsPanel/V/VolRow"]
custom_minimum_size = Vector2(150, 0)
layout_mode = 2
text = "Громкость"
[node name="Slider" type="HSlider" parent="SettingsPanel/V/VolRow"]
custom_minimum_size = Vector2(140, 18)
layout_mode = 2
min_value = 0.0
max_value = 100.0
step = 1.0
value = 50.0
[node name="Value" type="Label" parent="SettingsPanel/V/VolRow"]
custom_minimum_size = Vector2(50, 0)
layout_mode = 2
text = "50%"
[node name="Spacer2" type="Control" parent="SettingsPanel/V"]
custom_minimum_size = Vector2(0, 10)
layout_mode = 2
[node name="Buttons" type="HBoxContainer" parent="SettingsPanel/V"]
layout_mode = 2
alignment = 1
theme_override_constants/separation = 8
[node name="Back" type="Button" parent="SettingsPanel/V/Buttons"]
custom_minimum_size = Vector2(100, 28)
layout_mode = 2
theme_override_styles/normal = SubResource("style_btn")
text = "Назад"
[node name="Apply" type="Button" parent="SettingsPanel/V/Buttons"]
custom_minimum_size = Vector2(100, 28)
layout_mode = 2
theme_override_styles/normal = SubResource("style_btn")
text = "Применить"