예제 #1
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);
        }
예제 #2
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);
        }
예제 #3
0
        public async void UpdateAllCardGrids(double duration = Double.MaxValue, bool rotate = false)
        {
            foreach (CardView card in Deck.Cards)
            {
                GridDeck.SetCardSize(card);
            }

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

            GridDeck.UpdateCardLayout(taskList, duration, rotate);
            GridPlayer.UpdateCardLayout(taskList, duration, rotate);
            GridComputer.UpdateCardLayout(taskList, duration, rotate);
            GridPlayedCards.UpdateCardLayout(taskList, duration, rotate);
            GridCrib.UpdateCardLayout(taskList, duration, rotate);
            await Task.WhenAll(taskList);
        }