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

Commit 08ce71a

Browse files
Tell master server when game starts / lobby destroyed
1 parent caec435 commit 08ce71a

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

Scripts/Scenes/Lobby/SceneLobby.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,14 @@ public override void _Ready()
5454
LobbyMaxPlayers.Text = "" + CurrentLobby.MaxPlayerCount;
5555
}
5656

57-
public override void _Input(InputEvent @event)
57+
public override async void _Input(InputEvent @event)
5858
{
59-
if (Input.IsActionJustPressed("ui_cancel"))
59+
if (Input.IsActionJustPressed("ui_cancel"))
6060
{
61+
await WebClient.Post("servers/remove", new Dictionary<string, string> {
62+
{ "Ip", WebClient.ExternalIp }
63+
});
64+
6165
WebClient.Client.CancelPendingRequests();
6266
WebClient.TimerPingMasterServer.Stop();
6367
NetworkManager.GameClient.Stop();
@@ -78,6 +82,10 @@ private async void TimerCountdownCallback()
7882
{
7983
WebClient.TimerPingMasterServer.Stop();
8084

85+
await WebClient.Post("servers/remove", new Dictionary<string, string> {
86+
{ "Ip", WebClient.ExternalIp }
87+
});
88+
8189
// tell everyone game has started
8290
await NetworkManager.GameClient.Send(ClientPacketOpcode.Lobby, new CPacketLobby
8391
{
@@ -105,7 +113,7 @@ public void RemovePlayer(uint id)
105113
{
106114
if (UIPlayers.DoesNotHave(id))
107115
return;
108-
116+
109117
var uiPlayer = UIPlayers[id];
110118
uiPlayer.QueueFree();
111119
UIPlayers.Remove(id);

0 commit comments

Comments
 (0)