private void btn_Deal_Click(object sender, EventArgs e) { DisplayHand(CrazyEights.UserHand, tbh_user); DisplayHand(CrazyEights.ComputerHand, tbh_computer); picBox_Left.Image = Images.GetBackOfCardImage(); picBox_right.Image = Images.GetCardImage(CrazyEights.TopDiscard); CrazyEights.UserDrawCard(); CrazyEights.ActionResult text = CrazyEights.UserDrawCard(); UpdateInstructions(text.ToString(), true); DisplayHand(CrazyEights.UserHand, tbh_user); //Choose_a_suit form = new Choose_a_suit (); //form.ShowDialog(); //lbl_click_to_deal.Text = form.Getchoosenstring; }
/// <summary> /// Tells us which card, at which position was selected. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void picPlayCard_Click(object sender, EventArgs e) { // get the picturebox that was clicked PictureBox picCard = (PictureBox)sender; // determine the position of the picturebox that was clicked int columnNum = ((TableLayoutPanel)((Control)sender).Parent).GetPositionFromControl(picCard).Column; //lbl_click_to_deal.Text == CrazyEights.ActionResult(); if (CrazyEights.IsPlaying == true) { if (CrazyEights.IsUserTurn == true) { CrazyEights.UserPlayCard(columnNum); DisplayHand(CrazyEights.UserHand, tbh_user); picBox_Left.Image = Images.GetBackOfCardImage(); picBox_right.Image = Images.GetCardImage(CrazyEights.TopDiscard); CrazyEights.ActionResult text = CrazyEights.UserPlayCard(columnNum); UpdateInstructions(text.ToString(), true); if (CrazyEights.ActionResult.SuitRequired == CrazyEights.UserPlayCard(columnNum)) { Choose_a_suit form = new Choose_a_suit(); form.ShowDialog(); } } else if (CrazyEights.IsPlaying == false) { CrazyEights.ComputerAction(); DisplayHand(CrazyEights.ComputerHand, tbh_computer); picBox_Left.Image = Images.GetBackOfCardImage(); picBox_right.Image = Images.GetCardImage(CrazyEights.TopDiscard); CrazyEights.ActionResult comptext = CrazyEights.ComputerAction(); UpdateInstructions(comptext.ToString(), true); } } // ...you will need to continue this yourself in part C... // MessageBox.Show(string.Format("Clicked column {0}", columnNum)); //temporary }