Add popup for error hosting

This commit is contained in:
Sofia 2026-07-23 19:17:26 +03:00
parent 70e9594eb0
commit d84f17ef8c
2 changed files with 14 additions and 0 deletions

View File

@ -132,6 +132,8 @@ impl NetworkManager {
pub fn lobby_joined();
#[signal]
pub fn on_client_disconnected(error: GString);
#[signal]
pub fn on_error_hosting_server(error: GString);
fn poll(&mut self) -> Option<PeerMessage<Package>> {
let mut cli = CommandLinePanel::singleton();
@ -200,6 +202,11 @@ impl NetworkManager {
Err(err) => {
cli.bind_mut()
.publish_message(format!("Error hosting server: {}", err), CliColor::Error);
self.run_deferred(move |s| {
s.signals()
.on_error_hosting_server()
.emit(&format!("{}", err))
});
}
}
}

View File

@ -73,6 +73,13 @@ impl INode3D for MainMenu {
s.show_popup("Error", &msg.to_string(), true);
}
});
NetworkManager::singleton()
.bind_mut()
.signals()
.on_error_hosting_server()
.connect_other(self, |s, msg| {
s.show_popup("Error Hosting Server", &msg.to_string(), true);
});
}
fn process(&mut self, _delta: f64) {