Всего за 990 руб. Купить полную версию
//Discontent of support group with our exceeding of
//cards:
Assembly a2 = Assembly.GetExecutingAssembly();
Stream s2 =
a2.GetManifestResourceStream(
"PocketJack.pj_busted.wav");
SoundPlayer player2 = new SoundPlayer(s2);
player2.Play();
break;
case GameMode.PocketJack:
BetMinusToolStripMenuItem1.Enabled = false;
BetPlusToolStripMenuItem.Enabled = false;
HitMeToolStripMenuItem.Enabled = false;
StayToolStripMenuItem.Text = "Distribution of cards";
StayToolStripMenuItem.Enabled = true;
MenuToolStripMenuItem.Text = "Menu";
MenuToolStripMenuItem.Enabled = true;
//A victorious tune after Pocket Jack with 21 points:
Assembly a3 = Assembly.GetExecutingAssembly();
Stream s3 =
a3.GetManifestResourceStream(
"PocketJack.pj_pj.wav");
SoundPlayer player3 = new SoundPlayer(s3);
player3.Play();
break;
case GameMode.DealerActive:
BetMinusToolStripMenuItem1.Enabled = false;
BetPlusToolStripMenuItem.Enabled = false;
HitMeToolStripMenuItem.Enabled = false;
StayToolStripMenuItem.Text = "Distribution of cards";
StayToolStripMenuItem.Enabled = false;
MenuToolStripMenuItem.Text = "Menu";
MenuToolStripMenuItem.Enabled = true;
break;
case GameMode.DealerWon:
BetMinusToolStripMenuItem1.Enabled = false;
BetPlusToolStripMenuItem.Enabled = false;
HitMeToolStripMenuItem.Enabled = false;
StayToolStripMenuItem.Text = "Distribution of cards";
StayToolStripMenuItem.Enabled = true;
MenuToolStripMenuItem.Text = "Menu";
MenuToolStripMenuItem.Enabled = true;
//Discontent of support group with our exceeding of
//cards:
Assembly a4 = Assembly.GetExecutingAssembly();
Stream s4 =
a4.GetManifestResourceStream(
"PocketJack.pj_busted.wav");
SoundPlayer player4 = new SoundPlayer(s4);
player4.Play();
break;
case GameMode.DealerBust:
BetMinusToolStripMenuItem1.Enabled = false;
BetPlusToolStripMenuItem.Enabled = false;
HitMeToolStripMenuItem.Enabled = false;
StayToolStripMenuItem.Text = "Distribution of cards";
StayToolStripMenuItem.Enabled = true;
MenuToolStripMenuItem.Text = "Menu";
MenuToolStripMenuItem.Enabled = true;
//An applause in our address for a prize in cards:
Assembly a5 = Assembly.GetExecutingAssembly();
Stream s5 =
a5.GetManifestResourceStream(
"PocketJack.pj_claps.wav");
SoundPlayer player5 = new SoundPlayer(s5);
player5.Play();
break;
case GameMode.Push:
BetMinusToolStripMenuItem1.Enabled = false;
BetPlusToolStripMenuItem.Enabled = false;
HitMeToolStripMenuItem.Enabled = false;
StayToolStripMenuItem.Text = "Distribution of cards";
StayToolStripMenuItem.Enabled = true;
MenuToolStripMenuItem.Text = "Menu";
MenuToolStripMenuItem.Enabled = true;
break;
}
modeValue = value;
this.Invalidate();
}
}
//We load the game objects:
public void init()
{
System.Reflection.Assembly asm =
System.Reflection.Assembly.GetExecutingAssembly();
loadingImage = new Bitmap(asm.GetManifestResourceStream(
"PocketJack.images.loading.gif"));
bankImage = new Bitmap(asm.GetManifestResourceStream(
"PocketJack.images.bank.jpg"));
mode = GameMode.LoadingDisplay;
this.Visible = true;
this.Refresh();
pot = new Pot();
//We create also initsializuy the help Form2 form:
helpForm = new Form2();
}
void startGame()
{
shoe = new CardShoe();
//We comment in the original,
//since this line only for testing of a game:
//shoe =
//new CardShoe(new byte[] { 2, 14, 11, 25, 10, 7, 6, 5 });
pot.ResetPot();
mode = GameMode.PlacingBets;
}
void startHand()
{
mode = GameMode.PlacingBets;
}
void showPot()
{
this.Text =
"Bank: " + pot.PotValue.ToString() + " Bet: " +
pot.BetValue.ToString();
}
void startPlay()
{
//We commented out in the original:
//pot.DoPlaceBet();
//We write in the original:
if (mode == GameMode.PlayerBust && mode == GameMode.DealerWon)
pot.DoPlaceBet();
showPot();
// clear the hands
playerHand.Clear();
dealerHand.Clear();
// deal the face down hole card
dealerHoleCard = shoe.DealCard();
dealerHoleCard.FaceUp = false;
dealerHand.Add(dealerHoleCard);
// deal the first player card
playerHand.Add(shoe.DealCard());
// deal the second dealer card (face up)
dealerHand.Add(shoe.DealCard());
// deal the second player card
playerHand.Add(shoe.DealCard());
if ((dealerHand.BlackJackScoreHand() == 21) &&
(playerHand.BlackJackScoreHand() != 21))
{
//We write in the original:
pot.DoPlaceBet();
pot.HouseWins();
showPot();
//Discontent of support group with our exceeding of
//cards:
Assembly a2 = Assembly.GetExecutingAssembly();
Stream s2 =
a2.GetManifestResourceStream("PocketJack.pj_busted.wav");
SoundPlayer player2 = new SoundPlayer(s2);
player2.Play();
dealerHoleCard.FaceUp = true;
mode = GameMode.DealerWon;
return;
}
if ((playerHand.BlackJackScoreHand() == 21) &&
(dealerHand.BlackJackScoreHand() != 21))
{
pot.PlayerWins();
showPot();
dealerHoleCard.FaceUp = true;
mode = GameMode.PocketJack;
return;
}
if ((playerHand.BlackJackScoreHand() == 21) &&
(dealerHand.BlackJackScoreHand() == 21))
{
pot.DoPushBet();
showPot();
dealerHoleCard.FaceUp = true;
mode = GameMode.Push;
return;
}
mode = GameMode.PlayerActive;
}
Font messageFont = new Font(FontFamily.GenericSansSerif, 20,
FontStyle.Regular);
void paintForm(Graphics g)
{
switch (mode)
{
case GameMode.LoadingDisplay:
//We draw all images below the menu:
g.DrawImage(
bankImage, 0, StayToolStripMenuItem.Height);
g.DrawImage(
loadingImage, 0, StayToolStripMenuItem.Height + 60);
break;
case GameMode.PlacingBets:
g.DrawImage(bankImage, 0, StayToolStripMenuItem.Height);
Utilities.BigText("Bank : " + pot.PotValue.ToString(),
10, 40, Color.Black,
Color.Yellow, messageFont, g);
Utilities.BigText("Bet : " +
pot.BetValue.ToString(), 10, 80, Color.Black,
Color.Yellow, messageFont, g);
break;
case GameMode.PlayerActive:
dealerHand.DrawHand(g, 10, 30, 80, 25);
playerHand.DrawHand(g, 10, 135, 20, 25);
Utilities.BigText(playerHand.BlackJackScoreHand().
ToString(), 140, 150, Color.Black,
Color.Yellow, messageFont, g);
break;
case GameMode.PlayerWon:
case GameMode.PocketJack:
dealerHand.DrawHand(g, 10, 30, 20, 25);
playerHand.DrawHand(g, 10, 135, 20, 25);
Utilities.BigText(dealerHand.BlackJackScoreHand().
ToString(), 140, 45, Color.Black,
Color.Yellow, messageFont, g);
Utilities.BigText(playerHand.BlackJackScoreHand().
ToString(), 140, 150, Color.Black,
Color.Yellow, messageFont, g);
Utilities.BigText("Вы выиграли!",
20, 80, Color.Black, Color.Yellow, messageFont, g);
break;
case GameMode.PlayerBust:
dealerHand.DrawHand(g, 10, 30, 80, 25);
playerHand.DrawHand(g, 10, 135, 20, 25);
Utilities.BigText(playerHand.BlackJackScoreHand().
ToString(), 140, 150, Color.Black,
Color.Yellow, messageFont, g);
Utilities.BigText("Вы перебрали.",
20, 80, Color.Black, Color.Red, messageFont, g);
break;
case GameMode.DealerActive:
dealerHand.DrawHand(g, 10, 30, 20, 25);
playerHand.DrawHand(g, 10, 135, 20, 25);
Utilities.BigText(dealerHand.BlackJackScoreHand().
ToString(), 140, 45, Color.Black,
Color.Yellow, messageFont, g);
Utilities.BigText(playerHand.BlackJackScoreHand().
ToString(), 140, 150, Color.Black,
Color.Yellow, messageFont, g);
break;
case GameMode.DealerWon:
dealerHand.DrawHand(g, 10, 30, 20, 25);
playerHand.DrawHand(g, 10, 135, 20, 25);
Utilities.BigText(dealerHand.BlackJackScoreHand().
ToString(), 140, 45, Color.Black,
Color.Yellow, messageFont, g);
Utilities.BigText(playerHand.BlackJackScoreHand().
ToString(), 140, 150, Color.Black,
Color.Yellow, messageFont, g);
Utilities.BigText("Вы потеряли.",
20, 80, Color.Black, Color.Red, messageFont, g);
break;
case GameMode.DealerBust:
dealerHand.DrawHand(g, 10, 30, 20, 25);
playerHand.DrawHand(g, 10, 135, 20, 25);
Utilities.BigText(dealerHand.BlackJackScoreHand().
ToString(), 140, 45, Color.Black,
Color.Yellow, messageFont, g);
Utilities.BigText(playerHand.BlackJackScoreHand().
ToString(), 140, 150, Color.Black,
Color.Yellow, messageFont, g);
Utilities.BigText("Dealer Bust",
20, 80, Color.Black, Color.Yellow, messageFont, g);
break;
case GameMode.Push:
dealerHand.DrawHand(g, 10, 30, 20, 25);
playerHand.DrawHand(g, 10, 135, 20, 25);