Exemplo n.º 1
0
        private void AnalyseScoreForHints()
        {
            ResetCheckOutHints();

            if (_configurationData.ShowCheckoutHints && SelectedGame.ShowCheckOutHints &&
                GetCurrentPlayer().DartsToThrow > 0)
            {
                var gameParameters = GetGameParameters();

                CheckoutHints = _currentGameService.GetCheckOutHints(gameParameters);

                if (CheckoutHints.Any())
                {
                    HintList = CheckoutHints.Select(hint => new HintList {
                        HintDarts = hint.Item2.Split(' ').Select
                                        ((dart, index) => new Hint {
                            HintText = dart, HintImage = GetImage(index)
                        }).ToList()
                    }).ToList();

                    // If user can still checkout remove hints that are more than current number of darts
                    if (GetCurrentPlayer().DartsToThrow < 3 &&
                        HintList.Any(hint => hint.HintDarts.Count <= GetCurrentPlayer().DartsToThrow))
                    {
                        HintList = HintList.Where(hint => hint.HintDarts.Count <= GetCurrentPlayer().DartsToThrow).ToList();
                    }
                }
            }
        }
 public bool CanChooseNumber(SimpleNumber thisNumber) //done.
 {
     if (thisNumber.Used == true)
     {
         throw new BasicBlankException("It should not have considered this number because it was already used.");
     }
     return(SaveRoot !.HintList.Any(items => items == thisNumber.Value));
 }