private void displayHouseHand(House house, Label labelName, Label labelCards, Label labelTotal) { labelName.Text = house.Name; displayHouseCards(house, labelCards); labelTotal.Text = TotalDisplayer.DisplayTotal(TotalCalculator.CalculateTotal(house.GetHand())); }
//Panel enter names private void btnOK2_Click(object sender, EventArgs e) { //Set player name if (count < playerCount) { players[count].Name = txtPlayerName.Text; txtPlayerName.Clear(); count++; if (count < playerCount) { labelPlayerCount2.Text = (count + 1).ToString(); players[count].Name = txtPlayerName.Text; } } //All players are named if (count >= playerCount) { panelAddName.Hide(); cards = deck.DealDeck(cards, players, house); //Display player hands panelPlayerHands.Show(); for (int i = 0; i < players.Length; i++) { playerPanelList[i].Show(); } panelHouse.Show(); if (players.Length == 1) { display1Player(); } else if (players.Length == 2) { display2Player(); } else if (players.Length == 3) { display3Player(); } else if (players.Length == 4) { display4Player(); } else if (players.Length == 5) { display5Player(); } else if (players.Length == 6) { display6Player(); } else { display7Player(); } //Display House hand string houseCards = ""; int houseTotal = TotalCalculator.CalculateTotal(house.GetHand()); for (int i = 0; i < house.GetHand().Length; i++) { if (i == 0 && houseTotal < 21) { houseCards += "XX\n"; i++; } houseCards += house.GetHand()[i].GetSuit().ToString() + house.GetHand()[i].GetFace(); } labelHouseCards.Text = houseCards; if (houseTotal == 21) { labelHouseTotal.Text = TotalDisplayer.DisplayTotal(TotalCalculator.CalculateTotal(house.GetHand())); } panelBet.Show(); labelPlayerTurnName.Text = players[betCounter].Name; } }
private void displayHand(Player player, Label labelName, Label labelCards, Label labelTotal) { labelName.Text = player.Name; displayCards(player, labelCards); labelTotal.Text = TotalDisplayer.DisplayTotal(TotalCalculator.CalculateTotal(player.GetHand())); }