@@ -8,15 +8,15 @@ namespace GodotModules.Netcode
88{
99 public class WebClient : IDisposable
1010 {
11- public static HttpClient Client { get ; set ; }
12- public static bool ConnectionAlive { get ; set ; }
13- public static Task < WebServerResponse < LobbyListing [ ] > > TaskGetServers => WebClient . Get < LobbyListing [ ] > ( "servers/get" ) ;
14- public static string ExternalIp { get ; set ; }
15- private static int FailedPingAttempts { get ; set ; }
16- public static string WEB_SERVER_IP = "localhost:4000" ;
11+ public HttpClient Client { get ; set ; }
12+ public bool ConnectionAlive { get ; set ; }
13+ public Task < WebServerResponse < LobbyListing [ ] > > TaskGetServers => Get < LobbyListing [ ] > ( "servers/get" ) ;
14+ public string ExternalIp { get ; set ; }
15+ private int FailedPingAttempts { get ; set ; }
16+ public string WEB_SERVER_IP = "localhost:4000" ;
1717 private const int WEB_PING_INTERVAL = 10000 ;
18- private static bool LogExceptions = false ;
19- public static Timer TimerPingMasterServer { get ; set ; }
18+ private bool LogExceptions = false ;
19+ public Timer TimerPingMasterServer { get ; set ; }
2020
2121 public WebClient ( )
2222 {
@@ -46,21 +46,21 @@ public WebClient()
4646 }
4747 }
4848
49- public async static Task < WebServerResponse < string > > PostError ( string errorText , string errorDescription )
49+ public async Task < WebServerResponse < string > > PostError ( string errorText , string errorDescription )
5050 => await PostAsync ( "errors/post" , new Dictionary < string , string > {
5151 { "error" , errorText } ,
5252 { "description" , errorDescription }
5353 } ) ;
5454
55- public async static Task < WebServerResponse < string > > RemoveLobbyAsync ( ) => await PostAsync ( "server/remove" , DataExternalIp ) ;
55+ public async Task < WebServerResponse < string > > RemoveLobbyAsync ( ) => await PostAsync ( "server/remove" , DataExternalIp ) ;
5656
57- public async static Task < WebServerResponse < string > > RemoveLobbyPlayerAsync ( ) => await PostAsync ( "servers/players/remove" , DataExternalIp ) ;
57+ public async Task < WebServerResponse < string > > RemoveLobbyPlayerAsync ( ) => await PostAsync ( "servers/players/remove" , DataExternalIp ) ;
5858
59- public async static Task < WebServerResponse < string > > AddLobbyPlayerAsync ( ) => await PostAsync ( "servers/players/add" , DataExternalIp ) ;
59+ public async Task < WebServerResponse < string > > AddLobbyPlayerAsync ( ) => await PostAsync ( "servers/players/add" , DataExternalIp ) ;
6060
61- private static Dictionary < string , string > DataExternalIp => new ( ) { { "Ip" , ExternalIp } } ;
61+ private Dictionary < string , string > DataExternalIp => new ( ) { { "Ip" , ExternalIp } } ;
6262
63- public async static Task < WebServerResponse < string > > AddLobbyAsync ( LobbyListing info )
63+ public async Task < WebServerResponse < string > > AddLobbyAsync ( LobbyListing info )
6464 {
6565 var values = new Dictionary < string , string >
6666 {
@@ -75,7 +75,7 @@ public async static Task<WebServerResponse<string>> AddLobbyAsync(LobbyListing i
7575 return await PostAsync ( "servers/add" , values ) ;
7676 }
7777
78- private async static Task < WebServerResponse < string > > PostAsync ( string path , Dictionary < string , string > values = null )
78+ private async Task < WebServerResponse < string > > PostAsync ( string path , Dictionary < string , string > values = null )
7979 {
8080 if ( ! ConnectionAlive )
8181 return new ( ) { Status = WebServerStatus . OFFLINE } ;
@@ -106,7 +106,7 @@ private async static Task<WebServerResponse<string>> PostAsync(string path, Dict
106106 }
107107 }
108108
109- public static async Task UpdateIsAlive ( )
109+ public async Task UpdateIsAlive ( )
110110 {
111111 try
112112 {
@@ -120,7 +120,7 @@ public static async Task UpdateIsAlive()
120120 }
121121 }
122122
123- public static async Task < WebServerResponse < T > > Get < T > ( string path )
123+ public async Task < WebServerResponse < T > > Get < T > ( string path )
124124 {
125125 if ( ! ConnectionAlive )
126126 return new ( ) { Status = WebServerStatus . OFFLINE } ;
@@ -153,7 +153,7 @@ public static async Task<WebServerResponse<T>> Get<T>(string path)
153153
154154 public async void OnTimerPingMasterServerEvent ( System . Object source , ElapsedEventArgs args )
155155 {
156- var res = await WebClient . PostAsync ( "servers/ping" , new Dictionary < string , string > { { "Name" , NetworkManager . CurrentLobby . Name } } ) ;
156+ var res = await PostAsync ( "servers/ping" , new Dictionary < string , string > { { "Name" , NetworkManager . CurrentLobby . Name } } ) ;
157157 if ( res . Status == WebServerStatus . ERROR )
158158 {
159159 FailedPingAttempts ++ ;
0 commit comments