Esempio n. 1
0
 public bool areDifferentcolors(Card1 c1, Card1 c2)
 //are the Cards diffrent colors
 {
     if ((c1.getType() == "Spade" || c1.getType() == "Club") && (c2.getType() == "Heart" || c2.getType() == "Diamond"))
     {
         return(true);
     }
     else if ((c2.getType() == "Spade" || c2.getType() == "Club") && (c1.getType() == "Heart" || c1.getType() == "Diamond"))
     {
         return(true);
     }
     return(false);
 }
Esempio n. 2
0
        public void removeFromSlots(PictureBox selectedC)
        {
            Console.WriteLine($"You moved {(Card1)glowingC.Tag} from the slots to under {(Card1)selectedC.Tag}");
            for (int j = 0; j < 7; j++)
            {
                if (lines[j].Contains(selectedC))
                {
                    lines[j].Add(glowingC);
                }
            }
            PictureBox tempPB = new PictureBox();

            if (((Card1)glowingC.Tag).getNum() != 1)
            {
                Card1 prevC = new Card1(((Card1)glowingC.Tag).getNum() - 1, ((Card1)glowingC.Tag).getType());
                foreach (Control PB in this.Controls)
                {
                    if (PB.Tag != null && ((PB.Tag).GetType() == typeof(Card1)) && ((Card1)PB.Tag).getType() == prevC.getType() && ((Card1)PB.Tag).getNum() == prevC.getNum())
                    {
                        tempPB = (PictureBox)PB;
                        break;
                    }
                }
                if (((Card1)glowingC.Tag).getType() == "Spade")
                {
                    slotSCount--;
                    slotSpb = tempPB;
                }
                else if (((Card1)glowingC.Tag).getType() == "Heart")
                {
                    slotHCount--;
                    slotHpb = tempPB;
                }
                else if (((Card1)glowingC.Tag).getType() == "Diamond")
                {
                    slotDCount--;
                    slotDpb = tempPB;
                }
                else if (((Card1)glowingC.Tag).getType() == "Club")
                {
                    slotCCount--;
                    slotCpb = tempPB;
                }
            }
            else
            {
                if (((Card1)selectedC.Tag).getType() == "Spade")
                {
                    slotSCount--;
                    slotSpb = null;
                }
                else if (((Card1)selectedC.Tag).getType() == "Heart")
                {
                    slotHCount--;
                    slotHpb = null;
                }
                else if (((Card1)selectedC.Tag).getType() == "Diamond")
                {
                    slotDCount--;
                    slotDpb = null;
                }
                else if (((Card1)selectedC.Tag).getType() == "Club")
                {
                    slotCCount--;
                    slotCpb = null;
                }
            }
            glowingC.Location = new Point(selectedC.Location.X, selectedC.Location.Y + 20);
            glowingC.BringToFront();
            glowingC = null;
        }