private void frmYamb_Shown(object sender, EventArgs e) { try { Serializer serializer = new Serializer(); Highscore highscore = serializer.DeSerializeObject("db.dat"); Highscore.GetInstance().Highscores = highscore.Highscores; Highscore.GetInstance().HighscoreTables = highscore.HighscoreTables; } catch (Exception) { MessageBox.Show("The application has no access to db.dat file or the file is corrupted!\nReinstall the program to a location where they are no administrator rights necessary.\neg.: C:\\"); this.Close(); } frmWelcomeScreen welcome = new frmWelcomeScreen(); DialogResult res = welcome.ShowDialog(); if (res == DialogResult.OK) { game = new Game(welcome.Player); lbl_player.Text = welcome.Player; } else { this.Close(); } }
private void newPlayerToolStripMenuItem_Click(object sender, EventArgs e) { frmWelcomeScreen welcome = new frmWelcomeScreen(); DialogResult res = welcome.ShowDialog(); if (res == DialogResult.OK) { game = new Game(welcome.Player); lbl_player.Text = welcome.Player; StartNewGame(); } }
private void StartNewGame() { game = new Game(game.Player); YambTable.ResetInstance(); Control.ControlCollection fields = gb_Table.Controls; foreach (PictureBox field in fields) { if (field.Enabled) { field.Image = null; } } InitializeDiceOutput(); InitializePointOutput(); lbl_msg.ForeColor = Color.ForestGreen; lbl_msg.Text = "Throw the dice! Throw the dice! Throw the dice!"; ResetDiceThrowDisplay(); picBox_dice1.BackColor = Color.Transparent; picBox_dice2.BackColor = Color.Transparent; picBox_dice3.BackColor = Color.Transparent; picBox_dice4.BackColor = Color.Transparent; picBox_dice5.BackColor = Color.Transparent; }