public async Task <int> DroppedCards(List <CardView> cards) { _totalCardsDropped += cards.Count; if (this.State == GameState.PlayerGiveToCrib) { _crib.AddRange(cards); if (_crib.Count == 4) { await _view.OnSendCardsToCrib(); if (HandsFromService.SharedCard.Rank == 11) { await ScoreCutJack(HandsFromService.SharedCard.Index); } _game.SendAllCardsToCrib(_crib); _totalCardsDropped = 0; _crib.Clear(); SetStateAsync(GameState.Count); return(0); } return(4 - _crib.Count); } if (this.State == GameState.PlayerCountCard) { CountingData data = _game.CountCard(PlayerType.Player, cards[0], Settings.Difficulty); _nPlayerCountingPoint += data.Score; _boardUi.AddScoreAsync(PlayerType.Player, data.Score); await _view.OnCountCard(cards[0], PlayerType.Player, data); _boardUi.Turn = data.NextPlayer; if (_game.GetCurrentScore(PlayerType.Player) > WINNING_SCORE) { await SetState(GameState.GameOver); return(8); } if (data.CardsCounted == 8) { SetStateAsync(GameState.CountingEnded); return(0); } else if (data.NextPlayerIsComputer) { SetStateAsync(GameState.ComputerCountCard); return(0); } else { return(1); } } throw new Exception(String.Format("Unexpected state during user dropping card. State is: {0}", _gameState)); }