Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • 8783497/puzzleplayer
1 result
Show changes
Commits on Source (2)
...@@ -43,7 +43,7 @@ namespace PuzzlePlayer_Namespace ...@@ -43,7 +43,7 @@ namespace PuzzlePlayer_Namespace
const int BLACKJACK = 21; //the value to get blackjack const int BLACKJACK = 21; //the value to get blackjack
Size screen = Screen.PrimaryScreen.WorkingArea.Size; Size screen = Screen.PrimaryScreen.WorkingArea.Size;
Brush TEXTBRUSH = Brushes.Black;
// visibility depends on game state // visibility depends on game state
Panel SetupPanel; Panel SetupPanel;
Panel GamePanel; Panel GamePanel;
...@@ -139,6 +139,28 @@ namespace PuzzlePlayer_Namespace ...@@ -139,6 +139,28 @@ namespace PuzzlePlayer_Namespace
dealButton.Click += DealButtonClick; dealButton.Click += DealButtonClick;
SetupPanel.Controls.Add(dealButton); SetupPanel.Controls.Add(dealButton);
// ALL IN BUTTON
Button allIn = new Button();
allIn.Text = "!ALL IN!";
allIn.Size = new Size(SetupPanel.Width / 4, SetupPanel.Height / 4);
allIn.Location = new Point(SetupPanel.Width - allIn.Width - 20, SetupPanel.Height / 4);
allIn.Font = new Font(BJFont, allIn.Size.Width / 5);
allIn.BackColor = Color.Red;
allIn.ForeColor = Color.DarkRed;
allIn.Click += AllInButtonClick;
SetupPanel.Controls.Add(allIn);
// ALL IN BUTTON
Button allIn2 = new Button();
allIn2.Text = "!ALL IN!";
allIn2.Size = new Size(SetupPanel.Width / 4, SetupPanel.Height / 4);
allIn2.Location = new Point(20, SetupPanel.Height / 4);
allIn2.Font = new Font(BJFont, allIn2.Size.Width / 5);
allIn2.BackColor = Color.Red;
allIn2.ForeColor = Color.DarkRed;
allIn2.Click += AllInButtonClick;
SetupPanel.Controls.Add(allIn2);
Controls.Add(SetupPanel); Controls.Add(SetupPanel);
#endregion #endregion
...@@ -194,6 +216,14 @@ namespace PuzzlePlayer_Namespace ...@@ -194,6 +216,14 @@ namespace PuzzlePlayer_Namespace
#endregion #endregion
} }
private void AllInButtonClick(object sender, EventArgs e)
{
deployedMoney += UserDataManager.Money;
UserDataManager.Money = 0;
Invalidate(true);
}
//button logic //button logic
private void MoneyButtonClick(object sender, EventArgs e) private void MoneyButtonClick(object sender, EventArgs e)
{ {
...@@ -332,7 +362,7 @@ namespace PuzzlePlayer_Namespace ...@@ -332,7 +362,7 @@ namespace PuzzlePlayer_Namespace
{ {
Graphics g = e.Graphics; Graphics g = e.Graphics;
Brush paintBrush = new SolidBrush(UserDataManager.Theme.secondaryColor); Brush paintBrush = new SolidBrush(UserDataManager.Theme.secondaryColor);
DrawMoney(g, paintBrush); DrawMoney(g, TEXTBRUSH);
// draw deployd money // draw deployd money
// Might update this to butiful chipss TODO // Might update this to butiful chipss TODO
...@@ -341,14 +371,14 @@ namespace PuzzlePlayer_Namespace ...@@ -341,14 +371,14 @@ namespace PuzzlePlayer_Namespace
SizeF pf = g.MeasureString(s, deplMoneyFont); SizeF pf = g.MeasureString(s, deplMoneyFont);
PointF p = new PointF(SetupPanel.Width / 2 - pf.Width / 2, SetupPanel.Height / 2); PointF p = new PointF(SetupPanel.Width / 2 - pf.Width / 2, SetupPanel.Height / 2);
g.DrawString(s, deplMoneyFont, paintBrush, p); g.DrawString(s, deplMoneyFont, TEXTBRUSH, p);
} }
private void Game_Paint(object sender, PaintEventArgs e) private void Game_Paint(object sender, PaintEventArgs e)
{ {
Graphics g = e.Graphics; Graphics g = e.Graphics;
Brush paintBrush = new SolidBrush(UserDataManager.Theme.secondaryColor); Brush paintBrush = new SolidBrush(UserDataManager.Theme.secondaryColor);
DrawMoney(g, paintBrush); DrawMoney(g, TEXTBRUSH);
int cardWidth = screen.Width/8; //lucky number int cardWidth = screen.Width/8; //lucky number
int cardHeight = (int)(cardWidth * cardMultply); int cardHeight = (int)(cardWidth * cardMultply);
...@@ -379,17 +409,17 @@ namespace PuzzlePlayer_Namespace ...@@ -379,17 +409,17 @@ namespace PuzzlePlayer_Namespace
SizeF playerSF = g.MeasureString(playerString, f); SizeF playerSF = g.MeasureString(playerString, f);
PointF playerStrPos = new PointF(GamePanel.Width / 2 - playerSF.Width / 2, GamePanel.Height - cardHeight - playerSF.Height); PointF playerStrPos = new PointF(GamePanel.Width / 2 - playerSF.Width / 2, GamePanel.Height - cardHeight - playerSF.Height);
g.DrawString(playerString, f, paintBrush, playerStrPos); g.DrawString(playerString, f, TEXTBRUSH, playerStrPos);
SizeF dealerSF = g.MeasureString(dealerString, f); SizeF dealerSF = g.MeasureString(dealerString, f);
PointF dealerStrPos = new PointF(GamePanel.Width / 2 - dealerSF.Width / 2, cardHeight); PointF dealerStrPos = new PointF(GamePanel.Width / 2 - dealerSF.Width / 2, cardHeight);
g.DrawString(dealerString, f, paintBrush, dealerStrPos); g.DrawString(dealerString, f, TEXTBRUSH, dealerStrPos);
//draw deployed money //draw deployed money
string deployedString = $"Playing for ${deployedMoney}"; string deployedString = $"Playing for ${deployedMoney}";
SizeF deployedSF = g.MeasureString(deployedString, f); SizeF deployedSF = g.MeasureString(deployedString, f);
PointF deployedStrPos = new PointF(GamePanel.Width/2 - deployedSF.Width / 2,GamePanel.Height/2 - deployedSF.Height/2); PointF deployedStrPos = new PointF(GamePanel.Width/2 - deployedSF.Width / 2,GamePanel.Height/2 - deployedSF.Height/2);
g.DrawString(deployedString,f, paintBrush, deployedStrPos); g.DrawString(deployedString,f, TEXTBRUSH, deployedStrPos);
// draw result text when ready // draw result text when ready
if (resultReady) if (resultReady)
......
...@@ -183,19 +183,7 @@ namespace PuzzlePlayer_Namespace ...@@ -183,19 +183,7 @@ namespace PuzzlePlayer_Namespace
blackJackButton.Click += (object o, EventArgs e) => { blackJackButton.Click += (object o, EventArgs e) => {
this.Hide(); this.Hide();
bj.FormClosed += (object o, FormClosedEventArgs fcea) => bj.FormClosed += ReShowFormHandler;
{
this.BackColor = UserDataManager.Theme.primaryColor;
this.ForeColor = UserDataManager.Theme.tertiaryColor;
foreach (Control control in this.Controls)
{
SettingForm.UpdateControl(control);
}
this.Show();
bj = new BlackJack();
};
bj.Show(); bj.Show();
}; };
...@@ -216,6 +204,7 @@ namespace PuzzlePlayer_Namespace ...@@ -216,6 +204,7 @@ namespace PuzzlePlayer_Namespace
private void ReShowFormHandler(object o, FormClosedEventArgs e) private void ReShowFormHandler(object o, FormClosedEventArgs e)
{ {
SetUpPuzzleForms(); // To make sure they have the right colours SetUpPuzzleForms(); // To make sure they have the right colours
bj = new BlackJack();
this.BackColor = UserDataManager.Theme.primaryColor; this.BackColor = UserDataManager.Theme.primaryColor;
......