Use CloseReason correctly
This commit is contained in:
parent
037d7640dc
commit
d95746b63e
@ -3,7 +3,7 @@
|
||||
[ext_resource type="PackedScene" uid="uid://dk6l25ooah3ap" path="res://assets/SoldierM.fbx" id="1_bn1bx"]
|
||||
[ext_resource type="Texture2D" uid="uid://cbvxh8xp8ilac" path="res://assets/Soldier.png" id="2_n4j5p"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_n4j5p"]
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_smmvf"]
|
||||
resource_local_to_scene = true
|
||||
albedo_texture = ExtResource("2_n4j5p")
|
||||
texture_filter = 0
|
||||
@ -31,4 +31,4 @@ bones/20/rotation = Quaternion(-0.14214668, -0.45634764, -0.17772992, 0.86020535
|
||||
bones/22/position = Vector3(0.012593047, -0.0085772155, 0.0021641199)
|
||||
|
||||
[node name="Soldier_Male_Mesh" parent="Soldier/Skeleton3D" index="0" unique_id=1117347105]
|
||||
surface_material_override/0 = SubResource("StandardMaterial3D_n4j5p")
|
||||
surface_material_override/0 = SubResource("StandardMaterial3D_smmvf")
|
||||
|
||||
@ -112,14 +112,16 @@ impl INode for NetworkManager {
|
||||
|
||||
while let Some(message) = self.poll() {
|
||||
match &message {
|
||||
PeerMessage::Disconnected(_, connection_error) => {
|
||||
PeerMessage::Disconnected(_, connection_error, reason) => {
|
||||
if !self.is_host() {
|
||||
let message = if let Some(err) = connection_error {
|
||||
format!("{}", err)
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
self.signals().on_client_disconnected().emit(&message);
|
||||
self.signals()
|
||||
.on_client_disconnected()
|
||||
.emit(&format!("{}", reason), &message);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
@ -136,7 +138,7 @@ impl NetworkManager {
|
||||
#[signal]
|
||||
pub fn lobby_joined();
|
||||
#[signal]
|
||||
pub fn on_client_disconnected(error: GString);
|
||||
pub fn on_client_disconnected(reason: GString, error: GString);
|
||||
#[signal]
|
||||
pub fn on_error_hosting_server(error: GString);
|
||||
|
||||
|
||||
@ -31,9 +31,12 @@ impl NetworkManager {
|
||||
.clone();
|
||||
self.update_nick(default_name.clone());
|
||||
}
|
||||
teanet::PeerMessage::Disconnected(connection, connection_error) => {
|
||||
teanet::PeerMessage::Disconnected(connection, connection_error, reason) => {
|
||||
cli.bind_mut().publish_message(
|
||||
format!("Disconnected from: {}", connection.address),
|
||||
format!(
|
||||
"Disconnected from: {}, reason: {}",
|
||||
connection.address, reason
|
||||
),
|
||||
CliColor::Info,
|
||||
);
|
||||
if let Some(err) = &connection_error {
|
||||
@ -288,9 +291,12 @@ impl NetworkManager {
|
||||
);
|
||||
}
|
||||
}
|
||||
teanet::PeerMessage::Disconnected(connection, connection_error) => {
|
||||
teanet::PeerMessage::Disconnected(connection, connection_error, reason) => {
|
||||
cli.bind_mut().publish_message(
|
||||
format!("Client disconnected: {}", connection.address),
|
||||
format!(
|
||||
"Client {} disconnected, reason: {}",
|
||||
connection.address, reason
|
||||
),
|
||||
CliColor::Info,
|
||||
);
|
||||
if let Some(err) = &connection_error {
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 22b08b78dd0a292cb3fa0eee3da4ef9375ee98e0
|
||||
Subproject commit bcc44fa10ed03f14e99aef8880b05d2c11cfa7a8
|
||||
Loading…
Reference in New Issue
Block a user