Ejemplo n.º 1
0
        private bool IsCardAtInvertedPosition(double y, CardEventArgs e)
        {
            //var cardCtrl = e.OriginalSource as CardControl;
            double offset = e.MouseOffset.Y;

            if (Player.LocalPlayer.InvertedTable)
            {
                y     -= Program.GameEngine.Definition.CardHeight;
                offset = -offset;
            }
            y -= offset;
            return(IsInInvertedZone(y));
        }
Ejemplo n.º 2
0
        private void CardHovered(object sender, CardEventArgs e)
        {
            _currentCard = e.Card;
            _currentCardUpStatus = false;
            if (e.Card == null && e.CardModel == null)
            {
                _fadeOut.Begin(outerCardViewer, HandoffBehavior.SnapshotAndReplace);
                _fadeOut.Begin(outerCardViewer2, HandoffBehavior.SnapshotAndReplace);
            }
            else
            {
                Point mousePt = Mouse.GetPosition(table);
                if (mousePt.X < 0.4 * clientArea.ActualWidth)
                    outerCardViewer.HorizontalAlignment = cardViewer.HorizontalAlignment = outerCardViewer2.HorizontalAlignment = cardViewer2.HorizontalAlignment = HorizontalAlignment.Right;
                else if (mousePt.X > 0.6 * clientArea.ActualWidth)
                    outerCardViewer.HorizontalAlignment = cardViewer.HorizontalAlignment = outerCardViewer2.HorizontalAlignment = cardViewer2.HorizontalAlignment = HorizontalAlignment.Left;

                var ctrl = e.OriginalSource as CardControl;
                if (e.Card != null)
                {

                    bool up = ctrl != null && ctrl.IsAlwaysUp
                            || (e.Card.FaceUp || e.Card.PeekingPlayers.Contains(Player.LocalPlayer));

                    _currentCardUpStatus = up;

                    var img = e.Card.GetBitmapImage(up);
                    double width = ShowCardPicture(e.Card, img);
                    _newCard = true;

                    if (up && Prefs.ZoomOption == Prefs.ZoomType.OriginalAndProxy && !e.Card.IsProxy())
                    {
                        var proxyImg = e.Card.GetBitmapImage(true, true);
                        ShowSecondCardPicture(e.Card, proxyImg, width);
                    }
                }
                else
                {
                    var img = ImageUtils.CreateFrozenBitmap(new Uri(e.CardModel.GetPicture()));
                    this.ShowCardPicture(e.Card, img);
                }
            }
        }
Ejemplo n.º 3
0
    private void CardHovered(object sender, CardEventArgs e)
    {
      if (e.Card == null && e.CardModel == null)
      {
        fadeOut.Begin(outerCardViewer, HandoffBehavior.SnapshotAndReplace);
      }
      else
      {
        Point mousePt = Mouse.GetPosition(table);
        if (mousePt.X < 0.4 * clientArea.ActualWidth)
          outerCardViewer.HorizontalAlignment = cardViewer.HorizontalAlignment = HorizontalAlignment.Right;
        else if (mousePt.X > 0.6 * clientArea.ActualWidth)
          outerCardViewer.HorizontalAlignment = cardViewer.HorizontalAlignment = HorizontalAlignment.Left;

        var ctrl = e.OriginalSource as CardControl;
        BitmapImage img = e.Card != null ?
          e.Card.GetBitmapImage(ctrl != null && ctrl.IsAlwaysUp ? true : e.Card.FaceUp || e.Card.PeekingPlayers.Contains(Player.LocalPlayer)) :
          ImageUtils.CreateFrozenBitmap(new Uri(e.CardModel.Picture));
        ShowCardPicture(img);
      }
    }
Ejemplo n.º 4
0
        private void CardHovered(object sender, CardEventArgs e)
        {
            if (e.Card == null && e.CardModel == null)
            {
                _fadeOut.Begin(outerCardViewer, HandoffBehavior.SnapshotAndReplace);
            }
            else
            {
                Point mousePt = Mouse.GetPosition(table);
                if (mousePt.X < 0.4*clientArea.ActualWidth)
                    outerCardViewer.HorizontalAlignment = cardViewer.HorizontalAlignment = HorizontalAlignment.Right;
                else if (mousePt.X > 0.6*clientArea.ActualWidth)
                    outerCardViewer.HorizontalAlignment = cardViewer.HorizontalAlignment = HorizontalAlignment.Left;

                var ctrl = e.OriginalSource as CardControl;                  
                if (e.Card != null && ((Keyboard.IsKeyDown(Key.LeftAlt)) || (Keyboard.IsKeyDown(Key.RightAlt))))
                {
                    string alternate;
                    if (e.Card.IsAlternateImage)
                        alternate = e.Card.Picture.Replace(".b.jpg", ".jpg");
                    else
                        alternate = e.Card.Picture.Replace(".jpg", ".b.jpg");
                    try
                    {
                        var img = new BitmapImage();
                        img.BeginInit();
                        img.CacheOption = BitmapCacheOption.OnLoad;
                        img.UriSource = new Uri(alternate);
                        img.EndInit();
                        ShowCardPicture(img);
                    }
                    catch
                    {

                    }
                }
                else
                {
                    // TODO: Change to readable code
                    var img = e.Card != null
                                          ? e.Card.GetBitmapImage(ctrl != null && ctrl.IsAlwaysUp || (e.Card.FaceUp ||
                                                                                                      e.Card.PeekingPlayers.
                                                                                                          Contains(
                                                                                                              Player.
                                                                                                                  LocalPlayer)))
                                          : ImageUtils.CreateFrozenBitmap(new Uri(e.CardModel.Picture));
                    ShowCardPicture(img);
                }                
            }
        }