Beispiel #1
0
        // animate initial conditions

        private void animateOwnSafeguards()
        {
            Models.CardGUIModel safeGuard;

            Thickness margin = new Thickness(5, 0, 0, 0);

            for (int i = 0; i < 5; i++)
            {
                Animations.MoveAnimation animation;

                // add the actual card
                safeGuard = new Models.CardGUIModel(null, this, AnimationConstants.ownDeckLocation, Visibility.Hidden);
                grdParent.Children.Add(safeGuard.Border);

                animation = new Animations.MoveAnimation(grdParent,
                                                         grdOwnSafeguards,
                                                         grdParent,
                                                         null,
                                                         listOwnSafeGuardZone,
                                                         safeGuard,
                                                         AnimationConstants.DESTINATIONSAFEGUARD);
                animation.startsWithHiddenOrigin = true;
                addAnimation(animation);
            }
        }
        private void animateOppSafeguards()
        {
            Models.CardGUIModel safeGuard;

            for (int i = 1; i <= 5; i++)
            {
                Animations.MoveAnimation animation;

                // add the actual card
                safeGuard = new Models.CardGUIModel(null, this, AnimationAndEventsConstants.oppDeckLocation, Visibility.Hidden, i);
                grdParent.Children.Add(safeGuard.Border);

                animation = new Animations.MoveAnimation(
                    grdParent,
                    grdOppSafeguards,
                    grdParent,
                    null,
                    listOppSafeGuardZone,
                    safeGuard,
                    AnimationAndEventsConstants.DESTINATIONSAFEGUARD);
                animation.setSpeed(10);
                animation.startsWithHiddenOrigin = true;
                addEvent(new Event(animation));
            }
        }
        private void animateBattleToMana(int cardIndex, bool own)
        {
            Models.CardGUIModel        card;
            Animations.MoveAnimation   moveAnimation;
            Animations.RotateAnimation rotateAnimation;
            List <Event> events;

            events = new List <Event>();

            // select origin and create destination

            card          = own == OWN ? listOwnBattleGround[cardIndex] : listOppBattleGround[cardIndex];
            moveAnimation = new Animations.MoveAnimation(
                own == OWN ? grdOwnBattle : grdOppBattle,
                own == OWN ? grdOwnMana : grdOppMana,
                grdParent,
                own == OWN ? listOwnBattleGround : listOppBattleGround,
                own == OWN ? listOwnManaZone : listOppManaZone,
                card,
                AnimationAndEventsConstants.DESTINATIONMANA);

            if (card.Card.isEngaged)
            {
                rotateAnimation        = new Animations.RotateAnimation(false);
                rotateAnimation.border = card.Border;
                events.Add(new Event(rotateAnimation));
            }

            card.Card.resetProperties();

            events.Add(new Event(moveAnimation));
            addEvents(events);
        }
        public void animatePlayAsManaOPP(int cardID)
        {
            Models.CardGUIModel        card;
            Animations.MoveAnimation   moveAnimation;
            Animations.RotateAnimation rotateAnimation;

            // create the origin and destination cards

            card = new Models.CardGUIModel(ctrl.getCardWithGamePropertiesByID(cardID), this, AnimationAndEventsConstants.oppHandLocation, Visibility.Visible);

            // add cards to grids
            grdParent.Children.Add(card.Border);

            moveAnimation = new Animations.MoveAnimation(
                grdParent,
                grdOppMana,
                grdParent,
                null,
                listOppManaZone,
                card,
                AnimationAndEventsConstants.DESTINATIONMANA);
            rotateAnimation        = new RotateAnimation(true, 180);
            rotateAnimation.border = card.Border;
            addEvent(new Event(moveAnimation));
            //addAnimation(rotateAnimation);
        }
        private void animateGraveyardToBattle(int cardIndex, bool own)
        {
            Models.CardGUIModel      card;
            Animations.MoveAnimation moveAnimation;

            // select origin

            if (own)
            {
                card          = listOwnGraveyard[cardIndex];
                moveAnimation = new Animations.MoveAnimation(
                    grdOwnGrave,
                    grdOwnBattle,
                    grdParent,
                    listOwnGraveyard,
                    listOwnBattleGround,
                    card,
                    AnimationAndEventsConstants.DESTINATIONBATTLE);
            }
            else
            {
                card          = listOppGraveyard[cardIndex];
                moveAnimation = new Animations.MoveAnimation(
                    grdOppGrave,
                    grdOppBattle,
                    grdParent,
                    listOppGraveyard,
                    listOppBattleGround,
                    card,
                    AnimationAndEventsConstants.DESTINATIONBATTLE);
            }

            addEvent(new Event(moveAnimation));
        }
        private void animateBattleToHandOpp(int cardIndex)
        {
            Models.CardGUIModel      card;
            Animations.MoveAnimation animation;

            // select origin and create destination

            card = listOppBattleGround[cardIndex];

            if (card.Card.isEngaged)
            {
                Animations.RotateAnimation rotateAnimation = new Animations.RotateAnimation(false);
                rotateAnimation.border = card.Border;
                addEvent(new Event(rotateAnimation));
            }

            animation = new Animations.MoveAnimation(grdOppBattle,
                                                     grdParent,
                                                     grdParent,
                                                     listOppBattleGround,
                                                     null,
                                                     card,
                                                     AnimationAndEventsConstants.DESTINATIONOPPHAND);
            animation.removeOrigin = true;
            addEvent(new Event(animation));
        }
        private void animateManaToGraveOwn(int cardIndex)
        {
            Models.CardGUIModel      card;
            Animations.MoveAnimation animation;
            List <Event>             events;

            events = new List <Event>();

            // select origin

            card = listOwnManaZone[cardIndex];

            if (card.Card.isEngaged)
            {
                Animations.RotateAnimation rotateAnimation = new Animations.RotateAnimation(false);
                rotateAnimation.border = card.Border;
                events.Add(new Event(rotateAnimation));
            }

            animation = new Animations.MoveAnimation(
                grdOwnMana,
                grdOwnGrave,
                grdParent,
                listOwnManaZone,
                listOwnGraveyard,
                card,
                AnimationAndEventsConstants.DESTINATIONGRAVE);
            events.Add(new Event(animation));

            addEvents(events);
        }
        private void animateBattleToHandOwn(int cardIndex)
        {
            Models.CardGUIModel      card;
            Animations.MoveAnimation animation;

            // select origin and create destination

            card = listOwnBattleGround[cardIndex];

            if ((Phase == "Mana phase" || Phase == "Summon phase") && itIsOwnTurn)
            {
                ableToSelect.Add(card);
            }

            if (card.Card.isEngaged)
            {
                Animations.RotateAnimation rotateAnimation = new Animations.RotateAnimation(false);
                rotateAnimation.border = card.Border;
                addEvent(new Event(rotateAnimation));
            }

            card.Card.resetProperties();

            animation = new Animations.MoveAnimation(grdOwnBattle,
                                                     grdHand,
                                                     grdParent,
                                                     listOwnBattleGround,
                                                     listHand,
                                                     card,
                                                     AnimationAndEventsConstants.DESTINATIONOWNHAND);
            addEvent(new Event(animation));
        }
        // Start Turn

        private void animateDrawCardOWN(Models.CardWithGameProperties card)
        {
            Models.CardGUIModel      drawnCard;
            Animations.MoveAnimation animation;

            drawnCard = new Models.CardGUIModel(card, this, AnimationAndEventsConstants.ownDeckLocation, Visibility.Hidden);

            // add cards to grids
            grdParent.Children.Add(drawnCard.Border);

            if ((Phase == "Mana phase" || Phase == "Summon phase") && itIsOwnTurn)
            {
                ableToSelect.Add(drawnCard);
            }

            animation = new Animations.MoveAnimation(
                grdParent,
                grdHand,
                grdParent,
                null,
                listHand,
                drawnCard,
                AnimationAndEventsConstants.DESTINATIONOWNHAND);

            animation.startsWithHiddenOrigin = true;
            addEvent(new Event(animation));
        }
        private void animateDeckToMana(Models.CardWithGameProperties card, bool own)
        {
            Models.CardGUIModel      drawnCard;
            Animations.MoveAnimation animation;

            drawnCard = new Models.CardGUIModel(
                card,
                this,
                own == OWN ? AnimationAndEventsConstants.ownDeckLocation : AnimationAndEventsConstants.oppDeckLocation,
                Visibility.Hidden);

            // add cards to grids
            grdParent.Children.Add(drawnCard.Border);

            animation = new Animations.MoveAnimation(
                grdParent,
                own == OWN ? grdOwnMana : grdOppMana,
                grdParent,
                null,
                own == OWN ? listOwnManaZone : listOppManaZone,
                drawnCard,
                AnimationAndEventsConstants.DESTINATIONMANA);

            animation.startsWithHiddenOrigin = true;
            addEvent(new Event(animation));
        }
        // Special Effects

        private void animateManaToHandOpp(int cardIndex)
        {
            Models.CardGUIModel      card;
            Animations.MoveAnimation animation;
            List <Event>             events;

            events = new List <Event>();

            // select origin

            card = listOppManaZone[cardIndex];

            if (card.Card.isEngaged)
            {
                Animations.RotateAnimation rotateAnimation = new Animations.RotateAnimation(false);
                rotateAnimation.border = card.Border;
                events.Add(new Event(rotateAnimation));
            }

            animation = new Animations.MoveAnimation(
                grdOppMana,
                grdParent,
                grdParent,
                listOppManaZone,
                null,
                card,
                AnimationAndEventsConstants.DESTINATIONOPPHAND);
            animation.removeOrigin = true;
            events.Add(new Event(animation));

            addEvents(events);
        }
        private void animateBattleToGraveyard(int cardIndex, bool own)
        {
            Models.CardGUIModel        card;
            Animations.MoveAnimation   moveAnimation;
            Animations.RotateAnimation rotateAnimation;
            List <Event> events;

            events = new List <Event>();

            // select origin and create destination

            if (own)
            {
                card          = listOwnBattleGround[cardIndex];
                moveAnimation = new Animations.MoveAnimation(
                    grdOwnBattle,
                    grdOwnGrave,
                    grdParent,
                    listOwnBattleGround,
                    listOwnGraveyard,
                    card,
                    AnimationAndEventsConstants.DESTINATIONGRAVE);
            }
            else
            {
                card          = listOppBattleGround[cardIndex];
                moveAnimation = new Animations.MoveAnimation(
                    grdOppBattle,
                    grdOppGrave,
                    grdParent,
                    listOppBattleGround,
                    listOppGraveyard,
                    card,
                    AnimationAndEventsConstants.DESTINATIONGRAVE);
            }

            if (card.Card.isEngaged)
            {
                rotateAnimation        = new Animations.RotateAnimation(false);
                rotateAnimation.border = card.Border;
                events.Add(new Event(rotateAnimation));
            }

            card.Card.resetProperties();

            events.Add(new Event(moveAnimation));
            addEvents(events);
        }
        // Summon Phase

        private void animateSummonOWN(int index)
        {
            Models.CardGUIModel      card;
            Animations.MoveAnimation animation;

            // select origin and create destination
            card = listHand[index];

            animation = new Animations.MoveAnimation(
                grdHand,
                grdOwnBattle,
                grdParent,
                listHand,
                listOwnBattleGround,
                card,
                AnimationAndEventsConstants.DESTINATIONBATTLE);
            addEvent(new Event(animation));
        }
