예제 #1
0
 public bool areFollowingNum(Card1 c1, Card1 c2)
 //are the Cards one after the other
 {
     if (c1.getNum() == c2.getNum() - 1)
     {
         return(true);
     }
     return(false);
 }
예제 #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;
        }