Advertisement
Guest User

ug

a guest
Oct 12th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.30 KB | None | 0 0
  1.           else if (Category == "Find")
  2.             {
  3.                 if (WhosTurn == 0)
  4.                 {
  5.                     for (int i = 0; i < CardsInPlay.Count; i++)
  6.                     {
  7.                         if (Selection == Buttons2[i + 2].Name)
  8.                         {
  9.                             MessageBox.Show(i.ToString());
  10.                             if (phase == 2)
  11.                             {
  12.                                 MessageBox.Show("You have selected : " + CardsInPlay[i].Name);
  13.                                 MessageBox.Show(i.ToString());
  14.                                 Buttons2[i + 2].Image = null;
  15.                                 i = Buttons2.Count;
  16.                             }
  17.                         }
  18.                     }
  19.                 }
  20.  
  21.             }
  22.             else if (Category == "ChangePhoto") //When you want to change the photo (card) on a button
  23.             {
  24.                 for (int i = 0; i < Buttons2.Count; i++)
  25.                 {
  26.  
  27.                     if (WhosTurn == 0) //In case it's player 1's turn
  28.                     {
  29.                         if (Buttons2[i].Image == null) //When the selected button has no photo (card) assigned
  30.                         {
  31.                             //Checks weither the button being checked is eligble
  32.                             if (Buttons2[i].Name == "PlayerOneCardOne" || Buttons2[i].Name == "PlayerOneCardTwo" || Buttons2[i].Name == "PlayerOneCardThree" || Buttons2[i].Name == "PlayerOneCardFour" || Buttons2[i].Name == "PlayerOneCardFive" || Buttons2[i].Name == "PlayerOneCardSix" || Buttons2[i].Name == "PlayerOneCardSeven" || Buttons2[i].Name == "PlayerOneCardEight" || Buttons2[i].Name == "PlayerOneCardNine" || Buttons2[i].Name == "PlayerOneCardTen")
  33.                             {
  34.                                 Buttons2[i].Image = Properties.Resources.TIE_FIGHTER; //Sets the proper image to the button
  35.                                 CardsInPlay[CardsInPlay.Count - 1].LinkedButton = Buttons2[i].Name; //Assign the linked button to the card
  36.                                 i = Buttons2.Count; //To break out of the loop when a photo (card) has been assigned
  37.                             }
  38.                             else //If no elligble buttons are found, that means that the player's hand is already full
  39.                             {
  40.                                 if (i > 1) //prevents the first two buttons from returning the full hand error
  41.                                 {
  42.                                     MessageBox.Show("Your hand is already full");
  43.                                 }
  44.  
  45.                             }
  46.                         }
  47.                     }
  48.                     else
  49.                     {
  50.                         if (Buttons2[i].Image == null) //When the selected button has no photo (card) assigned
  51.                         {
  52.                             //Checks weither the button being checked is eligble
  53.                             if (Buttons2[i].Name == "PlayerTwoCardOne" || Buttons2[i].Name == "PlayerTwoCardTwo" || Buttons2[i].Name == "PlayerTwoCardThree" || Buttons2[i].Name == "PlayerTwoCardFour" || Buttons2[i].Name == "PlayerTwoCardFive" || Buttons2[i].Name == "PlayerTwoCardSix" || Buttons2[i].Name == "PlayerTwoCardSeven" || Buttons2[i].Name == "PlayerTwoCardEight" || Buttons2[i].Name == "PlayerTwoCardNine" || Buttons2[i].Name == "PlayerTwoCardTen")
  54.                             {
  55.                                 Buttons2[i].Image = Properties.Resources.TIE_FIGHTER; //Sets the proper image to the button
  56.                                 CardsInPlay[CardsInPlay.Count - 1].LinkedButton = Buttons2[i].Name; //Assign the linked button to the card
  57.                                 i = Buttons2.Count; //To break out of the loop when a photo (card) has been assigned
  58.                             }
  59.                             else //If no elligble buttons are found, that means that the player's hand is already full
  60.                             {
  61.                                 if (i > 10) //prevents the first two buttons from returning the full hand error
  62.                                 {
  63.                                     MessageBox.Show("Your hand is already full");
  64.                                 }
  65.  
  66.                             }
  67.                         }
  68.                     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement