Add popup when client disconnects
This commit is contained in:
parent
8458d37816
commit
a085c4209b
@ -1,10 +1,12 @@
|
||||
use std::net::SocketAddr;
|
||||
|
||||
use godot::obj::Singleton;
|
||||
use teanet::PeerMessage;
|
||||
|
||||
use crate::{
|
||||
game_manager::{Game, GameManager, GameOption},
|
||||
net::network_manager::{NetworkManager, Package, PeerKind},
|
||||
popup_queue::{Popup, PopupQueue},
|
||||
ui::cli::{CliColor, CommandLinePanel},
|
||||
};
|
||||
|
||||
@ -32,6 +34,18 @@ impl NetworkManager {
|
||||
format!("Error with connection: {}", err),
|
||||
CliColor::Error,
|
||||
);
|
||||
|
||||
PopupQueue::singleton().bind_mut().queue(Popup {
|
||||
title: "Error".to_owned(),
|
||||
message: err.to_string(),
|
||||
ok: true,
|
||||
});
|
||||
} else {
|
||||
PopupQueue::singleton().bind_mut().queue(Popup {
|
||||
title: "Disconnected".to_owned(),
|
||||
message: "disconnected".to_owned(),
|
||||
ok: true,
|
||||
});
|
||||
}
|
||||
peer.close();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user