Esempio n. 1
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);
        }