// Iterate through the high scores list; create renderers, pass data
        // for renderers to do their thing
        void displayHighScores()
        {
            // The container and the renderer prefab both need to be hooked up!
            if (HighScoresContainer == null || HighScoreRendererPrefab == null)
            {
                return;
            }

            List <RFHighScore> scores = HighScoresManager.HighScoresList;

            // Destroy current high scores children
            RFUtils.DestroyTransformChildren(HighScoresContainer);


            for (int cnt = 0; cnt < scores.Count; cnt++)
            {
                GameObject          renderer     = Instantiate(HighScoreRendererPrefab) as GameObject;
                IRFHighScoreHandler scoreHandler = renderer.GetComponent <IRFHighScoreHandler>();
                if (scoreHandler != null)
                {
                    renderer.name = HighScoreRendererPrefab.name + "_" + (cnt + 1).ToString();
                    renderer.transform.SetParent(HighScoresContainer, false);
                    RFHighScore highScore = scores[cnt];
                    scoreHandler.SetHighScoreData(cnt + 1, highScore);
                    renderer.SetActive(true);

                    //  Check to see if the high score is a recent one added
                    //  If so, there is a little house keeping to happen
                    if (mostRecentHighScore == highScore && mostRecentHighScore != null)
                    {
                        scoreHandler.EditHighScoreStart(SelectableCharacters, HandleScoreEditUpdate);
                        if (currentHighScoreEvent != null)
                        {
                            currentHighScoreEvent.HighScoreRenderer = renderer;
                        }

                        highScoreHandler = scoreHandler;
                    }
                }
            }
        }
Beispiel #2
0
 public void UpdateColorHighScoreColor()
 {
     // Cache the color string.
     newHighScoreHTMLColor = string.Format("<color='#{0}'>", RFUtils.ColorToHex(NewScoreColor));
     displayScore();
 }