public GameScreen(User[] ActiveUsers, bool sfx) { InitializeComponent(); _sfx = sfx; _activeUsers = ActiveUsers; quizTimer = new Stopwatch(); questionTimer1 = new Stopwatch(); QM1 = new QuestionMaker(); Q1AnsLabels = new Label[4] { UpAnswer1, DownAnswer1, LeftAnswer1, RightAnswer1 }; TPQList1 = new List <double>(); car1 = new Car(Track1, _activeUsers[0].Car); wheel1 = new Wheel(WheelBox1); if (_activeUsers.Length == 2) { Q2AnsLabels = new Label[4] { UpAnswer2, DownAnswer2, LeftAnswer2, RightAnswer2 }; questionTimer2 = new Stopwatch(); car2 = new Car(Track2, _activeUsers[1].Car); TPQList2 = new List <double>(); wheel2 = new Wheel(WheelBox2); } Cursor.Hide(); if (_sfx) { SystemSounds.Beep.Play(); } }
private void CountdownTimer_Tick(object sender, EventArgs e) { countdown--; if (countdown <= 0) { CoverLabel1.Visible = false; CoverLabel1.Text = CoverLabel2.Text = ""; if (_activeUsers.Length == 2) { CoverLabel2.Visible = false; QM2 = new QuestionMaker(); // creating this here allows the random objects in each QuestionMaker to use different seeds, as they are dependent on time } CountdownTimer.Stop(); CountdownTimer.Dispose(); quizTimer.Start(); UpdateScreenTimer_Tick(this, EventArgs.Empty);// creates a new question instantly, eliminating the possibility that a button is pressed before the timer ticks, which would cause errors UpdateScreenTimer.Start(); return; } CoverLabel1.Text = countdown.ToString(); CoverLabel2.Text = CoverLabel1.Text; if (_sfx) { SystemSounds.Beep.Play(); } }