Esempio n. 1
0
        public void FreshBankerInfo()
        {
            var info = RoundPlayers.Find(player => player != null && player.Seat == BankerSeat);

            if (info != null)
            {
                BankerInfo = info;
            }
        }
Esempio n. 2
0
        public void FreshWaitBankerList()
        {
            var freshBankers = new List <IRecycleData>();
            var oldBankers   = WaitBankers.ConvertAll(item => item as NbjlPlayerInfo);

            foreach (var waitBanker in oldBankers)
            {
                if (waitBanker != null)
                {
                    var getPlayer = RoundPlayers.Find(player => player != null && waitBanker.Seat == player.Seat);
                    if (getPlayer != null)
                    {
                        freshBankers.Add(getPlayer);
                    }
                }
            }
            WaitBankers = freshBankers.ToList();
        }
        public BlackjackGameRound(IEnumerable <BlackjackGameRoundPlayer> roundplayers)
        {
            if (roundplayers == null || !roundplayers.Any())
            {
                throw new InvalidOperationException("At least one player required to create a new round");
            }

            DealerCards = new List <Card>();
            Settlements = new List <BlackjackHandSettlement>();

            RoundPlayers = roundplayers.OrderBy(a => a.Player.Position).ToList();
            RoundPlayers.ForEach(player =>
            {
                player.HasAction = false;
            });

            IsInitialized = false;
        }
        public void InitializeAction()
        {
            if (IsInitialized)
            {
                return;
            }

            if (RoundPlayers.Any(a => a.HasAction))
            {
                throw new InvalidOperationException();
            }

            if (RoundPlayers.Any())
            {
                RoundPlayers.First().HasAction = true;
            }

            IsInitialized = true;
        }
        public bool MoveToNextAction()
        {
            var currentPlayerWithAction = RoundPlayers.SingleOrDefault(a => a.HasAction);

            if (currentPlayerWithAction == null)
            {
                return(false);
            }

            currentPlayerWithAction.HasAction = false;

            var nextPlayerWithAction = RoundPlayers
                                       .Where(a => a.Player.Position > currentPlayerWithAction.Player.Position)
                                       .OrderBy(a => a.Player.Position)
                                       .FirstOrDefault();

            if (nextPlayerWithAction == null)
            {
                return(false);
            }

            nextPlayerWithAction.HasAction = true;
            return(true);
        }
 public void SettleRoundPlayer(BlackjackGameRoundPlayer roundplayer, BlackjackHandSettlement settlement)
 {
     Settlements.Add(settlement);
     RoundPlayers.Remove(roundplayer);
 }
 public BlackjackGameRoundPlayer GetRoundPlayer(BlackjackGamePlayer player)
 {
     return(RoundPlayers.SingleOrDefault(a => a.Player.Id == player.Id));
 }
Esempio n. 8
0
 public void AddPlayers(PlayerVO[] players)
 {
     RoundPlayers = RoundPlayers.Concat(players).ToArray();
 }