Example #1
0
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            if (InPlaySecend)
            {
                if (this.Parent is StackPanel)
                {
                    var _parent = ((((((((((this.Parent as StackPanel).Parent as Grid).Parent as UControl.PutCheese).Parent as Grid).Parent as Grid).Parent as Grid).Parent as UControl.PlayBox).Parent as Canvas).Parent as Grid).Parent as DavinciCodePlay);
                    if (_parent._DavinciStep.Step == 3 || _parent._DavinciStep.Step == 5)
                    {
                        if (this.Pass == false)
                        {
                            if ((((this.Parent as StackPanel).Parent as Grid).Parent as UControl.PutCheese).IsChoose == false)
                            {
                                (((this.Parent as StackPanel).Parent as Grid).Parent as UControl.PutCheese).IsChoose = true;
                                UControl.GuessBox GuessB = new UControl.GuessBox(500, 100);
                                GuessB.Opacity = 0;
                                DoubleAnimation Anim = new DoubleAnimation(0.8, new Duration(TimeSpan.FromSeconds(0.3)));
                                _parent.GuessBoxSet.Children.Add(GuessB);
                                GuessB.BeginAnimation(OpacityProperty, Anim);
                                _parent.NewCheeses = this;
                            }
                        }
                    }
                }
            }

            base.OnMouseLeftButtonDown(e);
        }
Example #2
0
        public void KButton_ClickInPlayBoard(object sender, RoutedEventArgs e)
        {
            if (this.Locked != true)
            {
                var _parent = (((this.Parent as Canvas).Parent as Grid).Parent as Class.DavinciCodePlay);
                foreach (var _item in _parent.CheeseSet.Children)
                {
                    if (_item is Cheese)
                    {
                        (_item as Cheese).Locked = true;
                    }
                }
                _parent.CheeseSet.Children.Remove(this);
                _parent.CheeseSet.Children.Add(this);
                DoubleAnimation TopMove  = new DoubleAnimation(Canvas.GetTop(this), Canvas.GetTop(_parent.CheeseShowFirst) + 25, new Duration(TimeSpan.FromSeconds(1)));
                DoubleAnimation LeftMove = new DoubleAnimation(Canvas.GetLeft(this), Canvas.GetLeft(_parent.CheeseShowFirst) + 25, new Duration(TimeSpan.FromSeconds(1)));
                TopMove.DecelerationRatio  = 0.3;
                LeftMove.AccelerationRatio = 0.7;
                LeftMove.DecelerationRatio = 0.3;
                Storyboard myStoryboard = new Storyboard();
                myStoryboard.Children.Add(TopMove);
                myStoryboard.Children.Add(LeftMove);
                myStoryboard.Completed += new EventHandler(PutACheese);
                Storyboard.SetTarget(TopMove, this);
                Storyboard.SetTargetProperty(TopMove, new PropertyPath(Canvas.TopProperty));
                Storyboard.SetTarget(LeftMove, this);
                Storyboard.SetTargetProperty(LeftMove, new PropertyPath(Canvas.LeftProperty));
                myStoryboard.Begin();
            }

            if (InPlaySecend)
            {
                if (this.Parent is StackPanel)
                {
                    var _parent = ((((((((((this.Parent as StackPanel).Parent as Grid).Parent as UControl.PutCheese).Parent as Grid).Parent as Grid).Parent as Grid).Parent as UControl.PlayBox).Parent as Canvas).Parent as Grid).Parent as DavinciCodePlay);
                    if (_parent._DavinciStep.Step == 3 || _parent._DavinciStep.Step == 5)
                    {
                        if (this.Pass == false)
                        {
                            if ((((this.Parent as StackPanel).Parent as Grid).Parent as UControl.PutCheese).IsChoose == false)
                            {
                                (((this.Parent as StackPanel).Parent as Grid).Parent as UControl.PutCheese).IsChoose = true;
                                UControl.GuessBox GuessB = new UControl.GuessBox(500, 100);
                                GuessB.Opacity = 0;
                                DoubleAnimation Anim = new DoubleAnimation(0.8, new Duration(TimeSpan.FromSeconds(0.3)));
                                _parent.GuessBoxSet.Children.Add(GuessB);
                                GuessB.BeginAnimation(OpacityProperty, Anim);
                                _parent.NewCheeses = this;
                            }
                        }
                    }
                }
            }
        }