Пример #1
0
        public void AddEntry(ScoreboardEntryData scoreboardEntryData)
        {
            ScoreboardSaveData savedScores = GetSavedScores();

            bool scoreAdded = false;

            for (int i = 0; i < savedScores.highscores.Count; i++)
            {
                if (scoreboardEntryData.entryScore > savedScores.highscores[i].entryScore)
                {
                    savedScores.highscores.Insert(i, scoreboardEntryData);
                    scoreAdded = true;
                    break;
                }
            }

            if (!scoreAdded && savedScores.highscores.Count < maxScoreboardEntries)
            {
                savedScores.highscores.Add(scoreboardEntryData);
            }

            if (savedScores.highscores.Count > maxScoreboardEntries)
            {
                savedScores.highscores.RemoveRange(maxScoreboardEntries, savedScores.highscores.Count - maxScoreboardEntries);
            }

            UpdateUI(savedScores);
            SaveScores(savedScores);
        }
Пример #2
0
        public void AddEntry(ScoreboardEntryData scoreboardEntryData)
        {
            ScoreboardSaveData savedScores = GetSavedScores();

            bool scoreAdded = false;

            //Check if the score is high enough to be added.
            for (int i = 0; i < savedScores.highscores.Count; i++)
            {
                if (testEntryScore > savedScores.highscores[i].entryScore)
                {
                    savedScores.highscores.Insert(i, scoreboardEntryData);
                    scoreAdded = true;
                    break;
                }
            }

            //Check if the score can be added to the end of the list.
            if (!scoreAdded && savedScores.highscores.Count < maxScoreboardEntries)
            {
                savedScores.highscores.Add(scoreboardEntryData);
            }

            //Remove any scores past the limit.
            if (savedScores.highscores.Count > maxScoreboardEntries)
            {
                savedScores.highscores.RemoveRange(maxScoreboardEntries, savedScores.highscores.Count - maxScoreboardEntries);
            }

            UpdateUI(savedScores);

            SaveScores(savedScores);
        }
        //public void Initialise(ScoreboardEntryData scoreEntryData)
        public void Initialise(ScoreboardEntryData scoreEntryData)
        {
            entryNameText.text  = scoreEntryData.entryName;
            entryScoreText.text = scoreEntryData.entryScore.ToString();
            entryTimeText.text  = scoreEntryData.entryTime.ToString();
            entryWaveText.text  = scoreEntryData.entryWave.ToString();


            int minute  = (int)(scoreEntryData.entryTime) / 60;
            int seconde = (int)(scoreEntryData.entryTime) % 60;

            if (seconde == 0 || seconde == 1 || seconde == 2 || seconde == 3 || seconde == 4 || seconde == 5 || seconde == 6 || seconde == 7 || seconde == 8 || seconde == 9)
            {
                entryTimeText.SetText(minute + ": 0" + seconde);
            }
            else
            {
                entryTimeText.SetText(minute + " : " + seconde);
            }
        }
Пример #4
0
 public void Initialise(ScoreboardEntryData scoreboardEntryData)
 {
     entryNameText.text  = scoreboardEntryData.entryName;
     entryScoreText.text = scoreboardEntryData.entryScore.ToString();
 }