Exemple #1
0
        public Deck_Ace(int x, int y, List <Deck> deckList, Imainview refInterface)
        {
            this.refInterface = refInterface;
            this.cards        = new List <Card>();

            this.x = x;
            this.y = y;

            this.deckList = deckList;

            this.deckDefaultCard = new Card(x, y, eRank.ACE, eSUIT.SPADES, cardsdll.mdFaceDown, eBACK.THE_O, this, deckList, refInterface);

            updateNext();
        }
Exemple #2
0
        public Card(int x, int y, eRank rank, eSUIT suit, int mode, eBACK backType, Deck owner, List <Deck> deckList, Imainview refInterface)
            : base()
        {
            this.x            = x;
            this.y            = y;
            this.mode         = mode;
            this.rank         = (int)rank;
            this.suit         = (int)suit;
            this.backType     = backType;
            this.cardHandle   = new cardsdll(width, height);
            this.Size         = new Size(width, height);
            this.owner        = owner;
            this.deckList     = deckList;
            this.refInterface = refInterface;

            this.MouseDown   += new System.Windows.Forms.MouseEventHandler(this.handleMouseDown);
            this.MouseUp     += new System.Windows.Forms.MouseEventHandler(this.handleMouseUp);
            this.MouseMove   += new System.Windows.Forms.MouseEventHandler(this.handleMouseMove);
            this.DoubleClick += new EventHandler(Card_DoubleClick);
        }
Exemple #3
0
        public Form1()
        {
            Imainview refInterface = this;

            InitializeComponent();

            #region " Initializing the Decks "

            deckList.Add(new Deck_Starter(this.Size.Width / 2 - Card.width / 2, this.Size.Height / 2 - Card.height / 2, deckList, refInterface));
            deckList.Add(new Deck_Main(30, 30, deckList, refInterface));
            deckList.Add(new Deck_Drawn(deckList[1].getX() + cardSpacingX, deckList[1].getY(), deckList, refInterface));
            deckList.Add(new Deck_Ace((int)(deckList[1].getX() + cardSpacingX * 3.6), deckList[1].getY(), deckList, refInterface));
            deckList.Add(new Deck_Ace((int)(deckList[1].getX() + cardSpacingX * 4.6), deckList[1].getY(), deckList, refInterface));
            deckList.Add(new Deck_Ace((int)(deckList[1].getX() + cardSpacingX * 5.6), deckList[1].getY(), deckList, refInterface));
            deckList.Add(new Deck_Ace((int)(deckList[1].getX() + cardSpacingX * 6.6), deckList[1].getY(), deckList, refInterface));
            deckList.Add(new Deck_Column((int)(deckList[1].getX() + cardSpacingX * 0.0), deckList[1].getY() + cardSpacingY, deckList, refInterface));
            deckList.Add(new Deck_Column((int)(deckList[1].getX() + cardSpacingX * 1.1), deckList[1].getY() + cardSpacingY, deckList, refInterface));
            deckList.Add(new Deck_Column((int)(deckList[1].getX() + cardSpacingX * 2.2), deckList[1].getY() + cardSpacingY, deckList, refInterface));
            deckList.Add(new Deck_Column((int)(deckList[1].getX() + cardSpacingX * 3.3), deckList[1].getY() + cardSpacingY, deckList, refInterface));
            deckList.Add(new Deck_Column((int)(deckList[1].getX() + cardSpacingX * 4.4), deckList[1].getY() + cardSpacingY, deckList, refInterface));
            deckList.Add(new Deck_Column((int)(deckList[1].getX() + cardSpacingX * 5.5), deckList[1].getY() + cardSpacingY, deckList, refInterface));
            deckList.Add(new Deck_Column((int)(deckList[1].getX() + cardSpacingX * 6.6), deckList[1].getY() + cardSpacingY, deckList, refInterface));

            //Add each deck's default cards to the form
            for (int i = 0; i < deckList.Count(); i++)
            {
                this.Controls.Add(deckList[i].deckDefaultCard);
            }

            //special case to send the starter deck's default card to the back (transparent)
            deckList[(int)eDeck.Deck_Starter].deckDefaultCard.SendToBack();

            //Add cards to the starter deck and shuffle them
            for (int i = (int)eRank.ACE; i <= (int)eRank.KING; i++)
            {
                for (int j = (int)eSUIT.CLUBS; j <= (int)eSUIT.SPADES; j++)
                {
                    Card newCard = new Card(0, 0, (eRank)i, (eSUIT)j, cardsdll.mdFaceUp, mainBackType, deckList[(int)eDeck.Deck_Starter], deckList, refInterface);
                    deckList[(int)eDeck.Deck_Starter].manualAdd(newCard);
                    this.Controls.Add(newCard);
                }
            }

            deckList[(int)eDeck.Deck_Starter].shuffle();

            deckList[(int)eDeck.Deck_Starter].printList();

            #endregion


            #region " Deal the Cards "

            //28 cards among the 7 columns
            for (int i = 0; i < 7; i++)
            {
                for (int j = 0; j <= i; j++)
                {
                    Card toDeal = deckList[(int)eDeck.Deck_Starter].topCard();
                    toDeal.getOwner().removeTop();
                    deckList[(int)eDeck.Deck_Column1 + i].manualAdd(toDeal);
                    toDeal.BringToFront();
                    if (i != j)
                    {
                        toDeal.mode = cardsdll.mdFaceDown;
                    }
                }
            }

            //remaining 24 cards to the main deck
            for (int i = deckList[(int)eDeck.Deck_Starter].size(); i > 0; i--)
            {
                Card toDeal = deckList[(int)eDeck.Deck_Starter].topCard();
                toDeal.getOwner().removeTop();
                toDeal.BringToFront();
                toDeal.mode = cardsdll.mdFaceDown;
                deckList[(int)eDeck.Deck_Main].manualAdd(toDeal);
            }

            #endregion
        }