// Start Turn

        private void animateDrawCardOWN(Models.CardWithGameProperties card)
        {
            Models.CardGUIModel      drawnCard;
            Animations.MoveAnimation animation;

            drawnCard = new Models.CardGUIModel(card, this, AnimationAndEventsConstants.ownDeckLocation, Visibility.Hidden);

            // add cards to grids
            grdParent.Children.Add(drawnCard.Border);

            if ((Phase == "Mana phase" || Phase == "Summon phase") && itIsOwnTurn)
            {
                ableToSelect.Add(drawnCard);
            }

            animation = new Animations.MoveAnimation(
                grdParent,
                grdHand,
                grdParent,
                null,
                listHand,
                drawnCard,
                AnimationAndEventsConstants.DESTINATIONOWNHAND);

            animation.startsWithHiddenOrigin = true;
            addEvent(new Event(animation));
        }
        private void animateDeckToMana(Models.CardWithGameProperties card, bool own)
        {
            Models.CardGUIModel      drawnCard;
            Animations.MoveAnimation animation;

            drawnCard = new Models.CardGUIModel(
                card,
                this,
                own == OWN ? AnimationAndEventsConstants.ownDeckLocation : AnimationAndEventsConstants.oppDeckLocation,
                Visibility.Hidden);

            // add cards to grids
            grdParent.Children.Add(drawnCard.Border);

            animation = new Animations.MoveAnimation(
                grdParent,
                own == OWN ? grdOwnMana : grdOppMana,
                grdParent,
                null,
                own == OWN ? listOwnManaZone : listOppManaZone,
                drawnCard,
                AnimationAndEventsConstants.DESTINATIONMANA);

            animation.startsWithHiddenOrigin = true;
            addEvent(new Event(animation));
        }
Пример #3
0
        public void setCard(Models.CardWithGameProperties card)
        {
            Card = card;

            try
            {
                if (Card == null)
                {
                    Image.Source = new System.Windows.Media.Imaging.BitmapImage(
                        new Uri(
                            string.Format("{0}{1}",
                                          AppDomain.CurrentDomain.BaseDirectory,
                                          cardBackPath),
                            UriKind.Absolute));
                }
                else
                {
                    Image.Source = new System.Windows.Media.Imaging.BitmapImage(
                        new Uri(
                            string.Format("{0}{1}{2}/{3}.jpg",
                                          AppDomain.CurrentDomain.BaseDirectory,
                                          cardsPath,
                                          Card.Set,
                                          Card.Name),
                            UriKind.Absolute));
                }
            }
            catch (Exception ex)
            {
                logger.Log(ex.ToString());
            }
        }
 public Models.CardWithGameProperties getCardFromInitialHand()
 {
     if (InitialHand.Count > 0)
     {
         Models.CardWithGameProperties card = InitialHand[0];
         InitialHand.RemoveAt(0);
         return(card);
     }
     return(null);
 }
Пример #5
0
        public CardGUIModel(Models.CardWithGameProperties Card_, GUIPages.GUIGameRoom parent_, Thickness margin, Visibility visibility)
        {
            logger = new Log.Logger();
            Card   = Card_;
            parent = parent_;

            // Border
            Border                     = new Border();
            Border.Width               = 73;
            Border.Height              = 100;
            Border.VerticalAlignment   = VerticalAlignment.Top;
            Border.HorizontalAlignment = HorizontalAlignment.Left;
            Border.Margin              = margin;
            Border.BorderThickness     = new Thickness(5);
            Border.BorderBrush         = Brushes.Transparent;
            Border.Visibility          = visibility;

            // Button
            Btn        = new Button();
            Btn.Style  = parent.FindResource("cardButtonStyle") as Style;
            Btn.Cursor = System.Windows.Input.Cursors.Hand;
            Btn.Click += cardButton_Click;

            Border.Child = Btn;

            // Image
            Image = new Image();
            try
            {
                if (Card == null)
                {
                    Image.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + "/Images/GUI/CardBack.png", UriKind.Absolute));
                }
                else
                {
                    Image.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + "/Images/Cards/" + Card.Name + ".png", UriKind.Absolute));
                }
            }
            catch (Exception ex)
            {
                logger.Log(ex.ToString());
            }

            Image.Stretch               = Stretch.UniformToFill;
            Image.MouseRightButtonUp   += parent.cardImage_MouseRightButtonUp;
            Image.MouseRightButtonDown += parent.cardImage_MouseRightButtonDown;

            Btn.Content = Image;
        }
