public void DrawScoreGrid() { using (var db = new Data.Database.AppDataContext()) { int YPos = 5; foreach (var DBClass in db.Class) { String Class = DBClass.ClassName; String Number = "0"; string Dots = ""; int NumberOfDots = ScoreBoxWidth - (Number.Length + Class.Length); for (int i = 0; i < NumberOfDots; i++) { Dots += "."; } string ScoreLine = String.Format("{0}{1}{2}", Class, Dots, Number); int ScoreLineStart = Program.Width - (2 * ScoreBoxWidth); ScoreConsole.Print(ScoreLineStart, YPos, ScoreLine); ClassScorePosition.Add(new ScoreLine { Class = Class, Position = new Point(ScoreLineStart + ScoreBoxWidth, YPos) }); YPos++; } } }
public void ClearPostScore() { foreach (var Line in ClassScorePosition) { ScoreConsole.DrawLine(new Point(Line.Position.X + 1, Line.Position.Y), new Point(Line.Position.X + ScoreBoxWidth, Line.Position.Y), Color.Black, Color.Black); } }
public void IncreaseScore(Point StartPosition, int OldScore, int NewScore, string Line) { int CurrentScore = OldScore; int Letter = 0; TypingTimer.TimerElapsed += (timer, e) => { var LetterTest = (Letter < Line.Length); var Scoretest = (CurrentScore < NewScore); if (LetterTest) { ScoreConsole.Print(StartPosition.X + 1 + Letter, StartPosition.Y, Line[Letter].ToString(), Color.Green); Letter++; } if (Scoretest) { var Score = CurrentScore++; ScoreConsole.Print(StartPosition.X - CurrentScore.ToString().Length, StartPosition.Y, CurrentScore.ToString(), Color.White); } if (!Scoretest && !LetterTest) { ScoreConsole.Components.Remove(TypingTimer); ScoreProcessing(); } }; }