Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- else if (Category == "Find")
- {
- if (WhosTurn == 0)
- {
- for (int i = 0; i < CardsInPlay.Count; i++)
- {
- if (Selection == Buttons2[i + 2].Name)
- {
- MessageBox.Show(i.ToString());
- if (phase == 2)
- {
- MessageBox.Show("You have selected : " + CardsInPlay[i].Name);
- MessageBox.Show(i.ToString());
- Buttons2[i + 2].Image = null;
- i = Buttons2.Count;
- }
- }
- }
- }
- }
- else if (Category == "ChangePhoto") //When you want to change the photo (card) on a button
- {
- for (int i = 0; i < Buttons2.Count; i++)
- {
- if (WhosTurn == 0) //In case it's player 1's turn
- {
- if (Buttons2[i].Image == null) //When the selected button has no photo (card) assigned
- {
- //Checks weither the button being checked is eligble
- 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")
- {
- Buttons2[i].Image = Properties.Resources.TIE_FIGHTER; //Sets the proper image to the button
- CardsInPlay[CardsInPlay.Count - 1].LinkedButton = Buttons2[i].Name; //Assign the linked button to the card
- i = Buttons2.Count; //To break out of the loop when a photo (card) has been assigned
- }
- else //If no elligble buttons are found, that means that the player's hand is already full
- {
- if (i > 1) //prevents the first two buttons from returning the full hand error
- {
- MessageBox.Show("Your hand is already full");
- }
- }
- }
- }
- else
- {
- if (Buttons2[i].Image == null) //When the selected button has no photo (card) assigned
- {
- //Checks weither the button being checked is eligble
- 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")
- {
- Buttons2[i].Image = Properties.Resources.TIE_FIGHTER; //Sets the proper image to the button
- CardsInPlay[CardsInPlay.Count - 1].LinkedButton = Buttons2[i].Name; //Assign the linked button to the card
- i = Buttons2.Count; //To break out of the loop when a photo (card) has been assigned
- }
- else //If no elligble buttons are found, that means that the player's hand is already full
- {
- if (i > 10) //prevents the first two buttons from returning the full hand error
- {
- MessageBox.Show("Your hand is already full");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement