// </SnippetGraphicsMMButton2Handler>

        // <SnippetGraphicsMMButton3Handler>
        private void setButton3BackgroundBrushColor(object sender, EventArgs e)
        {
            // This appears to work:
            // the brush changes to blue.
            MyStoryboard.Remove(Button3);
            Button3BackgroundBrush.Color = Colors.Blue;
        }
Esempio n. 2
0
 private void MaxButton_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     this.Height = 326;
     MyStoryboard.getInstance().HeightStoryboard(border, 0, 306 > 30 * VideoList_ListBox.Items.Count + 6 ? 30 * VideoList_ListBox.Items.Count + 6 : 306, 1).Begin(this);
     MaxButton.Visibility = Visibility.Collapsed;
     MinButton.Visibility = Visibility.Visible;
 }
Esempio n. 3
0
        private async void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            MyStoryboard.Begin();

            await Task.Delay(800);

            MyStoryboard.Pause();

            await Task.Delay(1000);

            MyStoryboard.Resume();
        }
Esempio n. 4
0
        /// <summary>
        /// 改变阶段宣言按钮的边框亮度
        /// </summary>
        /// <param name="to"></param>
        /// <returns></returns>
        public static MyStoryboard ChangePhase(int to)
        {
            MyStoryboard msb = new MyStoryboard();

            msb.FillBehavior = FillBehavior.HoldEnd;
            DoubleAnimation da = new DoubleAnimation(to, TimeSpan.FromMilliseconds(300));

            msb.Children.Add(da);

            DependencyProperty[] propertyChainX = new DependencyProperty[]
            {
                Rectangle.EffectProperty,
                System.Windows.Media.Effects.DropShadowEffect.OpacityProperty,
            };
            Storyboard.SetTargetProperty(da, new PropertyPath("Opacity"));

            return(msb);
        }
Esempio n. 5
0
        public static MyStoryboard showDecksManerger(Grid gd, double star, double end, double time)
        {
            MyStoryboard       msb    = new MyStoryboard();
            DoubleAnimation    da     = new DoubleAnimation(star, end, TimeSpan.FromMilliseconds(time));
            EasingFunctionBase easing = new QuadraticEase()
            {
                EasingMode = EasingMode.EaseOut,       //公式
                //Oscillations =1,                           //滑过动画目标的次数
                //Springiness = 2                             //弹簧刚度
            };

            da.EasingFunction = easing;
            msb.Children.Add(da);
            Storyboard.SetTarget(da, gd);
            Storyboard.SetTargetProperty(da, new PropertyPath("Opacity"));

            return(msb);
        }
Esempio n. 6
0
        public void execute()
        {
            _inkcollector.RemoveButton(_myButton);
            //删除对应VideoList
            bool isHaveOther = false;

            foreach (MyButton mb in _inkcollector.Sketch.MyButtons)
            {
                if (mb.IsDeleted == false && mb != _myButton && mb.VideoPath == _myButton.VideoPath)
                {
                    isHaveOther = true;
                    break;
                }
            }
            if (!isHaveOther)
            {
                ListBoxItem deleteLBI = null;
                foreach (ListBoxItem lbi in _videoList.VideoList_ListBox.Items)
                {
                    if (lbi.Content.ToString() == _myButton.VideoFileName)
                    {
                        deleteLBI = lbi;
                    }
                }
                if (deleteLBI != null)
                {
                    _videoList.VideoList_ListBox.Items.Remove(deleteLBI);
                    int count = _videoList.VideoList_ListBox.Items.Count;
                    if (count == 0)
                    {
                        _videoList.Visibility = Visibility.Collapsed;
                    }
                    if (count > 0 && count < 11)
                    {
                        _videoList.VideoList_ListBox.Height = 30 * count + 6;
                        _videoList.Height = 30 * count + 26;
                        if (_videoList.MinButton.Visibility == Visibility.Visible)
                        {
                            MyStoryboard.getInstance().HeightStoryboard(_videoList.border, 30 * (count + 1) + 6, 30 * count + 6, 0.5).Begin(_videoList);
                        }
                    }
                }
            }
        }
