From f435c1c8ccc2b5d0bb486cfdebcb6f34721f0c77 Mon Sep 17 00:00:00 2001 From: Sofia Date: Thu, 23 Jul 2026 19:45:53 +0300 Subject: [PATCH] Properly exit game at exit --- godot/scenes/lobby.tscn | 10 ++++++++++ rust/src/ui/lobby.rs | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/godot/scenes/lobby.tscn b/godot/scenes/lobby.tscn index e2614f5..d4c50bc 100644 --- a/godot/scenes/lobby.tscn +++ b/godot/scenes/lobby.tscn @@ -160,5 +160,15 @@ grow_horizontal = 0 grow_vertical = 0 text = "Options" +[node name="exit_button" type="Button" parent="." unique_id=267703633] +layout_mode = 0 +offset_left = 43.0 +offset_top = 33.0 +offset_right = 108.0 +offset_bottom = 86.0 +theme_override_font_sizes/font_size = 32 +text = "Exit" + [connection signal="pressed" from="options_panel/options_close" to="." method="close_options"] [connection signal="pressed" from="options_button" to="." method="open_options"] +[connection signal="pressed" from="exit_button" to="." method="exit"] diff --git a/rust/src/ui/lobby.rs b/rust/src/ui/lobby.rs index ceee8a5..95e0440 100644 --- a/rust/src/ui/lobby.rs +++ b/rust/src/ui/lobby.rs @@ -209,6 +209,12 @@ impl LobbyPanel { } } + #[func] + pub fn exit(&mut self) { + GameManager::singleton().bind_mut().exit_game(); + NetworkManager::singleton().bind_mut().disconnect(); + } + fn option_changed(&mut self, key: GameOption, value: GameOptionValue) { if let Some(game) = &mut Game::singleton() { game.bind_mut().change_option(key, value);