예제 #1
0
        void endHighScoreEdit()
        {
            highScoreHandler.EditHighScoreComplete( );
            // All done - Better save those scores.
            HighScoresManager.SaveHighScores(HighscoresFile);

            // Let other systems know editing is DONE!
            currentHighScoreEvent.EventType = RFHighScoreEventType.RFHIGH_SCORE_EDIT_DONE;
            onRFHighScoreEvent.Invoke(currentHighScoreEvent);
            // reset some values
            currentHighScoreEvent = null;
            mostRecentHighScore   = null;
            highScoreHandler      = null;
        }
예제 #2
0
        // 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;
                    }
                }
            }
        }