示例#1
0
 void GraphicPart_Tap(object sender, System.Windows.Input.GestureEventArgs e)
 {
   
     AI.Instance.Fight();
     MoveEffect me = new MoveEffect();
     me.From = new Point(0, 0);
     me.To = new Point(0, 1);
     me.Duration = 120;
     me.Mode = EasingMode.EaseIn;
     me.EasingFunction = new CircleEase();
     me.Start((FrameworkElement)this);
     me.Completed += me_Completed;
    
 }
示例#2
0
 void me_Completed(object sender, EventArgs e)
 {
     MoveEffect me = new MoveEffect();
    
         me.From = new Point(0, 1);
         me.To = new Point(0, 0);
         me.Duration = 120;
         me.Mode = EasingMode.EaseIn;
         me.EasingFunction = new CircleEase();
         me.Start((FrameworkElement)this);
         if (OnTap != null)
         {
             OnTap();
         }
 }
示例#3
0
        public void Update()
        {
            if (!ended)
            {
                if (ClassicPart != null && FightPart != null)
                {
                    ClassicPart.Visibility = Visibility.Collapsed;
                    FightPart.Visibility = Visibility.Visible;
                    dt.Stop();
                    dt.Interval = TimeSpan.FromMilliseconds(200);
                    dt.Start();
                }
                StaticSprite sprite;
                foreach (UIElement elt in this.Children)
                {
                    if ((sprite = elt as StaticSprite) != null)
                    {
                        float n = MathUtil.Norm(AI.Instance.CurrentNumber.Number, AI.Instance.CurrentLevel.NumberOfTapToDo, 0);
                        int Number = (int)MathUtil.Lerp(0, sprite.Length-1, n);
                        sprite.MoveTo(Number);
                    }
                }
                if (AI.Instance.CurrentNumber.Number <= EndNumber * AI.Instance.CurrentLevel.NumberOfTapToDo)
                {

                    ended = true;
                    MoveEffect me = new MoveEffect();

                    sc.PlaySound("Sounds/tap6.wav");
                    me.From = new Point(0, 10);
                    me.To = new Point(0, 900);
                    me.Duration = 1200;
                    me.Mode = EasingMode.EaseIn;
                    me.EasingFunction = new CircleEase();
                    me.Start((FrameworkElement)this.Children.FirstOrDefault());
                    me.Completed += me_CompletedEnd;
                }
            }
        }
        public CameraImageDisplayer(Shape NewImageShape)
        {
            ImageShape = NewImageShape;
            imageShape.Hold += imageShape_Hold;
            ImageBrushImage = new ImageBrush();
            ThisTransform = new CompositeTransform();
            this.RenderTransformOrigin = new Point(0, 0);
            this.RenderTransform = ThisTransform;
            TopLeft = new Point(int.MinValue, int.MinValue);
            BottomRight = new Point(int.MaxValue, int.MaxValue);
            CanvasImage = new Canvas();
            CanvasImage.Children.Add(ImageShape);
            this.Children.Add(CanvasImage);
            me = new MoveEffect();

            HeightBinding = new Binding();
            HeightBinding.Source = this;
            HeightBinding.Path = new PropertyPath("Height");

            WidthBinding = new Binding();
            WidthBinding.Source = this;
            WidthBinding.Path = new PropertyPath("Width");

            ImageShape.SetBinding(TextBlock.HeightProperty, HeightBinding);
            ImageShape.SetBinding(TextBlock.WidthProperty, WidthBinding);
            this.SetBinding(Canvas.HeightProperty, HeightBinding);
            this.SetBinding(Canvas.WidthProperty, WidthBinding);
            Position = new Point(0,0);
        }
        private void loadElt(Point p)
        {
            pointsAreadyDone.Add(p);

            SecreteAnimationControl elt = new SecreteAnimationControl();
            elt.Width = secretElementWidth;
            elt.Height = secretElementHeight;

            //RootCanvas
            RootCanvas.Children.Add(elt);
            RootCanvas.Visibility = Visibility.Visible;
            int YIndice = (int)p.Y;
            int XIndice = (int)p.X;
            double left = XIndice * (secretElementWidth);
            double top = YIndice * (secretElementHeight);
            Canvas.SetLeft(elt, left);
            Canvas.SetTop(elt, top);

            elt.ForegroundColor = ColorManager.Instance.RandomAccentBrush;
            // OpacityEffect oe = new OpacityEffect(0, 1, 1, StartAnimationDuration, EasingMode.EaseIn, new CircleEase());
            MoveEffect me = new MoveEffect(new Point(0, -top), new Point(0, 0), 10, StartAnimationDuration, EasingMode.EaseIn, new CircleEase());
            RotateEffect re = new RotateEffect(-90, 0, 1, StartAnimationDuration, EasingMode.EaseOut, new CircleEase());
            re.RotationCenter = new Point(0, 0);
            elt.addStartEffect(me);
            elt.addStartEffect(re);
            // elt.addStartEffect(oe);
            MoveEffect meStop = new MoveEffect(new Point(0, 0), new Point(0, 1.1 * Height), 1, StopAnimationDuration, EasingMode.EaseIn, new CircleEase());
            RotateEffect reStop = new RotateEffect(0, -90, 1, StopAnimationDuration, EasingMode.EaseOut, new CircleEase());
            reStop.RotationCenter = new Point(0, 0);
            elt.addStopEffect(meStop);
            elt.addStopEffect(reStop);
            elt.load();
            listOfElements.Add(elt);
            animStartOfElements.Enqueue(elt);
            animStopOfElements.Enqueue(elt);

        }
        public void RunExplosion()
        {

            foreach (Path pixel in ExplosionEffect.Children)
            {
                MoveEffect me = new MoveEffect();
                double toLeft = RandomNumber.Next(-500, 500);
                double toTop =RandomNumber.Next(-500, 500);
               
                me.From = new Point(0, 0);
                if (toLeft < 0 && toLeft > -300)
                {
                    toLeft -= 500;
                }
                if (toLeft > 0 && toLeft < 300)
                {
                    toLeft += 500;
                }
                if (toTop < 0 && toTop > -300)
                {
                    toTop -= 500;
                }
                if (toTop > 0 && toTop < 300)
                {
                    toTop += 500;
                }
                me.To = new Point(toLeft, toTop);

                me.EasingFunction = new CircleEase();
                me.Duration = 2000;
                me.Mode = EasingMode.EaseIn;
                me.Start(pixel);

            }
        }