// Reseting the whole game private void PlayAgain() { // Create new game controls HackDayGame hackDayGame = new HackDayGame(); // Get the form Form hackDayForm = (this.Parent as Form); // Clear current form controls hackDayForm.Controls.Clear(); // Add game controls to the form hackDayGame.Dock = DockStyle.Fill; hackDayForm.Controls.Add(hackDayGame); }
// Starts the game with specified number of points private void StartGame(int pointsToWin) { // Set the amount of points to win in GameData script GameData.pointsToWin = pointsToWin; // Create new game controls HackDayGame hackDayGame = new HackDayGame(); // Get the form Form hackDayForm = (this.Parent as Form); // Clear current form controls hackDayForm.Controls.Clear(); // Add game controls to the form hackDayGame.Dock = DockStyle.Fill; hackDayForm.Controls.Add(hackDayGame); }