コード例 #1
0
        public void AnimateChange(Change change)
        {
            switch (change.Type)
            {
            case ChangeType.FallDown:
                Coordonate startCoordonate  = ((FallDownChange)change).Start;
                Coordonate finishCoordonate = ((FallDownChange)change).Finish;
                animatedObject = imageCandies[startCoordonate.X, startCoordonate.Y];
                imageCandies[finishCoordonate.X, finishCoordonate.Y] = (ImageCandy)animatedObject;

                animations.Add(new MoveAnimation(imageCandies[finishCoordonate.X, finishCoordonate.Y], startCoordonate, finishCoordonate, ImageSlot.SlotHeight, ImageSlot.SlotWidth, change.FallTime));
                break;

            case ChangeType.CreateCandy:
                CreateCandyChange createChange = (CreateCandyChange)change;
                animatedObject = new ImageCandy(createChange.TipBomboana);
                canvasDisplay.Children.Add(animatedObject);
                MoveToCoordonate(animatedObject, createChange.CoordonateCandy);
                imageCandies[createChange.CoordonateCandy.X, createChange.CoordonateCandy.Y] = (ImageCandy)animatedObject;
                //animation = null;
                break;

            case ChangeType.DestroyCandy:
                DestroyCandyChange destroyChange = ((DestroyCandyChange)change);
                ImageCandy         destroyImage  = imageCandies[destroyChange.CoordonateCandy.X, destroyChange.CoordonateCandy.Y];
                //Canvas.SetLeft(destroyImage, Canvas.GetLeft(destroyImage) + 10);
                //destroyImage.Width -= 20;
                canvasDisplay.Children.Remove(destroyImage);
                //animation = null
                break;
            }

            fullAnimationTime = change.FallTime;
            animationTime     = change.FallTime;
            animationTimer.Start();
        }
コード例 #2
0
 public void MoveToCoordonate(UIElement obj, Coordonate coordonate)
 {
     Canvas.SetTop(obj, coordonate.X * ImageSlot.SlotHeight);
     Canvas.SetLeft(obj, coordonate.Y * ImageSlot.SlotWidth);
 }
コード例 #3
0
 /// <summary>
 /// Obtient le hashcode.
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode()
 {
     return(Class.GetHashCode() ^ Coordonate.GetHashCode() ^ Orientation.GetHashCode());
 }