예제 #1
0
        private bool CheckIfHighScore(Score currentScore)
        {
            Score score = highScores[level - 1];
            if (highScores.Count == 0)
            {
                return true;
            }

            if (currentScore.Level == level)
            {
                if (((currentScore.Moves < score.Moves) && (currentScore.Seconds == score.Seconds)) ||
                    ((currentScore.Moves == score.Moves) && (currentScore.Seconds < score.Seconds)) ||
                    ((currentScore.Moves < score.Moves) && (currentScore.Seconds < score.Seconds)) ||
                    ((score.Moves == 0 && score.Seconds == 0)))
                {
                    if (HighScore != null && !(score.Moves == 0 && score.Seconds == 0))
                        HighScore(this, new HighScoreEventArgs(currentScore));

                    return true;
                }
            }

            return false;
        }
예제 #2
0
 public HighScoreEventArgs(Score score)
 {
     Score = score;
 }
예제 #3
0
        private void CheckForWin()
        {
            if (stacks[DiscStack.Three].Count == winCount)
            {
                //want to make sure the ui has the latest and greatest time data...
                if (LevelTimerTick != null)
                    CallTimerTickEvent();

                timer.Change(Timeout.Infinite, Timeout.Infinite);

                Score currentScore = new Score(level, moves, seconds, DateTime.Today);
                if (CheckIfHighScore(currentScore))
                {
                    highScores[level - 1] = currentScore;
                    SaveHighScores();
                }

                if (App.IsTrial && level == 6)
                {
                    if (TrialModeCompleted != null)
                        TrialModeCompleted(this, new EventArgs());

                    Reset();
                    return;
                }

                if (level == 12)
                {
                    level = 0;
                }

                level++;
                TimerCallback tcb = BeginReset;

                if (resetDelayTimer != null)
                    resetDelayTimer.Dispose();

                resetDelayTimer = new Timer(tcb, null, 1000, Timeout.Infinite);
            }
        }