コード例 #1
0
 private void btnAskForaCard_Click(object sender, EventArgs e)
 {
     textBox1.Text = "";
     if (listHand.SelectedIndex < 0)
     {
         MessageBox.Show("Please Select a card");
         return;
     }
     if (game.PlayOneRound(listHand.SelectedIndex))
     {
         textBox1.Text         += " the winner is .. " + game.GetWinnerName();
         textBox3.Text          = game.DescribeBooks();
         btnAskForaCard.Enabled = false;
         for (int i = 1; i <= game.players.Count; i++)
         {
             Values cardPeek = game.players[i].GetRandomValue();
             game.PlayOneRound((int)cardPeek);
         }
     }
     else
     {
         textBox3.Text = game.DescribeBooks();
         UpdateForm();
     }
 }
コード例 #2
0
 private void askForACard_Click(object sender, RoutedEventArgs e)
 {
     if (cards.SelectedIndex >= 0)
     {
         game.PlayOneRound(cards.SelectedIndex);
     }
 }
コード例 #3
0
        private void AskForACard()
        {
            if (cards.SelectedIndex < 0)
            {
                MessageBox.Show("Please select a card");
                return;
            }

            game.PlayOneRound(cards.SelectedIndex);
        }
コード例 #4
0
 private void buttonAsk_Click(object sender, EventArgs e)
 {
     textProgress.Text = "";
     if (listHand.SelectedIndex < 0)
     {
         MessageBox.Show("Please select a card");
         return;
     }
     if (game.PlayOneRound(listHand.SelectedIndex))
     {
         textProgress.Text += $"The winner is... {game.GetWinnerName()}";
         textBooks.Text     = game.DescribeBooks();
         buttonAsk.Enabled  = false;
     }
     else
     {
         UpdateForm();
     }
 }
コード例 #5
0
ファイル: MainWindow.xaml.cs プロジェクト: listayefir/GoFish
 private void BtnAskForCard_Click(object sender, RoutedEventArgs e)
 {
     //TbGameProcess.Text = "";
     if (LbHand.SelectedIndex < 0 && LbHand.Items.Count != 0)
     {
         MessageBox.Show("Please select a card");
         return;
     }
     if (game.PlayOneRound(((Card)LbHand.SelectedItem).Value) || LbHand.Items.Count == 0)
     {
         TbGameProcess.Text     += game.GetWinnerName();
         TbBooks.Text           += game.DescribeBooks();
         BtnAskForCard.IsEnabled = false;
     }
     else
     {
         UpdateForm();
     }
 }
コード例 #6
0
 private void BtnAsk_Click(object sender, EventArgs e)
 {
     txtProgress.Text = string.Empty;
     if (lstHand.SelectedIndex < 0)
     {
         MessageBox.Show("Por favor escolha uma carta", "Impossível jogar",
                         MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     if (_game.PlayOneRound(lstHand.SelectedIndex))
     {
         txtProgress.Text += $"O vencedor é... {_game.GetWinnerName()}";
         txtBooks.Text     = _game.DescribeBooks();
         btnAsk.Enabled    = false;
     }
     else
     {
         UpdateForm();
     }
 }
コード例 #7
0
        private void askForACard_Click_1(object sender, RoutedEventArgs e)
        {
            gameProgress.Content = "";
            if (cards.SelectedIndex < 0)
            {
                MessageBox.Show("Please select a card");
                return;
            }

            if (game.PlayOneRound(cards.SelectedIndex))
            {
                gameProgress.Content += "The winner is... " + game.GetWinnerName();
                gameBooks.Content     = game.DescribeBooks();

                InitializeNewGame();
            }
            else
            {
                UpdateForm();
            }
        }