//Purpose: When Clicked it set the names for the three players //and will check to see if all three boxes have names in them //Requires: Nothing //Returns: Nothing private void Set_Name_Click(object sender, EventArgs e) { { Playeronename.Clear(); playertwoname.Clear(); Playerthreename.Clear(); //Conditional Statement to check and see if the enter three names into the text box if (Player1_textBox.Text == "" || playertwo_TextBox.Text == "" || Playerthree_textBox.Text == "") { MessageBox.Show("Must enter a name for all Players", "Missing a Name or Names!", MessageBoxButtons.OK); } else { p1.pName = Player1_textBox.Text; //sets name for player one Playeronename.AppendText(p1.pName); //outputs name for player one p2.pName = playertwo_TextBox.Text; //sets name for player two playertwoname.AppendText(p2.pName); //outputs name for player two p3.pName = Playerthree_textBox.Text; //sets name for player three Playerthreename.AppendText(p3.pName); //outputs name for player three //Hides Boxes and labels that are no longer needed Set_Name.Hide(); Player1_textBox.Hide(); playertwo_TextBox.Hide(); Playerthree_textBox.Hide(); Playerthree_label.Hide(); Playertwo_Label.Hide(); Playerone_Label.Hide(); rounds(); //calls the round function to begin round one } } }
//Purpose: When Clicked it will output the instructions for the game //and show and hide any components that is needed //Requires: Nothing //Returns: Nothing private void Play_Button_Click(object sender, EventArgs e) { Question_Box.Show(); Question_Box.Font = new Font("Arial", 15, FontStyle.Regular); Question_Box.AppendText(string.Format("Welcome to the Press Your Luck Game!")); Question_Box.AppendText(string.Format(" This is a Game Played with Three Players!")); Question_Box.AppendText(string.Format(" You will first answer four trivia questions.")); Question_Box.AppendText(string.Format(" After that starting with player.")); Question_Box.AppendText(string.Format(" earn money")); Question_Box.AppendText(string.Format(" by spinning a randomly moving board.")); Question_Box.AppendText(string.Format(" Watch out though hit a whammy and lose it all.")); Question_Box.AppendText(string.Format("Once all names are entered please")); Question_Box.AppendText(string.Format(" hit Start Game to continue!\n")); Question_Box.AppendText(string.Format("Now, will you please enter in your name's")); Play_Button.Hide(); Set_Name.Show(); Player1_textBox.Show(); playertwo_TextBox.Show(); Playerthree_textBox.Show(); Playerthree_label.Show(); Playertwo_Label.Show(); Playerone_Label.Show(); }
//Below are the various functions used that are implemented in //the buttons listed above. //Purpose: To Hide all Components that are not //needed at the begining of the game //Requires:Nothing //Returns;Nothing private void hideComponents() { Question_Box.Hide(); Boarder_Box.Hide(); Answers_Textbox.Hide(); Answer_Button.Hide(); Start_Button.Hide(); Next_Question_Button.Hide(); SpinButton.Hide(); Begin_Spin_Round.Hide(); Spin_Round_Instruction.Hide(); Set_Name.Hide(); Player1_textBox.Hide(); playertwo_TextBox.Hide(); Playerthree_textBox.Hide(); Playerthree_label.Hide(); Playertwo_Label.Hide(); Playerone_Label.Hide(); Yes_Button.Hide(); No_Button.Hide(); Next_Round_button.Hide(); Quit_Button.Hide(); }