public async Task OnCountingEnded(int playerScore, int computerScore) { UpdateCount(0); HintWindow.InsertScoreSummary(ScoreType.Count, playerScore, computerScore); await AnimateCardsBackToOwner(); }
public async Task AddToScoreHistory(List <CardView> cards, ScoreCollection scores, PlayerType player) { List <CardView> fullHand = new List <CardView>(cards); switch (scores.ScoreType) { case ScoreType.Hand: case ScoreType.Crib: case ScoreType.Cut: fullHand.Sort(CardView.CompareCardsByRank); fullHand.Add(GridDeck.Items[0]); break; case ScoreType.Count: break; case ScoreType.Saved: case ScoreType.Unspecified: return; default: break; } string score = GetGameScore(); await HintWindow.AddToHistory(fullHand, scores, player, Deck, score); }
public async Task OnUpdateScoreUi(PlayerType player, int scoreDelta, ScoreCollection scores) { await StateMachine.UiState.AddScore(player, scoreDelta); await AddToScoreHistory(GridPlayer.Items, scores, PlayerType.Player); HintWindow.InsertScoreSummary(scores.ScoreType, scoreDelta, 0); string message = String.Format("Your Score\n{0}\nHit Continue.", scores.Format(false, false, true)); //ShowHintWindowAsync(true, false, message); await HintWindow_ShowAndWait(message); }
public async Task OnComputerScoreCrib(int scoreToAdd, ScoreCollection scores) { string message = String.Format("Computer's Crib Score\n{0}\nHit Continue.", scores.Format(false, false, true)); await HintWindow_ShowAndWait(message); await StateMachine.UiState.AddScore(PlayerType.Computer, scoreToAdd); await AddToScoreHistory(GridComputer.Items, scores, PlayerType.Computer); HintWindow.InsertScoreSummary(ScoreType.Crib, 0, scoreToAdd); }
public async Task HintWindow_ShowAndWait(string message) { if (_hintDispatchTimer == null) { _hintDispatchTimer = new DispatcherTimer(); _hintDispatchTimer.Tick += HintReminder_Tick; _hintDispatchTimer.Interval = TimeSpan.FromSeconds(5); } _hintDispatchTimer.Start(); await HintWindow.ShowAndWait(message); ViewCallback.RemindUserToHitContinue(false); _hintDispatchTimer.Stop(); }
public async Task OnEndOfHand(PlayerType dealer, int cribScore, int nComputerCountingPoint, int nPlayerCountingPoint, int ComputerPointsThisTurn, int PlayerPointsThisTurn) { CardContainer cribOwner = GridPlayer; if (dealer == PlayerType.Computer) { cribOwner = GridComputer; } await HintWindow.InsertEndOfHandSummary(dealer, cribScore, cribOwner.Items, nComputerCountingPoint, nPlayerCountingPoint, ComputerPointsThisTurn, PlayerPointsThisTurn, Hfs); List <Task <Object> > tasks = new List <Task <object> >(); cribOwner.FlipAllCards(CardOrientation.FaceDown, tasks); cribOwner.MoveAllCardsToTarget(GridDeck, tasks, MainPage.AnimationSpeeds.Medium, true); await Task.WhenAll(tasks); }
public void Reset() { if (PlayerScore != null) { PlayerScore.Reset(); ComputerScore.Reset(); } Board.Reset(); PlayerSetScoreControl.HideAsync(); HintWindow.ShowAsync(false, false, "Swipe Up to and hit New Game!"); if (GridDeck.Items.Count > 52) { Debug.Assert(false, "Too many cards in your deck after reset!"); } HintWindow.ResetScoreHistory(); ViewCallback.Reset(); }
public Task <bool> Load(string s) { return(HintWindow.Load(s)); }
public string Save() { return(HintWindow.Save()); }
private async Task ShowHintWindow(bool show, bool closeWithTimer, string message) { await HintWindow.Show(show, closeWithTimer, message); }
private void ShowHintWindowAsync(bool show, bool closeWithTimer, string message) { HintWindow.ShowAsync(show, closeWithTimer, message); }