Properly exit game at exit
This commit is contained in:
parent
a085c4209b
commit
f435c1c8cc
@ -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"]
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user