public bool CheckInsertHighScore(Score s)
        {
            bool Inserted = false;

            List<Score> scores = store.Scores;

            if (IsHighScore(s.PlayerScore))
            {
                for (int i = 0; i < scores.Count; i++)
                {
                    if (s.PlayerScore >= scores[i].PlayerScore)
                    {
                        Inserted = true;
                        scores.Insert(i, s);
                        break;
                    }
                }

                // we need only top 'n' most high scores
                if (scores.Count > MaxScores)
                {
                    // remove last entry
                    scores.RemoveAt(scores.Count - 1);
                }
            }

            SaveScores();

            return Inserted;
        }
Exemple #2
0
        private void doneInput(IAsyncResult result)
        {
            string name = Guide.EndShowKeyboardInput(result);
            Score s = new Score
            {
                PlayerName = name,
                PlayerScore = RunningScore
            };

            game.ScoreManager.CheckInsertHighScore(s);

            reset();
            game.UnPauseGame();
            game.SetCurrentScreen(3);
        }