Improve how popups appear
This commit is contained in:
parent
b90ed53f7a
commit
d84b7fa71e
@ -12,6 +12,7 @@ use crate::{
|
||||
game_manager::{Game, GameManager, GameOption, GameOptionValue, NetPlayer},
|
||||
net::{net_stats::Stats, util::NetVector3},
|
||||
player::{DamageSource, NetTransform},
|
||||
popup_queue::{Popup, PopupQueue},
|
||||
ui::cli::{CliColor, CommandLinePanel},
|
||||
weapon::WeaponType,
|
||||
};
|
||||
@ -205,7 +206,13 @@ impl NetworkManager {
|
||||
self.run_deferred(move |s| {
|
||||
s.signals()
|
||||
.on_error_hosting_server()
|
||||
.emit(&format!("{}", err))
|
||||
.emit(&format!("{}", err));
|
||||
|
||||
PopupQueue::singleton().bind_mut().queue(Popup {
|
||||
title: "Error hosting server".to_owned(),
|
||||
message: err.to_string(),
|
||||
ok: true,
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,37 +64,6 @@ pub struct MainMenu {
|
||||
impl INode3D for MainMenu {
|
||||
fn ready(&mut self) {
|
||||
self.hide_popup();
|
||||
|
||||
NetworkManager::singleton()
|
||||
.bind_mut()
|
||||
.signals()
|
||||
.on_client_disconnected()
|
||||
.connect_other(self, |_, msg| {
|
||||
if msg.is_empty() {
|
||||
PopupQueue::singleton().bind_mut().queue(Popup {
|
||||
title: "Disconnected".to_owned(),
|
||||
message: "disconnected".to_owned(),
|
||||
ok: true,
|
||||
});
|
||||
} else {
|
||||
PopupQueue::singleton().bind_mut().queue(Popup {
|
||||
title: "Error".to_owned(),
|
||||
message: msg.to_string(),
|
||||
ok: true,
|
||||
});
|
||||
}
|
||||
});
|
||||
NetworkManager::singleton()
|
||||
.bind_mut()
|
||||
.signals()
|
||||
.on_error_hosting_server()
|
||||
.connect_other(self, |_, msg| {
|
||||
PopupQueue::singleton().bind_mut().queue(Popup {
|
||||
title: "Error hosting server".to_owned(),
|
||||
message: msg.to_string(),
|
||||
ok: true,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
fn process(&mut self, _delta: f64) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user