public List <HighScoreEntry> GetScores(string tspName, int orderType, string gameName = AntAlgorithmManager.GameName, int numberOfEntries = AntAlgorithmManager.NumHighScoreEntries) { Debug.Log("Retrieving High Scores..."); ReadHighScoresFinished = false; Result = new List <HighScoreEntry>(); var url = HighscoreURL + "tsp=" + WWW.EscapeURL(tspName) + "&num=" + numberOfEntries + "&order=" + orderType; print(url); WWW hsGet = WebFunctions.Get(url); if (!string.IsNullOrEmpty(hsGet.error)) { print("There was an error getting the high score: " + hsGet.error); } else { foreach (var line in hsGet.text.Split(new[] { "<br>" }, StringSplitOptions.RemoveEmptyEntries)) { var entry = HighScoreEntry.Create(line); if (entry != null) { Result.Add(entry); } } } ReadHighScoresFinished = true; return(Result); }
public IEnumerator ScoresWebGL() { Result = new List <HighScoreEntry>(); ReadHighScoresFinished = false; string tspName = PlayerPrefs.GetString("TspName"); int orderType = ORDER_TYPE_ASC; string timespan = PlayerPrefs.GetString("TimeSpan"); int numberOfEntries = AntAlgorithmManager.NumHighScoreEntries; var url = HighscoreURL + "tsp=" + WWW.EscapeURL(tspName) + "&num=" + numberOfEntries + "&order=" + orderType + "×pan=" + timespan; WWW www = new WWW(url); yield return(www); if (!string.IsNullOrEmpty(www.error)) { print("There was an error getting the high score: " + www.error); } else { foreach (var line in www.text.Split(new[] { "<br>" }, StringSplitOptions.RemoveEmptyEntries)) { var entry = HighScoreEntry.Create(line); if (entry != null) { Result.Add(entry); } } } ReadHighScoresFinished = true; }