コード例 #1
0
ファイル: HighScoresTest.cs プロジェクト: ktwarogal/hopnet
        public void highscore_cleared_highscore_is_empty()
        {
            var highScores = new HighScores();
            for (int i = 0; i < 20; i++)
            {
                highScores.Add(new Score(i));
            }
            highScores.Clear();

            CollectionAssert.IsEmpty(highScores);
        }
コード例 #2
0
ファイル: HighScoresTest.cs プロジェクト: IzzyDoor/hopnet
        public void highscore_cleared_highscore_is_empty()
        {
            var highScores = new HighScores();
            for (int i = 0; i < 20; i++)
            {
                highScores.Add(new Score(i.ToString(CultureInfo.InvariantCulture), i));
            }
            highScores.Clear();

            CollectionAssert.IsEmpty(highScores);
        }
コード例 #3
0
        private void SetScoreInfo(ScoreInfo scoreInfo)
        {
            var lastScoreInfo = currentScoreInfo;

            currentScoreInfo = scoreInfo;
            lastTime         = 0;
            dispatcher.Invoke((Action)(() =>
            {
                ResetZoom();
                HighScores.Clear();
                WebHighScores.Clear();
                HighScores.Add(new KeyValuePair <DateTime, int>(XMinimum, scoreInfo.UserHighScore));
                HighScores.Add(new KeyValuePair <DateTime, int>(XMaximum, scoreInfo.UserHighScore));
                WebHighScores.Add(new KeyValuePair <DateTime, int>(XMinimum, scoreInfo.WebHighScore));
                WebHighScores.Add(new KeyValuePair <DateTime, int>(XMaximum, scoreInfo.WebHighScore));
                Score = CoolCount = GoodCount = SafeCount = SadCount = WorstCount = 0;
                UserHighScore = scoreInfo.UserHighScore;
                WebHighScore = scoreInfo.WebHighScore;
                ScoreName = currentScoreInfo.ScoreName;
                Difficulty = currentScoreInfo.Difficulty;
                if (lastScoreInfo != null && lastScoreInfo.ScoreHashAsString != currentScoreInfo.ScoreHashAsString)
                {
                    BestScores = null;
                    bestResult = ExpansionDatabase.Instance.FindResult(currentScoreInfo.ScoreHashAsString);
                    if (bestResult != null)
                    {
                        BestScores = new ObservableCollection <KeyValuePair <DateTime, int> >(bestResult.Data);
                    }
                    Scores.Clear();
                    Results.Clear();
                }
                else
                {
                    if (isBestScore)
                    {
                        BestScores = Scores;
                        bestResultInfo = currentResultInfo;
                    }
                    Scores = new ObservableCollection <KeyValuePair <DateTime, int> >();
                }
                isBestScore = false;
                UpdateScorePercent();
            }));
        }
コード例 #4
0
    public void Clear()
    {
        m_highScores.Clear();

        NotifyListeners();
    }
コード例 #5
0
 private void OnDisable()
 {
     HighScores.Clear();
     StopCoroutine(NewScoreAsync());
 }