Ejemplo n.º 1
0
        void Awake()
        {
            if (Instance == null)
            {
                DontDestroyOnLoad(gameObject);
                Instance = this;

                var descendingComparer = Comparer <float> .Create((x, y) => y.CompareTo(x));

                pastScores = new SortedList <float, string>(descendingComparer);
                readLeaderboardFromFile();

                // uncomment either one of these to pre-fill the leaderboard with scores
                // initializePlaceHolderScores();
                // initializeLargePlaceHolderScores();
            }
            else if (Instance != this)
            {
                Destroy(gameObject);
            }
        }
Ejemplo n.º 2
0
 void addNewScore(float time, string username)
 {
     localPastScores.Add(time, username);
     localNumOfLeaderboardPlayers = localPastScores.Count < maxNumOfLeaderboard ? localPastScores.Count : maxNumOfLeaderboard;
     GlobalControl.updateLeaderBoard(localPastScores, localNumOfLeaderboardPlayers);
 }