Skip to content

Commit

Permalink
correção de codigo
Browse files Browse the repository at this point in the history
Correção de algumas linhas,
troca de icones.
  • Loading branch information
beritcarvalho committed Apr 12, 2021
1 parent 6a044e3 commit 8b7bb43
Show file tree
Hide file tree
Showing 93 changed files with 264 additions and 928 deletions.
Binary file modified .vs/blackjack2.0/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file modified .vs/blackjack2.0/v16/.suo
Binary file not shown.
20 changes: 10 additions & 10 deletions blackjack2.0/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 69 additions & 6 deletions blackjack2.0/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,18 @@ public partial class Form1 : Form
public Form1()
{
InitializeComponent();

//desabilitando a visualizaçao label de pontos
lblResultadoP1.Visible = false;

//desabilitando o botao reiniciar
btnReiniciar.Enabled = false;
lblReiniciar.ForeColor = Color.Gray;
btnReiniciar.BackgroundImage = Properties.Resources.reiniciar_disable;

//desabilitando o botao manter
btnManterP1.Enabled = false;
btnManterP1.BackgroundImage = Properties.Resources.manter_disable;

}


Expand Down Expand Up @@ -295,9 +305,13 @@ public static int PedirCartas(PictureBox carta)
int pontosP1 = 0;
private void btnPedirMaisP1_Click(object sender, EventArgs e)
{
//hablitando o botao manter
btnManterP1.Enabled = true;
btnManterP1.BackgroundImage = Properties.Resources.manter;

//habilitando o botao Reiniciar!
btnReiniciar.Enabled = true;
lblReiniciar.ForeColor = Color.Black;
btnReiniciar.BackgroundImage = Properties.Resources.reiniciar;

//mostrando carta e atribuindo o valor da variavel cartaAtual
int cartaAtual = PedirCartas(pibCartasP1);
Expand All @@ -307,29 +321,78 @@ private void btnPedirMaisP1_Click(object sender, EventArgs e)
pontosP1 += cartaAtual;
lblPontosP1.Text = pontosP1.ToString();

Resultado(pontosP1, lblResultadoP1);
//executando a função Resultado
Resultado(pontosP1, btnPedirMaisP1, btnManterP1, lblResultadoP1);

}

//método de resultado de jogo
private void Resultado(int pontos, Label lblpontos)
private void Resultado(int pontos, Button btnPedirMais, Button btnManter, Label lblResultado)
{
if (pontos > 21)
{
lblpontos.Text = "ESTOUROU";
lblResultado.Text = "ESTOUROU";

btnPedirMais.Enabled = false;

//desabilitando o botao manter
btnManter.Enabled = false;
btnManter.BackgroundImage = Properties.Resources.manter_disable;

//habilitando a visualizaçao label de pontos
lblResultado.Visible = true;

}
else if (pontosP1 == 21)
{
lblpontos.Text = "GANHOU!!!";
lblResultado.Text = "GANHOU!!!";
btnPedirMais.Enabled = false;

//desabilitando o botao manter
btnManter.Enabled = false;
btnManter.BackgroundImage = Properties.Resources.manter_disable;

//habilitando a visualizaçao label de pontos
lblResultado.Visible = true;

}

}

private void btnReiniciar_Click(object sender, EventArgs e)
{

//desabilitando a visualizaçao label de pontos
lblResultadoP1.Visible = false;

//desabilitando o botao reiniciar
btnReiniciar.Enabled = false;
btnReiniciar.BackgroundImage = Properties.Resources.reiniciar_disable;

//desabilitando o botao manter
btnManterP1.Enabled = false;
btnManterP1.BackgroundImage = Properties.Resources.manter_disable;

//zerando os pontos e motrando na tela
pontosP1 = 0;
lblPontosP1.Text = pontosP1.ToString();

//habilitando btnPedirmais
btnPedirMaisP1.Enabled = true;
btnPedirMaisP1.BackgroundImage = Properties.Resources.pedir;


}

private void btnManterP1_Click(object sender, EventArgs e)
{
btnPedirMaisP1.Enabled = false;
btnPedirMaisP1.BackgroundImage = Properties.Resources.pedir_disable;

//desabilitando o botao manter
btnManterP1.Enabled = false;
btnManterP1.BackgroundImage = Properties.Resources.manter_disable;

}
}

Expand Down
Loading

0 comments on commit 8b7bb43

Please sign in to comment.