Exemple #1
0
        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);
        }
Exemple #2
0
        public void ImportFromWeb(string tspFileToUse)
        {
            loadingComplete = false;
            string filePath = TspWebDirectory + tspFileToUse;

            Debug.Log(filePath);

            WWW www = WebFunctions.Get(filePath);

            if (!string.IsNullOrEmpty(www.error))
            {
                Debug.Log(" ---- DOWNLOAD DONE with ERROR ----- ");
                Debug.Log(www.error);
                loadingComplete = true;
                return;
            }
            Debug.Log(www.text);
            LoadCities(www.text);
        }