예제 #1
0
 private static void OnCardTypeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     CardCanvas canvas = d as CardCanvas;
     string cardType = e.NewValue.ToString();
     canvas._textBoxCardType.Text = cardType;
     if (cardType.Contains("Creature"))
     {
         canvas.Artwork.HorizontalAlignment = HorizontalAlignment.Right;
     }
     else if (cardType == "Spell")
     {
         canvas.Artwork.HorizontalAlignment = HorizontalAlignment.Center;
     }
 }
예제 #2
0
 private static void OnKnownToPlayerWithPriorityChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     CardCanvas canvas = d as CardCanvas;
     bool known = (bool)e.NewValue;
     if (known)
     {
         canvas._imageCardBack.Visibility = Visibility.Hidden;
         canvas.MouseEnter += canvas.AbstractCardCanvas_MouseEnter;
         canvas.MouseLeave += canvas.AbstractCardCanvas_MouseLeave;
     }
     else
     {
         canvas._imageCardBack.Visibility = Visibility.Visible;
         canvas.MouseEnter -= canvas.AbstractCardCanvas_MouseEnter;
         canvas.MouseLeave -= canvas.AbstractCardCanvas_MouseLeave;
     }
 }
예제 #3
0
 private static void OnRaceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     CardCanvas canvas = d as CardCanvas;
     if (e.NewValue != null)
     {
         string raceText = string.Join("/", (Collection<string>)e.NewValue);
         if (!string.IsNullOrEmpty(raceText))
         {
             canvas._textBoxRace.Visibility = Visibility.Visible;
             canvas._textBoxRace.Text = raceText;
         }
     }
     else
     {
         canvas._textBoxRace.Visibility = Visibility.Hidden;
     }
 }
예제 #4
0
        private static void OnKnownToPlayerWithoutPriorityChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CardCanvas canvas = d as CardCanvas;
            bool known = (bool)e.NewValue;
            if (known)
            {

                DoubleAnimation doubleAnimation = new DoubleAnimation(1.0, 0.0, new Duration(new TimeSpan(0, 0, 1)))
                {
                    AutoReverse = true,
                    RepeatBehavior = RepeatBehavior.Forever,
                };
                canvas._imageKnownToPlayerWithoutPriority.BeginAnimation(OpacityProperty, doubleAnimation);
            }
            else
            {
                canvas._imageKnownToPlayerWithoutPriority.BeginAnimation(OpacityProperty, null);
            }
        }