Exemplo n.º 1
0
        /// <summary>
        /// 初始化加载要预览的卡
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            MyStoryboard msb = CardAnimation.scalXY_120(mcv_from.Children);

            msb.FillBehavior = System.Windows.Media.Animation.FillBehavior.Stop;
            msb.Completed   += (object c, EventArgs d) =>
            {
                Point start = new Point((this.ActualWidth - 56) / 2, (this.ActualHeight - 80 - 80) / 2);
                while (mcv_from.Children.Count != 0)
                {
                    CardUI card = mcv_from.Children[0] as CardUI;
                    card.getAwayFromParents();
                    mcv.Children.Add(card);
                    card.set2FrontAtk();
                    card.BeginAnimation(Canvas.LeftProperty, null);
                    card.BeginAnimation(Canvas.TopProperty, null);
                    Canvas.SetLeft(card, start.X);
                    Canvas.SetTop(card, start.Y);
                }
                setCardAutoFit();
            };
            msb.Begin();
        }
Exemplo n.º 2
0
        private void closeWin()
        {
            mcv.WhenRemoveChildren -= removeFormMcv;
            removeTheDelegateOfMCV();

            MyStoryboard msb = CardAnimation.scalXY_120();

            msb.FillBehavior = FillBehavior.HoldEnd;
            msb.Completed   += (object c, EventArgs d) =>
            {
                if (mcv_from.area == Area.MAINDECK)
                {
                    while (mcv.Children.Count != 0)
                    {
                        Random r     = new Random(40);
                        int    which = r.Next(mcv.Children.Count);
                        CardUI card  = mcv.Children[which] as CardUI;
                        card.getAwayFromParents();
                        card.set2BackAtk();
                        mcv_from.Children.Add(card);
                        card.BeginAnimation(Canvas.LeftProperty, null);
                        card.BeginAnimation(Canvas.TopProperty, null);
                        card.centerAtVerticalInParent();
                    }
                }
                else
                {
                    while (mcv.Children.Count != 0)
                    {
                        CardUI card = mcv.Children[0] as CardUI;
                        card.getAwayFromParents();
                        switch (mcv_from.area)
                        {
                        case Area.BANISH:
                        case Area.EXTRA:
                            if (card.StatusLast == Status.BACK_ATK)
                            {
                                card.set2BackAtk();
                            }
                            break;

                        default:
                            break;
                        }

                        mcv_from.Children.Add(card);
                        card.BeginAnimation(Canvas.LeftProperty, null);
                        card.BeginAnimation(Canvas.TopProperty, null);
                        card.centerAtVerticalInParent();
                    }
                }

                addTheDelegateOfMCV();

                mcv_from.AllowDrop = true;
                if (mcv_from.Children.Count == 0)
                {
                    this.Close();
                }
                else
                {
                    MyStoryboard msb0 = CardAnimation.scalXY_021(mcv_from.Children);
                    //msb0.FillBehavior = System.Windows.Media.Animation.FillBehavior.Stop;
                    msb0.Completed += (object c0, EventArgs d0) =>
                    {
                        this.Close();
                    };
                    msb0.Begin();
                }
            };
            msb.Begin(this);
        }