Esempio n. 7
0
        public void undo()
        {
            _inkcollector.AddButton(_myButton);

            //添加对应VideoList
            bool isHaveOther = false;

            foreach (ListBoxItem lbi in _videoList.VideoList_ListBox.Items)
            {
                if (lbi.Content.ToString() == _myButton.VideoFileName)
                {
                    isHaveOther = true;
                }
            }
            if (!isHaveOther)
            {
                ListBoxItem listBoxItem = new ListBoxItem();
                listBoxItem.Height              = 30;
                listBoxItem.Width               = 144;
                listBoxItem.Content             = _myButton.VideoFileName;
                listBoxItem.Background          = _myButton.Button.Background;
                listBoxItem.BorderThickness     = new Thickness(1);
                listBoxItem.BorderBrush         = Brushes.Black;
                listBoxItem.VerticalAlignment   = VerticalAlignment.Top;
                listBoxItem.HorizontalAlignment = HorizontalAlignment.Left;
                _videoList.VideoList_ListBox.Items.Add(listBoxItem);
                int count = _videoList.VideoList_ListBox.Items.Count;
                if (count > 0)
                {
                    _videoList.Visibility = Visibility.Visible;
                }
                if (count > 0 && count < 11)
                {
                    _videoList.VideoList_ListBox.Height = 30 * count + 6;
                    _videoList.Height = 20 + 30 * count + 6;
                    if (_videoList.MinButton.Visibility == Visibility.Visible)
                    {
                        MyStoryboard.getInstance().HeightStoryboard(_videoList.border, 30 * (count - 1) + 6, 30 * count + 6, 0.5).Begin(_videoList);
                    }
                }
            }
        }
Esempio n. 8
0
        /// <summary>
        /// decksDocument的移动
        /// </summary>
        /// <param name="sp"></param>
        /// <param name="star"></param>
        /// <param name="end"></param>
        /// <param name="time"></param>
        /// <returns></returns>
        public static MyStoryboard SPmove(TabControl sp, Thickness start, Thickness end, double time)
        {
            MyStoryboard msb = new MyStoryboard();

            ThicknessAnimation ta     = new ThicknessAnimation(start, end, TimeSpan.FromMilliseconds(time));
            EasingFunctionBase easing = new QuadraticEase()
            {
                EasingMode = EasingMode.EaseOut,       //公式
                //Oscillations =1,                           //滑过动画目标的次数
                //Springiness = 2                             //弹簧刚度
            };

            ta.EasingFunction = easing;


            msb.Children.Add(ta);
            Storyboard.SetTarget(ta, sp);
            //StackPanel.MarginProperty
            Storyboard.SetTargetProperty(ta, new PropertyPath("Margin"));

            return(msb);
        }
Esempio n. 9
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();
        }
Esempio n. 10
0
        /// <summary>
        /// 卡片自适应
        /// </summary>
        private void setCardAutoFit()
        {
            double perrow = 9;

            int rows = (int)Math.Ceiling(mcv.Children.Count / perrow);

            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; perrow *i + j < mcv.Children.Count && perrow *i + j < perrow *(i + 1); j++)
                {
                    //Console.WriteLine(perrow * i + j);
                    CardUI card = mcv.Children[(int)perrow * i + j] as CardUI;
                    if (card != null)
                    {
                        Point start = new Point(Canvas.GetLeft(card), Canvas.GetTop(card));
                        Point end   = new Point(5 * (j + 1) + 56 * j, 5 * (i + 1) + 81 * i);
                        if (start.X != end.X || start.Y != end.Y)
                        {
                            card.Tag = end;
                            MyStoryboard msb = CardAnimation.CanvasXY(start, end, 300);
                            msb.card       = card;
                            msb.Completed += (object c, EventArgs d) =>
                            {
                                msb.card.BeginAnimation(Canvas.LeftProperty, null);
                                msb.card.BeginAnimation(Canvas.TopProperty, null);
                                Point set = (Point)msb.card.Tag;
                                Canvas.SetLeft(msb.card, set.X);
                                Canvas.SetTop(msb.card, set.Y);
                            };
                            msb.FillBehavior = System.Windows.Media.Animation.FillBehavior.Stop;
                            msb.Begin(card);
                        }
                    }
                }
            }
        }
