private void RollButton_Click(object sender, EventArgs e) { HoldBtn.Enabled = true; // Enabled the hold button once a die has been thrown if (Pig_Single_Die_Game.PlayGame()) // If a 1 has been thrown { HoldBtn.Enabled = false; // Disable the hold button FormUpdate(); MessageBox.Show("Sorry you have thrown a 1.\nYour turn is over!\nYour score reverts to " + Pig_Single_Die_Game.GetPointsTotal(Pig_Single_Die_Game.GetNextPlayer())); } else { FormUpdate(); if (Pig_Single_Die_Game.CheckWin()) // If a player has won the game { MessageBox.Show(Pig_Single_Die_Game.GetThisPlayer() + " has won!\nWell done."); // Disable gameplay buttons until the user makes a choice whether to play again RollBtn.Enabled = false; HoldBtn.Enabled = false; // Enable the user to make a choice whether to play again GameTerminal.Enabled = true; } } }
private void HoldButton_Click(object sender, EventArgs e) { Pig_Single_Die_Game.SetThisPlayer(Pig_Single_Die_Game.GetNextPlayer()); // Move to next player HoldBtn.Enabled = false; FormUpdate(); }