Beispiel #1
0
    //Download Scores - Don't need to call directly
    IEnumerator downloadHighscoresFromDatabace()
    {
        //Submit Score to databace
        WWW www = new WWW(webURL + publicCode + "/pipe/100");

        //Wait for Upload to be compleate.
        yield return(www);

        //Make sure there where no errors with upload
        if (string.IsNullOrEmpty(www.error))
        {
            //No Errors
            FormatHighscores(www.text);
            if (highscoreDisplay != null)
            {
                highscoreDisplay.OnHighscoresDownloaded(highscoresList);
            }
            else if (addHighScore != null)
            {
                addHighScore.OnHighscoresDownloaded(highscoresList);
            }
            else
            {
                print("ERROR: null script");
            }
        }
        else
        {
            //There where Errors
            print("There was an error with the Upload");
        }
    }
    //Download Scores - Don't need to call directly
    IEnumerator downloadHighscoresFromDatabace()
    {
        //Submit Score to databace - Using the correct high score table.
        WWW www            = null;
        int leaderboardNum = PlayerPrefs.GetInt("leaderboardNum");

        if (leaderboardNum == 1)
        {
            www = new WWW(webURL + L1publicCode + "/pipe/10");
        }
        else if (leaderboardNum == 2)
        {
            www = new WWW(webURL + L2publicCode + "/pipe/10");
        }
        else
        {
            www = new WWW(webURL + L3publicCode + "/pipe/10");
        }

        //Wait for Upload to be compleate.
        yield return(www);

        //Make sure there where no errors with upload
        //If everything is good, tell the correct script that the scores have downloaded.
        if (string.IsNullOrEmpty(www.error))
        {
            //No Errors
            FormatHighscores(www.text);
            if (highscoreDisplay != null)
            {
                highscoreDisplay.OnHighscoresDownloaded(highscoresList);
            }
            else if (addHighScore != null)
            {
                addHighScore.OnHighscoresDownloaded(highscoresList);
            }
            else
            {
                print("ERROR: null script");
            }
        }
        else
        {
            //There where Errors
            print("There was an error with the Upload");
        }
    }