Beispiel #1
0
        private void FindOverCard(CardContainer deck, MouseEventArgs args)
        {
            var   frontCard = FindFrontCard(deck);
            Point point;

            if (frontCard == null)
            {
                point     = deck.TransformToAncestor(Application.Current.MainWindow).Transform(new Point(0, 0));
                frontCard = new Card()
                {
                    CurrentDeck = deck.ContainerName, CardName = null, CardShape = null, CardValue = 0
                };
            }
            else
            {
                point = frontCard.TransformToAncestor(Application.Current.MainWindow).Transform(new Point(0, 0));
            }

            if (args.GetPosition(_mainCanvas).X >= point.X && args.GetPosition(_mainCanvas).X <= point.X + deck.ActualWidth &&
                args.GetPosition(_mainCanvas).Y >= point.Y - 70 && args.GetPosition(_mainCanvas).Y <= point.Y + deck.ActualHeight + 70)
            {
                if (_gameViewModel.ValidateCard(frontCard.CurrentDeck, frontCard.CardName, frontCard.CardShape, frontCard.CardValue) == DeckMatch.NotFound)
                {
                    return;
                }

                SetIsMouseOver(deck, true, frontCard);
            }
            else
            {
                SetIsMouseOver(deck, false, frontCard);
            }
        }
Beispiel #2
0
        private void FindOverDeck(CardContainer deck, MouseEventArgs args)
        {
            var point = deck.TransformToAncestor(Application.Current.MainWindow)
                        .Transform(new Point(0, 0));

            if (args.GetPosition(_mainCanvas).X >= point.X && args.GetPosition(_mainCanvas).X <= point.X + deck.ActualWidth &&
                args.GetPosition(_mainCanvas).Y >= point.Y - 70 && args.GetPosition(_mainCanvas).Y <= point.Y + deck.ActualHeight + 70)
            {
                if (_gameViewModel.ValidateDeck(deck.ContainerName) == DeckMatch.NotFound)
                {
                    return;
                }

                SetIsMouseOver(deck, true);
            }
            else
            {
                SetIsMouseOver(deck, false);
            }
        }