Beispiel #14
0
        // Mana Phase

        private void animatePlayAsManaOWN(int cardIndex)
        {
            Models.CardGUIModel      card;
            Animations.MoveAnimation animation;

            // select origin and create destination
            card = listHand[cardIndex];

            animation = new Animations.MoveAnimation(
                grdHand,
                grdOwnMana,
                grdParent,
                listHand,
                listOwnManaZone,
                card,
                AnimationConstants.DESTINATIONMANA);
            addAnimation(animation);
        }
        private void animateSafeguardBrokeOPP(int index)
        {
            Models.CardGUIModel      safeGuard;
            Animations.MoveAnimation animation;

            // select origin and create destination

            safeGuard = listOppSafeGuardZone[index];

            animation = new Animations.MoveAnimation(
                grdOppSafeguards,
                grdParent,
                grdParent,
                listOppSafeGuardZone,
                null,
                safeGuard,
                AnimationAndEventsConstants.DESTINATIONOPPHAND);
            animation.removeOrigin = true;
            addEvent(new Event(animation));
        }
        private void animateGraveyardToHandOpp(int cardIndex)
        {
            Models.CardGUIModel      card;
            Animations.MoveAnimation animation;

            // select origin and create destination

            card = listOppGraveyard[cardIndex];

            animation = new Animations.MoveAnimation(
                grdOppGrave,
                grdParent,
                grdParent,
                listOppGraveyard,
                null,
                card,
                AnimationAndEventsConstants.DESTINATIONOPPHAND);
            animation.removeOrigin = true;

            addEvent(new Event(animation));
        }
