private async Task DealCards() { Deck.Instance.Shuffle(); for (int index = 0; index < this.pokerDatabase.Players.Length; index++) { if (this.pokerDatabase.Players[index].ChipsSet.Amount > 0) { this.pokerDatabase.Players[index].Hand.Card1 = Deck.Instance.Cards[2 * index]; this.pokerDatabase.Players[index].Hand.Card2 = Deck.Instance.Cards[2 * index + 1]; this.pokerDatabase.Players[index].IsFolded = false; this.pokerDatabase.Players[index].AllInAmount = 0; this.pokerDatabase.Players[index].RaiseAmount = 0; this.pokerDatabase.Players[index].PrevRaise = 0; this.pokerDatabase.Players[index].Card1PictureBox.Visible = true; this.pokerDatabase.Players[index].Card2PictureBox.Visible = true; } else { this.pokerDatabase.Players[index].IsFolded = true; this.pokerDatabase.Players[index].Card1PictureBox.Visible = false; this.pokerDatabase.Players[index].Card2PictureBox.Visible = false; } } this.pokerDatabase.Players[0].Card1PictureBox.Image = this.pokerDatabase.Players[0].Hand.Card1.CardImage; await Task.Delay(150); this.pokerDatabase.Players[0].Card2PictureBox.Image = this.pokerDatabase.Players[0].Hand.Card2.CardImage; await Task.Delay(150); for (int botIndex = 1; botIndex < this.pokerDatabase.Players.Length; botIndex++) { this.pokerDatabase.Players[botIndex].Card1PictureBox.Image = Image.FromFile(Common.ImagesBackDefaultPath); await Task.Delay(150); this.pokerDatabase.Players[botIndex].Card2PictureBox.Image = Image.FromFile(Common.ImagesBackDefaultPath); await Task.Delay(150); } for (int index = Common.TotalNumberPlayersCards; index < Common.TotalNumberPlayersCards + Common.NumberOfBoardCards; index++) { this.board[index - Common.TotalNumberPlayersCards] = Deck.Instance.Cards[index]; PictureBox boardCardPictureBox = new PictureBox(); boardCardPictureBox.Location = Locations.BoardCardsLocations(index - Common.TotalNumberPlayersCards); boardCardPictureBox.Width = 80; boardCardPictureBox.Height = 130; boardCardPictureBox.Image = this.board[index - Common.TotalNumberPlayersCards].CardImage; boardCardPictureBox.SizeMode = PictureBoxSizeMode.StretchImage; boardCardPictureBox.Visible = false; this.boardPictureBoxes[index - Common.TotalNumberPlayersCards] = boardCardPictureBox; this.Controls.Add(this.boardPictureBoxes[index - Common.TotalNumberPlayersCards]); } while (true) { this.pokerDatabase.Players[4].ChipsSet.Amount -= this.smallBlind; this.pokerDatabase.Players[4].ChipsTextBox.Text = this.pokerDatabase.Players[4].ChipsSet.ToString(); this.pokerDatabase.Players[5].ChipsSet.Amount -= this.bigBlind; this.pokerDatabase.Players[5].ChipsTextBox.Text = this.pokerDatabase.Players[5].ChipsSet.ToString(); await this.ProcessHand(); await this.DealCards(); } }