void End(User winner, User loser) // used in 2p mode { double tpq1 = 0, tpq2 = 0; foreach (double qtime in TPQList1) { tpq1 += qtime; } tpq1 = tpq1 / TPQList1.Count; foreach (double qtime in TPQList2) { tpq2 += qtime; } tpq2 = tpq2 / TPQList2.Count; _activeUsers[0].CalcTPQ(tpq1); _activeUsers[1].CalcTPQ(tpq2); quizTimer.Stop(); questionTimer1.Stop(); questionTimer2.Stop(); winner.AddGame(quizTimer.Elapsed.TotalSeconds); loser.AddGame(); CoverLabel1.Text = CoverLabel2.Text = winner.Username + " Wins!"; CoverLabel1.ForeColor = CoverLabel2.ForeColor = Color.White; UpdateScreenTimer.Stop(); CoverLabel1.Show(); CoverLabel2.Show(); countdown = 0; EndWaitTimer.Start(); }
void End() // used in 1p mode { double tpq1 = 0; foreach (double qtime in TPQList1) { tpq1 += qtime; } tpq1 = tpq1 / TPQList1.Count; _activeUsers[0].CalcTPQ(tpq1); quizTimer.Stop(); questionTimer1.Stop(); UpdateScreenTimer.Stop(); //stopping the program from checking if the user is finished _activeUsers[0].AddGame(quizTimer.Elapsed.TotalSeconds); //writing to file CoverLabel1.Text = CoverLabel2.Text = "You did it!"; CoverLabel1.ForeColor = CoverLabel2.ForeColor = Color.White; CoverLabel1.Show(); CoverLabel2.Show(); countdown = 0; EndWaitTimer.Start(); }