Add centered main menu with bokeh backdrop and Escape navigation

This commit is contained in:
Codex
2026-10-30 12:31:52 +02:00
parent 1a90e1ad21
commit 2df499ab7a
10 changed files with 208 additions and 42 deletions
+46 -1
View File
@@ -67,6 +67,17 @@ func render() -> void:
if DisplayServer.get_name() != "headless":
await RenderingServer.frame_post_draw
func escape() -> void:
var key := InputEventKey.new()
key.keycode = KEY_ESCAPE
key.physical_keycode = KEY_ESCAPE
key.pressed = true
game.get_viewport().push_input(key,true)
var release := key.duplicate()
release.pressed = false
game.get_viewport().push_input(release,true)
await render()
func capture(name: String) -> void:
if DisplayServer.get_name() != "headless":
await game.get_tree().create_timer(0.42).timeout
@@ -164,9 +175,19 @@ func run(target: Node) -> void:
if float(beat.at) < 45: next_at = minf(next_at, 45)
check(float(beat.at) + game.voice_length(beat.line) <= next_at, "Intro line fits before next cue: " + str(beat.line))
await capture("phone-menu")
check(game.menu_screen == "main" and not game.stage.smartphone.is_visible_in_tree() and not game.stage.mother_phone.is_visible_in_tree(), "Main menu hides the call interface")
check(game.menu_content.get_global_rect().get_center().distance_to(game.ui.get_global_rect().get_center()) < 2, "Main menu is centered in the viewport")
check(game.stage.menu_mode and game.stage.glow.get_shader_parameter("menu_bokeh") == 1.0, "Main menu uses the bokeh background")
check(game.action_button("start") != null and game.action_button("quit") != null, "Main menu offers start and exit")
click("settings")
check(game.menu_screen == "settings" and not game.stage.call_layout.visible, "Settings stay on the menu background")
await capture("phone-credits")
click("back_menu")
click("testing")
check(game.menu_screen == "testing", "Scene selection opens from main menu")
await capture("phone-scene-menu")
await escape()
check(game.menu_screen == "main", "Escape returns from scene selection to main menu")
game.dial_call(1,true,0,true)
check(game.dialing and not game.running, "Dial animation precedes the 90-second clock")
check_clocks("", "hidden before connection")
@@ -177,6 +198,7 @@ func run(target: Node) -> void:
check(game.running and not game.dialing and game.elapsed < 1.0, "Connection starts a fresh full attempt")
check_clocks("00:00", "first connection")
check("greeting" in game.heard, "Mother answers after connection")
check(game.menu_screen.is_empty() and game.stage.call_layout.visible and not game.stage.menu_mode, "Call restores the gameplay background")
game.stage.update(1.0)
check(game.stage.purple_level > game.stage.pink_level, "Mother lights the violet background")
await capture("phone-mother-voice")
@@ -239,7 +261,7 @@ func run(target: Node) -> void:
start(2)
wait_for_speech()
await render()
check(game.stage.memory_button.size.x >= 100 and game.stage.menu_button.size.x >= 80, "Header controls stay readable")
check(game.stage.memory_button.size.x >= 100 and game.action_button("menu") == null, "Call screen keeps memory without a menu button")
if DisplayServer.get_name() != "headless":
var original_size := DisplayServer.window_get_size()
DisplayServer.window_set_size(Vector2i(1366,768))
@@ -248,6 +270,19 @@ func run(target: Node) -> void:
check(game.ui.get_global_rect().encloses(game.stage.smartphone.get_global_rect()), "Katya phone fits wide viewport")
DisplayServer.window_set_size(original_size)
await render()
var chapter_before_menu: int = game.chapter
var elapsed_before_menu: float = game.elapsed
await escape()
check(game.menu_screen == "main" and game.action_button("resume") != null, "Escape opens menu during a call")
check(not game.stage.call_layout.visible and game.action_button("keys_search") == null, "Menu hides gameplay choices")
await capture("phone-menu-during-call")
at(elapsed_before_menu + 1.0)
check(game.elapsed >= elapsed_before_menu + 1.0 and game.running, "Call clock continues in menu")
click("resume")
check(game.menu_screen.is_empty() and game.stage.call_layout.visible and game.chapter == chapter_before_menu, "Resume restores the same call")
await escape()
await escape()
check(game.menu_screen.is_empty() and game.running, "Escape also returns directly to the call")
var cloud_rect: Rect2 = game.stage.choice_scroll.get_global_rect()
check(cloud_rect.position.y > game.transcript_scroll.get_global_rect().position.y, "Answers below central dialogue")
for child in game.command_list.get_children():
@@ -541,6 +576,16 @@ func run(target: Node) -> void:
click("close_messages")
check(game.action_button("next") != null, "Inbox returns to production ending")
game.qa_mode = true
start(2)
await escape()
game.qa_mode = false
at(90.1)
await game.get_tree().create_timer(9.0).timeout
check(game.impacted and game.menu_screen == "main", "Impact and ending transition preserve the open menu")
check(game.action_button("resume").text == "Итоги звонка", "Menu updates its return action after disconnect")
click("resume")
check(game.menu_screen.is_empty() and game.action_button("next") != null, "Menu returns to the completed call outcome")
game.qa_mode = true
if "--phone-real-time" in OS.get_cmdline_user_args():
await realtime_check()
var file := FileAccess.open(directory().path_join("phone-result.json"), FileAccess.WRITE)