Add popup when client disconnects
This commit is contained in:
parent
d2c4bfa9de
commit
0aa5a8e0e9
@ -1,10 +1,12 @@
|
|||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
|
|
||||||
|
use godot::obj::Singleton;
|
||||||
use teanet::PeerMessage;
|
use teanet::PeerMessage;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
game_manager::{Game, GameManager, GameOption},
|
game_manager::{Game, GameManager, GameOption},
|
||||||
net::network_manager::{NetworkManager, Package, PeerKind},
|
net::network_manager::{NetworkManager, Package, PeerKind},
|
||||||
|
popup_queue::{Popup, PopupQueue},
|
||||||
ui::cli::{CliColor, CommandLinePanel},
|
ui::cli::{CliColor, CommandLinePanel},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -32,6 +34,18 @@ impl NetworkManager {
|
|||||||
format!("Error with connection: {}", err),
|
format!("Error with connection: {}", err),
|
||||||
CliColor::Error,
|
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();
|
peer.close();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user