Пример #1
0
        async Task IShowInstructionsUi.InsertEndOfHandSummary(PlayerType dealer, int cribScore, List <CardView> crib,
                                                              int nComputerCountingPoint, int nPlayerCountingPoint, int ComputerPointsThisTurn, int PlayerPointsThisTurn, HandsFromServer hfs)
        {
            RemoveScoreDetails();
            OneHandHistoryCtrl view = new OneHandHistoryCtrl();
            await view.SetPlayerCards(hfs.PlayerCards);

            await view.SetComputerHand(hfs.ComputerCards);

            await view.SetSharedCard(hfs.SharedCard);

            await view.SetCribHand(crib, dealer);

            view.SetCountScores(nPlayerCountingPoint, nComputerCountingPoint);
            view.SetCribScore(cribScore);
            view.SetComputerHandScore(ComputerPointsThisTurn);
            view.SetPlayerHandScore(PlayerPointsThisTurn);
            view.Width  = _listHistory.ActualWidth - SCROLLBAR_WIDTH;
            view.Height = (view.Width * HEIGHT_WIDTH_RATIO_HAND_SUMMARY);
            _scoreHistoryList.Insert(0, view);

            //
            //  Counting stats
            MainPage.Current.StatsView.Stats.Stat(StatName.CountingMostPoints).UpdateStatistic(PlayerType.Player, nPlayerCountingPoint);
            MainPage.Current.StatsView.Stats.Stat(StatName.CountingMostPoints).UpdateStatistic(PlayerType.Computer, nComputerCountingPoint);
            MainPage.Current.StatsView.Stats.Stat(StatName.CountingTotalPoints).UpdateStatistic(PlayerType.Player, nPlayerCountingPoint);
            MainPage.Current.StatsView.Stats.Stat(StatName.CountingTotalPoints).UpdateStatistic(PlayerType.Computer, nComputerCountingPoint);

            //
            //  Hand Stats
            MainPage.Current.StatsView.Stats.Stat(StatName.HandMostPoints).UpdateStatistic(PlayerType.Player, PlayerPointsThisTurn);
            MainPage.Current.StatsView.Stats.Stat(StatName.HandMostPoints).UpdateStatistic(PlayerType.Computer, ComputerPointsThisTurn);
            MainPage.Current.StatsView.Stats.Stat(StatName.HandTotalPoints).UpdateStatistic(PlayerType.Player, PlayerPointsThisTurn);
            MainPage.Current.StatsView.Stats.Stat(StatName.HandTotalPoints).UpdateStatistic(PlayerType.Computer, ComputerPointsThisTurn);
            MainPage.Current.StatsView.Stats.Stat(StatName.HandAveragePoints).UpdateStatistic(PlayerType.Player, 0);
            MainPage.Current.StatsView.Stats.Stat(StatName.HandAveragePoints).UpdateStatistic(PlayerType.Computer, 0);

            //
            // Crib stats
            MainPage.Current.StatsView.Stats.Stat(StatName.CribMostPoints).UpdateStatistic(dealer, cribScore);
            MainPage.Current.StatsView.Stats.Stat(StatName.CribTotalPoints).UpdateStatistic(dealer, cribScore);
            MainPage.Current.StatsView.Stats.Stat(StatName.CribAveragePoints).UpdateStatistic(dealer, 0);
            if (cribScore == 0)
            {
                MainPage.Current.StatsView.Stats.Stat(StatName.Crib0Points).UpdateStatistic(dealer, 1);
            }


            //
            // keeping track of 0's
            if (PlayerPointsThisTurn == 0)
            {
                MainPage.Current.StatsView.Stats.Stat(StatName.Hand0Points).UpdateStatistic(PlayerType.Player, 1);
            }

            if (ComputerPointsThisTurn == 0)
            {
                MainPage.Current.StatsView.Stats.Stat(StatName.Hand0Points).UpdateStatistic(PlayerType.Computer, 1);
            }

            if (nComputerCountingPoint == 0)
            {
                MainPage.Current.StatsView.Stats.Stat(StatName.Counting0Points).UpdateStatistic(PlayerType.Computer, 1);
            }

            if (nPlayerCountingPoint == 0)
            {
                MainPage.Current.StatsView.Stats.Stat(StatName.Counting0Points).UpdateStatistic(PlayerType.Player, 1);
            }
        }