Properly exit game at exit

This commit is contained in:
Sofia 2026-07-23 19:45:53 +03:00
parent b5af486c40
commit 35d1fc44e5
2 changed files with 16 additions and 0 deletions

View File

@ -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"]

View File

@ -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);