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); }
private async Task AnimateCardsBackToOwner() { List <Task <object> > taskList = new List <Task <object> >(); CardView card = null; for (int i = GridPlayedCards.Items.Count - 1; i >= 0; i--) { card = GridPlayedCards.Items[i]; if (card.Owner == Owner.Player) { GridPlayedCards.MoveCardToTarget(card, GridPlayer, taskList); } else if (card.Owner == Owner.Computer) { GridPlayedCards.MoveCardToTarget(card, GridComputer, taskList); } if (card.Orientation == CardOrientation.FaceDown) { card.SetOrientation(CardOrientation.FaceUp, taskList); } if (card.AnimatedOpacity != 1.0) { card.AnimateFade(1.0, taskList); } } await Task.WhenAll(taskList); CountControl.Hide(); }
public async Task <bool> DroppedCards(Point point, List <CardView> cards) { bool acceptedCards = GridPlayedCards.HitTest(point); if (point.X - int.MaxValue < 2) // happens on double tap -- { acceptedCards = true; } if (acceptedCards) { foreach (CardView card in cards) { card.Selected = false; GridPlayer.TransferCard(card, GridPlayedCards); } try { int maxSel = await StateMachine.DroppedCards(cards); // this throws if the count > 31 GridPlayer.MaxSelected = maxSel; } catch (Exception) { return(false); } } GridPlayedCards.UpdateCardLayoutAsync(); GridPlayer.UpdateCardLayoutAsync(); return(acceptedCards); }
private async Task OnCountResetUpdateUi() { CountControl.UpdateLayout(); await GridPlayedCards.UpdateCardLayout(); await GridComputer.UpdateCardLayout(); await GridPlayer.UpdateCardLayout(); if (Settings.HitContinueOnGo == true) { await HintWindow_ShowAndWait("Go!\n\nHit Continue."); } else { await Task.Delay(1000); } foreach (CardView c in GridPlayedCards.Items) { c.SetOrientationAsync(CardOrientation.FaceDown, MainPage.AnimationSpeeds.Medium); } UpdateCount(0); CountControl.UpdateLayout(); }
public async Task OnAnimateMoveCardsToCrib() { await GridPlayedCards.FlipAllCards(CardOrientation.FaceDown); await GridPlayedCards.MoveAllCardsToTarget(GridCrib, MoveCardOptions.MoveAllAtSameTime); ShowCountControl(); }
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); }