private void NewGameButton_Click(object sender, EventArgs e) { foreach (var item in this.Controls) { // reset blocks if (item.GetType() == typeof(BrikksPictureBox)) { BrikksPictureBox box = (BrikksPictureBox)item; if (box.Name.StartsWith("Block__")) { box.Image = box.OriginalImage; box.IsMarked = false; box.IsFixed = false; } } // reset bombs else if (item.GetType() == typeof(BrikksBombButton)) { BrikksBombButton button = (BrikksBombButton)item; button.BombUsed = false; button.Enabled = true; button.Text = button.BombValue.ToString(); } // reset score lines else if (item.GetType() == typeof(BrikksScoreLineLabel)) { BrikksScoreLineLabel label = (BrikksScoreLineLabel)item; label.Text = "__"; } } DiceResultPictureBox.Image = null; }
private void UseBomb(BrikksBombButton button) { if (!button.BombUsed) { button.BombUsed = true; button.Image = Properties.Resources.cross_mark_small; button.Text = string.Empty; } }