//下注完成開牌 public void opencard(guessCard guess) { bool bingo = false; int playerguess = (int)guess; int playermoney; if (!Int32.TryParse(lbmoney.Text, out playermoney)) { playermoney = 0; } int betMoney; if (!Int32.TryParse(tbmoney.Text, out betMoney)) { betMoney = 0; MessageBox.Show("下注金額請輸入整數數字"); return; } if (betMoney > 0 && betMoney <= playermoney) //押注金額>0並且<=剩下籌碼 { EnableButton(false); //隱藏按鈕 pictureBox1.Image = Image.FromFile(@d[a[0]]); int cardRate = -1; red = true; infolabel.Text = ""; flower = (byte)a[0] % 4; //花色 point = a[0] / 4; //點數 //四種花色依序是-Club,Diamond,Heart,Spade //判斷紅色還是黑色 if (flower == 3 || flower == 0) //黑色牌 { red = false; infolabel.Text = "黑色,"; if (playerguess == 1) { bingo = true; } } else { infolabel.Text = "紅色,"; if (playerguess == 0) { bingo = true; } } //判斷大小牌 if (point == 7) { bigsmall = 0; infolabel.Text += "大小通吃"; if (playerguess > 1) { bingo = true; } } else if (point < 7 && point != 0) { bigsmall = 1; infolabel.Text += "小"; if (playerguess == 3) { bingo = true; } } else { bigsmall = 2; infolabel.Text += "大"; if (playerguess == 2) { bingo = true; } } lbwinlose.Text = bingo ? "你贏了" : "你輸了"; if (bingo) { cardRate = 1; } playermoney += betMoney * cardRate; lbmoney.Text = playermoney.ToString(); //籌碼輸光 if (playermoney <= 0) { btnDeal.Text = "重新開始"; lbtoptext.Text = "你破產了,請按重新開始"; gameover = true; } } else { MessageBox.Show("請輸入大於0並且小於等於剩餘籌碼的金額。"); } }
//下注完成開牌 public void opencard(guessCard guess) { bool bingo = false; int playerguess = (int)guess; int playermoney; if (!Int32.TryParse(lbmoney.Text, out playermoney)) { playermoney = 0; } int betMoney; if (!Int32.TryParse(tbmoney.Text, out betMoney)) { betMoney = 0; MessageBox.Show("下注金額請輸入整數數字"); return; } if (betMoney > 0 && betMoney <= playermoney) //押注金額>0並且<=剩下籌碼 { EnableButton(false); //隱藏按鈕 pictureBox1.Image = Image.FromFile(@d[a[0]]); int cardRate = -1; infolabel.Text = ""; //回復判定大小為空白 point = a[0] / 4; //點數 if (point < 7 && point != 0) { bigsmall = 1; infolabel.Text += "此排為小"; if (playerguess == 1) { bingo = true; } } else { bigsmall = 2; infolabel.Text += "此排為大"; if (playerguess == 0) { bingo = true; } } bwinlose.Text = bingo ? "你贏了" : "你輸了"; //贏或輸改變籌碼數量 if (bingo) { cardRate = 1; } playermoney += betMoney * cardRate; lbmoney.Text = playermoney.ToString(); //籌碼輸光 if (playermoney <= 0) { btnDeal.Text = "重新開始"; lbtoptext.Text = "你破產了,請按重新開始"; gameover = true; } } else { MessageBox.Show("請輸入大於0並且小於等於剩餘籌碼的金額。"); } }
public void opencard(guessCard guess) { bool bingo = false; int playerguess = (int)guess; int playermoney; if (!Int32.TryParse(lbmoney.Text, out playermoney)) { playermoney = 0; } int betMoney; if (!Int32.TryParse(tbmoney.Text, out betMoney)) { betMoney = 0; MessageBox.Show("金額有在小數點逆?"); return; } if (betMoney > 0 && betMoney <= playermoney) { EnableButton(false); pictureBox1.Image = Image.FromFile(@d[a[0]]); int cardRate = -1; red = true; infolabel.Text = ""; flower = (byte)a[0] % 4; point = a[0] / 4; if (flower == 3 || flower == 0) { red = false; infolabel.Text = "黑色,"; if (playerguess == 1) { bingo = true; } } else { infolabel.Text = "紅色,"; if (playerguess == 0) { bingo = true; } } if (point == 7) { bigsmall = 0; infolabel.Text += "通殺"; if (playerguess > 1) { bingo = true; } } else if (point < 7 && point != 0) { bigsmall = 1; infolabel.Text += "小"; if (playerguess == 3) { bingo = true; } } else { bigsmall = 2; infolabel.Text += "大"; if (playerguess == 2) { bingo = true; } } lbwinlose.Text = bingo ? "你贏了" : "你輸了"; if (bingo) { cardRate = 1; s += 1; label3.Text = s.ToString(); } playermoney += betMoney * cardRate; lbmoney.Text = playermoney.ToString(); if (playermoney <= 0) { btnDeal.Text = "重新開始"; lbtoptext.Text = "你破產了,窮B"; gameover = true; } } else { MessageBox.Show("請輸入大於0並且小於等於剩餘籌碼的金額。"); } }