private void setContextMainMenu() { Controls.Clear(); state = new MainMenuStartScreen(ClientSize.Width, ClientSize.Height); MainMenuStartScreen temp = (MainMenuStartScreen)state; temp.newGame.Click += setContextNewGame; temp.tutorial.Click += setContextTutorial; temp.loadGame.Click += loadGameClick; temp.quitGame.Click += quitGame_Click; foreach (Button b in temp.buttons) { b.Font = new Font(font.Families[0], 20, FontStyle.Regular); Controls.Add(b); } Invalidate(true); }
private void quitGame_Click(Object sender, EventArgs e) { MainMenuStartScreen temp = (MainMenuStartScreen)state; temp.quitConfirm = new MessagePopup(350, 400); temp.quitConfirm.location = new Point(450, 150); Controls.Add(temp.quitConfirm.text); foreach (Button b in temp.quitConfirm.buttons) { Controls.Add(b); } foreach (Button b in temp.buttons) { b.Hide(); } Invalidate(true); temp.quitConfirm.buttonYes.Click += quit; temp.quitConfirm.buttonNo.Click += goBack; }