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

Commit 38219ec

Browse files
Send external ip to master server
1 parent cd69878 commit 38219ec

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

Scripts/Scenes/Game Servers/SceneGameServers.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,20 @@ public override async void _Ready()
6262
GameManager.SpawnPopupMessage(message);
6363
}
6464

65-
await ListServers();
65+
await WebClient.UpdateIsAlive();
66+
67+
if (WebClient.ConnectionAlive)
68+
await ListServers();
6669
}
6770

6871
public override async void _Input(InputEvent @event)
6972
{
7073
await SceneManager.EscapeToScene("Menu", () =>
7174
{
7275
WebClient.Client.CancelPendingRequests();
73-
NetworkManager.GameClient.CancelTask();
76+
77+
if (NetworkManager.GameClient != null)
78+
NetworkManager.GameClient.CancelTask();
7479
});
7580
}
7681

@@ -180,16 +185,18 @@ public async Task ListServers()
180185
UIGameServersNavBtns.BtnRefresh.Disabled = false;
181186
}
182187

183-
public async void PostServer(LobbyListing info) =>
184-
await WebClient.Post("servers/post", new Dictionary<string, string>
188+
public async void PostServer(LobbyListing info)
189+
{
190+
await WebClient.Post("servers/add", new Dictionary<string, string>
185191
{
186192
{ "Name", info.Name },
187-
{ "Ip", info.Ip },
193+
{ "Ip", WebClient.ExternalIp },
188194
{ "Port", "" + info.Port },
189195
{ "Description", info.Description },
190196
{ "MaxPlayerCount", "" + info.MaxPlayerCount },
191197
{ "LobbyHost", info.LobbyHost }
192198
});
199+
}
193200

194201
private void _on_Control_resized()
195202
{

0 commit comments

Comments
 (0)