Skip to content
This repository was archived by the owner on Sep 15, 2024. It is now read-only.

Commit 06bb6a5

Browse files
Only do host stuff on host pc
1 parent d2a8336 commit 06bb6a5

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

Scripts/Scenes/Lobby/SceneLobby.cs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,22 @@ public override async void _Input(InputEvent @event)
5858
{
5959
if (Input.IsActionJustPressed("ui_cancel"))
6060
{
61-
await WebClient.Post("servers/remove", new Dictionary<string, string> {
62-
{ "Ip", WebClient.ExternalIp }
63-
});
61+
if (NetworkManager.IsHost)
62+
{
63+
await WebClient.Post("servers/remove", new Dictionary<string, string> {
64+
{ "Ip", WebClient.ExternalIp }
65+
});
66+
67+
WebClient.Client.CancelPendingRequests();
68+
WebClient.TimerPingMasterServer.Stop();
69+
70+
if (NetworkManager.GameServer != null)
71+
NetworkManager.GameServer.Stop();
72+
73+
NetworkManager.IsHost = false;
74+
}
6475

65-
WebClient.Client.CancelPendingRequests();
66-
WebClient.TimerPingMasterServer.Stop();
6776
NetworkManager.GameClient.Stop();
68-
if (NetworkManager.GameServer != null)
69-
NetworkManager.GameServer.Stop();
7077
}
7178
}
7279

0 commit comments

Comments
 (0)