private void Card1_Loaded_1(object sender, RoutedEventArgs e) { PlayerCard.DisplayCard(game.PlayerCards[0]); Card1.DisplayCard(0); Card1.IsEnabled = false; Shuffle_Button.IsEnabled = false; game.SetPlayerCard(game.PlayerCards[0]); ComputerCard.DisplayCard(game.ComputerSelectedCard); }
private void SetupGame() { Start.IsEnabled = true; PickCard1.IsEnabled = false; PickCard2.IsEnabled = false; PickCard3.IsEnabled = false; Shuffle.IsEnabled = false; Card1.DisplayCard(1); Card2.DisplayCard(1); Card3.DisplayCard(1); PlayerCard.DisplayCard(1); CPUCard.DisplayCard(1); StatusMessage.Text = "Press Start!"; }
private void PickCard3_Click(object sender, RoutedEventArgs e) { PickCard1.IsEnabled = false; PickCard2.IsEnabled = false; PickCard3.IsEnabled = false; Shuffle.IsEnabled = false; PlayerCard.DisplayCard(Cards[2]); Card1.DisplayCard(14); Card2.DisplayCard(14); Card3.DisplayCard(14); int PlayerIndex = Cards[2]; GameRules(PlayerIndex); }
private async System.Threading.Tasks.Task AfterTapAsync(object sender, int index) { PlayingCards cardUsed = (PlayingCards)sender; //1. Display card on the table PlayerCard.DisplayCard($"{game.PlayerCards[index]}C"); //2. hide selected card cardUsed.DisplayCard("BC"); cardUsed.IsEnabled = false; Shuffle_Button.IsEnabled = false; //3. show the computer selection game.SetPlayerCard(game.PlayerCards[index]); CompCard.DisplayCard($"{game.ComputerSelection}C"); UpdateScores(); _cardTapCounter++; if (_cardTapCounter == 3) { if (game.ComputerScore > game.PlayerScore) { game.ComputerScore = 0; game.PlayerScore = 0; winner = "COMPUTER"; } else if (game.ComputerScore < game.PlayerScore) { game.ComputerScore = 0; game.PlayerScore = 0; winner = "PLAYER"; } Winner.Text = $"{winner} IS THE WINNER"; Shuffle_Button.IsEnabled = true; _cardTapCounter = 0; } }