Esempio n. 1
0
        /// <summary>
        /// Used when user moves many cards on the same time between decks
        /// </summary>
        /// <param name="parent"></param>
        public virtual void AddParentCard(Card parent)
        {
            // Add parent card to this deck

            // Cards are positioned with 20 pixcels cap
            Rectangle r = parent.CardRectangle;
            Point     p = m_pos;

            p.Y                  = p.Y + (Card.CARD_CAP * m_cards.Count());
            r.Location           = p;
            parent.CardRectangle = r;
            parent.m_z           = Game1.nextZ();

            // Mark owner deck into card
            parent.OwnerDeck = this;

            // Add card into this deck
            m_cards.Add(parent);

            // Add also all parent cards into this deck
            if (parent.ParentCard != null)
            {
                AddParentCard(parent.ParentCard);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Adds new card to this deck
        /// </summary>
        /// <param name="newCard"></param>
        public virtual void AddCard(Card newCard)
        {
            // Cards are positioned with 20 pixcels cap
            Rectangle r = newCard.CardRectangle;
            Point     p = m_pos;

            p.Y                   = p.Y + (Card.CARD_CAP * m_cards.Count());
            r.Location            = p;
            newCard.CardRectangle = r;

            newCard.m_z = Game1.nextZ();

            if (m_cards.Count() > 0)
            {
                // Deck has cards
                Card lastCard = m_cards.Last();
                lastCard.ParentCard = newCard;

                if (newCard.ChildCard != null)
                {
                    // Clear previous child parent
                    newCard.ChildCard.ParentCard = null;
                    // Set new child card
                    newCard.ChildCard = lastCard;
                }
                else
                {
                    // Add new child card
                    newCard.ChildCard = lastCard;
                }
            }
            else
            {
                // Deck is empty
                if (newCard.ChildCard != null)
                {
                    // Clear previous child parent
                    newCard.ChildCard.ParentCard = null;
                }
                newCard.ChildCard = null;
            }


            // Mark owner deck into card
            newCard.OwnerDeck = this;

            // Add card into this deck
            m_cards.Add(newCard);

            // Add also all parent cards into this deck
            if (newCard.ParentCard != null)
            {
                AddParentCard(newCard.ParentCard);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Adds new card to this deck
        /// </summary>
        /// <param name="newCard"></param>
        public override void AddCard(Card newCard)
        {
            // All cards in the deck are in same position
            Rectangle r = newCard.CardRectangle;
            Point     p = m_pos;

            r.Location            = p;
            newCard.CardRectangle = r;

            newCard.m_z = Game1.nextZ();

            if (m_cards.Count() > 0)
            {
                if (newCard.ChildCard != null)
                {
                    // Clear previous child parent
                    newCard.ChildCard.ParentCard = null;
                }
            }
            else
            {
                // Deck is empty
                if (newCard.ChildCard != null)
                {
                    // Clear previous child parent
                    newCard.ChildCard.ParentCard = null;
                }
                newCard.ChildCard = null;
            }

            // Mark owner deck into card
            newCard.OwnerDeck = this;

            // Add card into this deck
            m_cards.Add(newCard);
        }