Improve how popups appear
This commit is contained in:
parent
8efe18007f
commit
3980439a91
@ -12,6 +12,7 @@ use crate::{
|
|||||||
game_manager::{Game, GameManager, GameOption, GameOptionValue, NetPlayer},
|
game_manager::{Game, GameManager, GameOption, GameOptionValue, NetPlayer},
|
||||||
net::{net_stats::Stats, util::NetVector3},
|
net::{net_stats::Stats, util::NetVector3},
|
||||||
player::{DamageSource, NetTransform},
|
player::{DamageSource, NetTransform},
|
||||||
|
popup_queue::{Popup, PopupQueue},
|
||||||
ui::cli::{CliColor, CommandLinePanel},
|
ui::cli::{CliColor, CommandLinePanel},
|
||||||
weapon::WeaponType,
|
weapon::WeaponType,
|
||||||
};
|
};
|
||||||
@ -205,7 +206,13 @@ impl NetworkManager {
|
|||||||
self.run_deferred(move |s| {
|
self.run_deferred(move |s| {
|
||||||
s.signals()
|
s.signals()
|
||||||
.on_error_hosting_server()
|
.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 {
|
impl INode3D for MainMenu {
|
||||||
fn ready(&mut self) {
|
fn ready(&mut self) {
|
||||||
self.hide_popup();
|
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) {
|
fn process(&mut self, _delta: f64) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user