示例#1
0
 private void btn_Rock_Click(object sender, RoutedEventArgs e)
 {
     userChoice = "r";
     RockPaperScissors RPS = new RockPaperScissors(userChoice);
     int computerThrow = RPS.computerThrow();
     int playerThrow = RPS.playerChoiceToInt(userChoice);
     txt_computerChoice.Text = RPS.computerChoiceToString(computerThrow);
     txt_winner.Text = RPS.determineWinner(computerThrow, playerThrow);
     btn_rock.Background = Brushes.AliceBlue;
     toggle_disabled();
 }
示例#2
0
 private void btn_Paper_Click(object sender, RoutedEventArgs e)
 {
     userChoice = "p";
     RockPaperScissors RPS = new RockPaperScissors(userChoice);
     int computerThrow = RPS.computerThrow();
     int playerThrow = RPS.playerChoiceToInt(userChoice);
     txt_computerChoice.Text = RPS.computerChoiceToString(computerThrow);
     txt_winner.Text = RPS.determineWinner(computerThrow, playerThrow);
     btn_paper.Background = Brushes.DarkRed;
     btn_paper.Foreground = Brushes.AntiqueWhite;
     toggle_disabled();
 }