Beispiel #17
0
        // Attack Phase

        private void animateSafeguardBrokeOWN(int index, int cardID)
        {
            Models.CardGUIModel      safeGuard;
            Animations.MoveAnimation animation;

            // select origin and create destination

            safeGuard = listOwnSafeGuardZone[index];

            // reveal the safeguard
            safeGuard.setCard(ctrl.getCardWithGamePropertiesByID(cardID));

            animation = new Animations.MoveAnimation(
                grdOwnSafeguards,
                grdHand,
                grdParent,
                listOwnSafeGuardZone,
                listHand,
                safeGuard,
                AnimationConstants.DESTINATIONOWNHAND);
            addAnimation(animation);
        }
Beispiel #18
0
        private void animateInitialHand()
        {
            Models.CardGUIModel card;

            for (int i = 0; i < 5; i++)
            {
                Animations.MoveAnimation animation;

                card = new Models.CardGUIModel(ctrl.getCardFromInitialHand(), this, AnimationConstants.ownDeckLocation, Visibility.Hidden);
                grdParent.Children.Add(card.Border);

                animation = new Animations.MoveAnimation(
                    grdParent,
                    grdHand,
                    grdParent,
                    null,
                    listHand,
                    card,
                    AnimationConstants.DESTINATIONOWNHAND);
                animation.startsWithHiddenOrigin = true;
                addAnimation(animation);
            }
        }
        private void animateSafeguardToGroundOpp(int index, int cardID)
        {
            Models.CardGUIModel      safeGuard;
            Animations.MoveAnimation animation;

            // select origin and create destination

            safeGuard = listOppSafeGuardZone[index];

            // reveal the safeguard
            safeGuard.setCard(ctrl.getCardWithGamePropertiesByID(cardID));

            animation = new Animations.MoveAnimation(
                grdOppSafeguards,
                grdOppBattle,
                grdParent,
                listOppSafeGuardZone,
                listOppBattleGround,
                safeGuard,
                AnimationAndEventsConstants.DESTINATIONBATTLE,
                true);
            addEvent(new Event(animation));
        }
        // Mana Phase

        private void animatePlayAsManaOWN(int cardIndex)
        {
            Models.CardGUIModel        card;
            Animations.MoveAnimation   moveAnimation;
            Animations.RotateAnimation rotateAnimation;

            // select origin and create destination
            card = listHand[cardIndex];

            moveAnimation = new Animations.MoveAnimation(
                grdHand,
                grdOwnMana,
                grdParent,
                listHand,
                listOwnManaZone,
                card,
                AnimationAndEventsConstants.DESTINATIONMANA);
            rotateAnimation        = new RotateAnimation(true, 180);
            rotateAnimation.border = card.Border;

            addEvent(new Event(moveAnimation));
            //addAnimation(rotateAnimation);
        }
        private void animateGraveyardToHandOwn(int cardIndex)
        {
            Models.CardGUIModel      card;
            Animations.MoveAnimation animation;

            // select origins

            card = listOwnGraveyard[cardIndex];

            if ((Phase == "Mana phase" || Phase == "Summon phase") && itIsOwnTurn)
            {
                ableToSelect.Add(card);
            }

            animation = new Animations.MoveAnimation(grdOwnGrave,
                                                     grdHand,
                                                     grdParent,
                                                     listOwnGraveyard,
                                                     listHand,
                                                     card,
                                                     AnimationAndEventsConstants.DESTINATIONOWNHAND);
            addEvent(new Event(animation));
        }
        private Models.CardGUIModel animateSummonOPP(int cardID)
        {
            Models.CardGUIModel      card;
            Animations.MoveAnimation animation;

            // create origin and destination

            card = new Models.CardGUIModel(ctrl.getCardWithGamePropertiesByID(cardID), this, AnimationAndEventsConstants.oppHandLocation, Visibility.Visible);

            // add cards to grids
            grdParent.Children.Add(card.Border);

            animation = new Animations.MoveAnimation(
                grdParent,
                grdOppBattle,
                grdParent,
                null,
                listOppBattleGround,
                card,
                AnimationAndEventsConstants.DESTINATIONBATTLE);
            addEvent(new Event(animation));

            return(card);
        }
        private void animateDrawCardOPP()
        {
            Models.CardGUIModel      drawnCard;
            Animations.MoveAnimation animation;

            // set origin and destination
            drawnCard = new Models.CardGUIModel(null, this, AnimationAndEventsConstants.oppDeckLocation, Visibility.Hidden);

            // add cards to grids
            grdParent.Children.Add(drawnCard.Border);

            animation = new Animations.MoveAnimation(
                grdParent,
                grdParent,
                grdParent,
                null,
                null,
                drawnCard,
                AnimationAndEventsConstants.DESTINATIONOPPHAND);

            animation.removeOrigin           = true;
            animation.startsWithHiddenOrigin = true;
            addEvent(new Event(animation));
        }