예제 #1
0
        private async Task AnimateAllCardsBackToDeck(double duration = Double.MaxValue)
        {
            CountControl.Hide();
            if (duration == Double.MaxValue)
            {
                duration = MainPage.AnimationSpeeds.Medium;
            }

            // flip the cards and then move them for a nice affect

            List <Task <object> > list = new List <Task <object> >();

            GridPlayer.FlipAllCards(CardOrientation.FaceDown, list);
            GridPlayer.MoveAllCardsToTarget(GridDeck, list, duration);

            GridCrib.FlipAllCards(CardOrientation.FaceDown, list);
            GridCrib.MoveAllCardsToTarget(GridDeck, list, duration);

            GridPlayedCards.FlipAllCards(CardOrientation.FaceDown, list);
            GridPlayedCards.MoveAllCardsToTarget(GridDeck, list, duration);

            GridComputer.FlipAllCards(CardOrientation.FaceDown, list);
            GridComputer.MoveAllCardsToTarget(GridDeck, list, duration);

            foreach (CardView card in GridDeck.Items)
            {
                card.Reset();
            }

            GridDeck.UpdateCardLayout(list, duration, false);

            await Task.WhenAll(list);
        }
예제 #2
0
        private async Task DealAnimation(HandsFromServer hfs, double duration = Double.MaxValue)
        {
            if (duration == Double.MaxValue)
            {
                duration = MainPage.AnimationSpeeds.Medium;
            }
            CardView card;
            List <Task <Object> > tasks = new List <Task <object> >();

            for (int i = 0; i < 6; i++)
            {
                card = hfs.PlayerCards[i];
                card.BoostZindex();
                card.Owner = Owner.Player;
                GridDeck.MoveCardToTarget(card, GridPlayer, tasks, duration, true);
                card       = hfs.ComputerCards[i];
                card.Owner = Owner.Computer;
                card.BoostZindex();
                GridDeck.MoveCardToTarget(card, GridComputer, tasks, duration, true);
            }

            await Task.WhenAll(tasks);

            await GridPlayer.FlipAllCards(CardOrientation.FaceUp, duration);

            for (int i = 0; i < 6; i++)
            {
                GridPlayer.Items[i].ResetZIndex();
                GridComputer.Items[i].ResetZIndex();
            }

            hfs.SharedCard.BoostZindex(ZIndexBoost.SmallBoost);
        }
예제 #3
0
        private async Task AnimateCribCardsToOwner(PlayerType owner)
        {
            CardContainer cribOwner = GridPlayer;

            if (owner == PlayerType.Computer)
            {
                cribOwner = GridComputer;
            }

            List <Task <Object> > tasks = new List <Task <object> >();

            //
            //  return player and computer cards to the deck

            GridPlayer.FlipAllCards(CardOrientation.FaceDown, tasks);
            GridPlayer.MoveAllCardsToTarget(GridDeck, tasks, MainPage.AnimationSpeeds.Medium, true);
            GridComputer.FlipAllCards(CardOrientation.FaceDown, tasks);
            GridComputer.MoveAllCardsToTarget(GridDeck, tasks, MainPage.AnimationSpeeds.Medium, true);


            //
            //  move crib cards back to player
            GridCrib.MoveAllCardsToTarget(cribOwner, tasks, MainPage.AnimationSpeeds.Medium, true);
            cribOwner.FlipAllCards(CardOrientation.FaceUp, tasks);
            await Task.WhenAll(tasks);
        }