public IEnumerator GetScores()
    {
        highScores = "";
        WWW www = new WWW(dreamloWebserviceURL + leaderboardCode + "/pipe");

        yield return(www);

        highScores = www.text;

        Debug.Log("highScores: " + highScores);

        string[] rows = highScores.Split(new char[] { '\n' }, System.StringSplitOptions.RemoveEmptyEntries);

        for (int i = 0; i < rows.Length && i < leaderboardCells.Count; i++)
        {
            string[] values = rows[i].Split(new char[] { '|' }, System.StringSplitOptions.None);

            Debug.Log("name: " + values[0]);

            LeaderBoardCell cell = leaderboardCells[i];

            cell.UpdateProperties(long.Parse(values[1]), 10000000000, values[0]);
        }

        // loadingBar.SetActive(false);
    }
示例#2
0
    public void LoadLeaderboard()
    {
        highScores = PlayerPrefs.GetString("Score");

        string[] rows = highScores.Split(new char[] { '\n' }, System.StringSplitOptions.RemoveEmptyEntries);

        rows = rows.OrderBy(r => long.Parse(r.Split(new char[] { ' ' }, System.StringSplitOptions.None)[1])).Reverse().ToArray();

        for (int i = 0; i < rows.Length && i < leaderboardCells.Count; i++)
        {
            string[] values = rows[i].Split(new char[] { ' ' }, System.StringSplitOptions.None);

            LeaderBoardCell cell = leaderboardCells[i];

            cell.UpdateProperties(long.Parse(values[1]), values[0]);
        }
    }