Esempio n. 11
0
 public void NameTextBlockAnimationLoader(object sender, RoutedEventArgs e)
 {
     MyStoryboard.Begin();
 }
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     MyStoryboard.Begin();
 }
Esempio n. 13
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);
        }
Esempio n. 14
0
        /// <summary>
        /// 卡片以覆盖方式进入怪物区时,怪物区控件的操作
        /// </summary>
        /// <param name="mcv">怪物区控件</param>
        /// <param name="card">卡片</param>
        public static void add2MonsterOP(MyCanvas mcv, CardUI card)
        {
            int count = mcv.Children.Count;

            if (count == 1)
            {
                if (card.Status == Status.BACK_ATK || card.Status == Status.FRONT_ATK)
                {
                    card.centerAtVerticalInParent();
                    Service.CardOperate.sort_XYZ_atk(mcv);
                }
                else
                {
                    card.centerAtHorizontalInParent();
                    Service.CardOperate.sort_XYZ_atk(mcv);
                }
                card.ContextMenu = AllMenu.Instance.cm_monster;
            }
            else
            {
                Canvas.SetLeft(card, mcv.ActualWidth - card.Width);
                Canvas.SetTop(card, (mcv.ActualHeight - card.Height) / 2);
                card.ContextMenuOpening += (sender, e) =>
                {
                    card.ContextMenu.DataContext = card;
                };
                CardUI second = mcv.Children[count - 2] as CardUI;

                second.reSetAtk();   //当被叠放时要重置攻击力
                second.clearSigns(); //当被叠放时要清除卡片指示物

                /*
                 * 判断加入前最顶层的卡的状态,若是只要是存在背面或防守,则应先启动相关动画
                 */

                //CardAnimation.setTransformGroup(second);
                TransLibrary.StoryboardChain animator0 = new TransLibrary.StoryboardChain();

                if (second.Status == Status.BACK_DEF)
                {
                    //MyStoryboard msb1 = CardAnimation.ScaleX_120_Rotate(-90, 0, 150, 200);
                    MyStoryboard msb1 = CardAnimation.scalX_120_rotate_9020();
                    msb1.card       = second;
                    msb1.Completed += (object sender_, EventArgs e_) =>
                    {
                        //卡片切换为背面
                        msb1.card.set2FrontAtk();
                        //msb1.card.showImg();
                    };
                    animator0.Animates.Add(msb1);
                    MyStoryboard msb2 = CardAnimation.scalX_021();
                    animator0.Animates.Add(msb2);
                }
                if (second.Status == Status.FRONT_DEF)
                {
                    MyStoryboard msb = CardAnimation.Rotate_D2A();
                    msb.card       = second;
                    msb.Completed += (object sender_, EventArgs e_) =>
                    {
                        msb.card.set2FrontAtk();
                    };
                    animator0.Animates.Add(msb);
                }

                animator0.Begin(second);
                Service.CardOperate.sort_XYZ_atk(mcv);
                //Canvas.SetTop(card, (mcv.ActualHeight - card.ActualHeight) / 2.0);
                //Canvas.SetLeft(card, mcv.ActualWidth - card.ActualWidth);


                //MainWindow mainwin = Application.Current.MainWindow as MainWindow;
                //Point summon2 = mcv.TranslatePoint(new Point(0.5, 0.5), mainwin.OpBattle);
                //Canvas.SetLeft(mainwin.img_overlay_op, summon2.X - ((mainwin.img_overlay_op.Width - mcv.ActualWidth) / 2));
                //Canvas.SetTop(mainwin.img_overlay_op, summon2.Y - ((mainwin.img_overlay_op.Height - mcv.ActualHeight) / 2));
                //CardAnimation.Rotate_Scale_FadeInAndOut(mainwin.img_overlay_op);
            }

            //MainWindow mainwin = Application.Current.MainWindow as MainWindow;

            #region 攻守显示绑定卡片

            if (card.Status != Status.BACK_ATK && card.Status != Status.BACK_DEF)
            {
                bindingAtk(mcv, card);
            }


            #endregion

            //添加指示物
            showSigns(mcv, card);
        }
Esempio n. 15
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     MyStoryboard.Begin();
     ContentPopup.IsOpen = false;
 }