Пример #6
0
        public void setCard(Models.CardWithGameProperties card)
        {
            Card = card;

            try
            {
                if (Card == null)
                {
                    Image.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + "/Images/GUI/CardBack.png", UriKind.Absolute));
                }
                else
                {
                    Image.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + "/Images/Cards/" + Card.Name + ".png", UriKind.Absolute));
                }
            }
            catch (Exception ex)
            {
                logger.Log(ex.ToString());
            }
        }
Пример #7
0
        public CardGUIModel(Models.CardWithGameProperties Card_, GUIPages.GUIGameRoom parent_, Thickness margin, Visibility visibility, int shieldNumber = -1)
        {
            logger       = new Log.Logger();
            Card         = Card_;
            parent       = parent_;
            ShieldNumber = shieldNumber;

            // Border
            Border        = new Border();
            Border.Width  = 75;
            Border.Height = 100;

            Border.VerticalAlignment   = VerticalAlignment.Top;
            Border.HorizontalAlignment = HorizontalAlignment.Left;
            Border.Margin          = margin;
            Border.BorderThickness = new Thickness(5);
            Border.BorderBrush     = Brushes.Transparent;
            Border.Visibility      = visibility;

            //Grid

            Grd = new Grid();

            // Button
            Btn        = new Button();
            Btn.Style  = parent.FindResource("cardButtonStyle") as Style;
            Btn.Cursor = System.Windows.Input.Cursors.Hand;
            Btn.Click += cardButton_Click;

            Border.Child = Grd;

            // Image
            Image = new Image();
            try
            {
                if (Card == null)
                {
                    Image.Source = new System.Windows.Media.Imaging.BitmapImage(
                        new Uri(
                            string.Format("{0}{1}",
                                          AppDomain.CurrentDomain.BaseDirectory,
                                          cardBackPath),
                            UriKind.Absolute));
                }
                else
                {
                    Image.Source = new System.Windows.Media.Imaging.BitmapImage(
                        new Uri(
                            string.Format("{0}{1}{2}/{3}.jpg",
                                          AppDomain.CurrentDomain.BaseDirectory,
                                          cardsPath,
                                          Card.Set,
                                          Card.Name),
                            UriKind.Absolute));
                }
            }
            catch (Exception ex)
            {
                logger.Log(ex.ToString());
            }

            Image.Stretch = Stretch.UniformToFill;

            Image.MouseRightButtonUp   += parent.cardImage_MouseRightButtonUp;
            Image.MouseRightButtonDown += parent.cardImage_MouseRightButtonDown;

            Btn.Content = Image;
            Grd.Children.Add(Btn);

            if (shieldNumber != -1)
            {
                // Textblock

                TxtBlock                     = new TextBlock();
                TxtBlock.Text                = shieldNumber.ToString();
                TxtBlock.FontSize            = 15;
                TxtBlock.Foreground          = Brushes.White;
                TxtBlock.FontWeight          = FontWeights.Bold;
                TxtBlock.HorizontalAlignment = HorizontalAlignment.Left;
                TxtBlock.VerticalAlignment   = VerticalAlignment.Top;
                TxtBlock.Margin              = new Thickness(10, 5, 0, 0);
                Grd.Children.Add(TxtBlock);
            }
        }