Пример #1
0
        public BlackjackGamePlayerViewModel(BlackjackGamePlayer player, int secondsAwaitingAction, BlackjackHandSettlement settlement = null)
        {
            if (player == null)
            {
                throw new ArgumentNullException("player");
            }

            Id                    = player.Id;
            Name                  = player.Alias;
            Balance               = player.Account.Balance.ToString();
            IsLive                = player.IsLive;
            HasAction             = player.HasAction;
            Position              = player.Position;
            SecondsAwaitingAction = secondsAwaitingAction;

            BlackjackHand hand;

            if (settlement != null)
            {
                hand  = settlement.PlayerHand;
                Wager = settlement.WagerAmount.ToString();
                RecentWagerOutcome = settlement.WagerOutcome.ToString();
            }
            else
            {
                hand  = player.Hand;
                Wager = player.Wager.ToString();
                RecentWagerOutcome = "";
            }
            Hand = new BlackjackHandViewModel(hand);
        }
Пример #2
0
        public BlackjackGameDealerViewModel(BlackjackGame game)
        {
            if (game == null)
            {
                throw new ArgumentNullException("game");
            }

            Name        = "Dealer";
            Hand        = new BlackjackHandViewModel(game.DealerHand);
            CanShowHand = game.Players.All(a => !a.HasAction);
            PercentOfCardsRemainingInShoe = game.PercentRemainingInDealerShoe;
        }