Example #1
0
        /// <summary>
        /// Method which determines whether the card was 'dropped' 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public override void DeckViewer_DragDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetData(typeof(CardBox)) != null && this.isFull() == false)
            {

                CardBox draggedCard = (CardBox)e.Data.GetData(typeof(CardBox));


                // A logic structure which determines which panels to move the card to
                if (draggedCard != null && draggedCard.Parent.GetType() == typeof(DeckViewer))
                {
                    DeckViewer fromPanel = draggedCard.Parent as DeckViewer;
                    BoutViewer toPanel = sender as BoutViewer;

                    if (toPanel != null && fromPanel != null)
                    {
                        if (toPanel != fromPanel)
                        {
                            if(toPanel.canPlaceCard(draggedCard.Card))
                            {
                                fromPanel.RemoveCard(draggedCard.Card);
                                toPanel.AddCard(draggedCard.Card, true);
                            }
                        }
                    }

                }

            }


        }
Example #2
0
 public void canPlaceCard()
 {
     if (isNewbieMode)
     {
         foreach (Control c in playerDeckViewer.Controls)
         {
             if (boutDeckViewer.canPlaceCard((c as CardBox).Card))
             {
                 (c as CardBox).IsGrey = false;
             }
             else
             {
                 (c as CardBox).IsGrey = true;
             }
         }
     }
 }