public static void PostGameData(SpaceInvaderMatch gameData) { WebClient client = new WebClient(); string serializedGameData = JsonConvert.SerializeObject(gameData); string response = client.UploadString("https://idlepeli-wa.azurewebsites.net/api/SpaceInvaderDataGames", serializedGameData); Debug.Log(response); }
public static SpaceInvaderMatch GetGameData(int id) { WebClient client = new WebClient(); string jsonResponse = client.DownloadString($"https://idlepeli-wa.azurewebsites.net/api/SpaceInvaderDataGames/{id}"); SpaceInvaderMatch data = JsonConvert.DeserializeObject <SpaceInvaderMatch>(jsonResponse); Debug.Log(data); return(data); }