Esempio n. 1
0
    IEnumerator GlobalHighscoreStuff(dreamloLeaderBoard dreamlo, GameObject gameEndObj)
    {
        yield return(new WaitForSeconds(1f));

        while (dreamlo.ToStringArray() == null)
        {
            yield return(new WaitForSeconds(0.25f));
        }

        List <dreamloLeaderBoard.Score> globalScores = dreamlo.ToListHighToLow();
        var globalHighScoreContent = gameEndObj.transform.Find("GlobalScoreList/GlobalHighscore/Viewport/Content");

        foreach (Transform child in globalHighScoreContent.transform)
        {
            Destroy(child.gameObject);
        }
        for (int i = 0; i < globalScores.Count; i++)
        {
            var score   = globalScores[i];
            var txtInst = Instantiate(textPrefab);
            txtInst.transform.SetParent(globalHighScoreContent);
            txtInst.transform.localScale = Vector3.one;
            txtInst.text = (i + 1) + " - " + score.playerName + ": " + (score.score * 0.1f).ToString("0.0");
        }
    }