private void btnHightScore_Click(object sender, EventArgs e) { if (!checkBackgroundMusic) { backgroundMusic.Menu(); checkBackgroundMusic = !checkBackgroundMusic; } LoadHightScore(); pictureBox.BringToFront(); pictureBox.Visible = true; pictureBox.Image = game3.Properties.Resources.background_score; this.KeyPreview = false; btnPlay.Iconimage = game3.Properties.Resources.play; btnPlay.Text = " Play"; checkPlay = !checkPlay; lblHightScore.Visible = Score1.Visible = Score3.Visible = Score2.Visible = true; lblHightScore.BringToFront(); Score1.BringToFront(); Score2.BringToFront(); Score3.BringToFront(); }
// Use this for initialization void OnTriggerEnter2D(Collider2D collider) { if (collider.tag == "weapon") { Score1.AddPoint(); Destroy(collider.gameObject); //gameObject.SetActive(false); } }
// Use this for initialization void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
// Use this for initialization void Start() { // static変数の初期化(ゲーム開始時) stopGame = false; moveBall = false; moveGame = true; // スコアの取得 score1 = GameObject.FindGameObjectWithTag("Score1").GetComponent <Score1>(); score2 = GameObject.FindGameObjectWithTag("Score2").GetComponent <Score2>(); }
void ShowScores() { p1.text = Player1; p2.text = Player2; p3.text = Player3; p4.text = Player4; p5.text = Player5; s1.text = Score1.ToString(); s2.text = Score2.ToString(); s3.text = Score3.ToString(); s4.text = Score4.ToString(); s5.text = Score5.ToString(); }
private void Window_KeyDown(object sender, KeyEventArgs e) { Send(e.Key.ToString(), "/l"); if (Common.IsHost) { if (e.Key.ToString().Contains(LetterBox.Text)) { Combo1++; ComboBox1.Text = Combo1.ToString(); Score1 += 2 * Combo1; ScoreBox1.Text = Score1.ToString(); Margin_Letter = 0; InitPicTimer1(); LetterBox.Text = NormArr[GenerateNext()]; EnemyImg.Margin = new Thickness(0, 0, 0, 350); } else { Combo1 = 0; ComboBox1.Text = Combo1.ToString(); } } else { if (e.Key.ToString().Contains(LetterBox.Text)) { Combo2++; ComboBox2.Text = Combo2.ToString(); Score2 += 2 * Combo2; ScoreBox2.Text = Score2.ToString(); InitPicTimer2(); Margin_Letter = 0; LetterBox.Text = NormArr[GenerateNext()]; EnemyImg.Margin = new Thickness(0, 0, 0, 350); } else { Combo2 = 0; ComboBox2.Text = Combo2.ToString(); } } }
private void Play(object sender, EventArgs e) { PlayTime -= 1; TimeBox.Text = PlayTime.ToString(); if (PlayTime < 0) { timerMove.Stop(); timerPlay.Stop(); TimeBox.Text = ""; LetterBox.Text = ""; if (Common.IsHost) { MessageBox.Show("Поздравляем, вы набрали: " + Score1.ToString() + " очков"); MessageBox.Show("Ваш противник набрал: " + Score2.ToString() + " очков"); } else { MessageBox.Show("Поздравляем, вы набрали: " + Score2.ToString() + " очков"); MessageBox.Show("Ваш противник набрал: " + Score1.ToString() + " очков"); } } }
private void bStop_Click(object sender, RoutedEventArgs e) { Send("", "/p"); Margin_Letter = 0; timerMove.Stop(); timerPlay.Stop(); TimeBox.Text = ""; LetterBox.Text = ""; if (Common.IsHost) { MessageBox.Show("Поздравляем, вы набрали: " + Score1.ToString() + " очков"); MessageBox.Show("Ваш противник набрал: " + Score2.ToString() + " очков"); } else { MessageBox.Show("Поздравляем, вы набрали: " + Score2.ToString() + " очков"); MessageBox.Show("Ваш противник набрал: " + Score1.ToString() + " очков"); } EnemyImg.Visibility = Visibility.Hidden; LetterBox.Visibility = Visibility.Hidden; EnemyImg.Margin = new Thickness(0, 0, 0, 350); }
void Start() { Score1.AddPoint(); Score = PlayerPrefs.GetInt("Score", Score); highScore = PlayerPrefs.GetInt("highScore", 0); }
public void AvailableMoves(string[,] gameBg, CollisionDect dect) { //clears list each time function is used Score0.Clear(); Score1.Clear(); Score2.Clear(); Score3.Clear(); for (int x = 2; x <= 9; x++) { for (int y = 2; y <= 9; y++) { //down for downward movement //finds moves for O or kO looks looks for a space DOWN and RIGHT and ethier a X or kX if ((gameBg[x, y] == "O " || gameBg[x, y] == "kO") && gameBg[x + 1, y - 1] == "\0 " && gameBg[x + 2, y - 2] == "X " || gameBg[x + 2, y - 2] == "kX") { int tempX = x + 1; int tempY = y - 1; dect.AnotherMove = false; score0.Add(x.ToString() + "," + y.ToString() + "-" + tempX.ToString() + "," + tempY.ToString()); } //finds moves for O or kO looks looks for a space DOWN and LEFT and ethier a X or kX if ((gameBg[x, y] == "O " || gameBg[x, y] == "kO") && gameBg[x + 1, y + 1] == "\0 " && gameBg[x + 2, y + 2] == "X " || gameBg[x + 2, y + 2] == "kX") { int tempX = x + 1; int tempY = y + 1; dect.AnotherMove = false; score0.Add(x.ToString() + "," + y.ToString() + "-" + tempX.ToString() + "," + tempY.ToString()); } //finds moves for O or kO looks looks for a space DOWN and RIGHT and a space DOWN and RIGHT if ((gameBg[x, y] == "O " || gameBg[x, y] == "kO") && gameBg[x + 1, y - 1] == "\0 " && gameBg[x + 2, y - 2] == "\0 ") { int tempX = x + 1; int tempY = y - 1; dect.AnotherMove = false; score1.Add(x.ToString() + "," + y.ToString() + "-" + tempX.ToString() + "," + tempY.ToString()); } //finds moves for O or kO looks looks for a space DOWN and RIGHT and a space DOWN and LEFT if ((gameBg[x, y] == "O " || gameBg[x, y] == "kO") && gameBg[x + 1, y + 1] == "\0 " && gameBg[x + 2, y + 2] == "\0 ") { int tempX = x + 1; int tempY = y + 1; dect.AnotherMove = false; score1.Add(x.ToString() + "," + y.ToString() + "-" + tempX.ToString() + "," + tempY.ToString()); } //finds moves for O or kO looks looks for a space DOWN and RIGHT and a space DOWN and RIGHT if ((gameBg[x, y] == "O " || gameBg[x, y] == "kO") && gameBg[x + 1, y - 1] == "\0 " && gameBg[x + 2, y - 2] == "N ") { int tempX = x + 1; int tempY = y - 1; dect.AnotherMove = false; score1.Add(x.ToString() + "," + y.ToString() + "-" + tempX.ToString() + "," + tempY.ToString()); } //finds moves for O or kO looks looks for a space DOWN and LEFT and a space DOWN and LEFT if ((gameBg[x, y] == "O " || gameBg[x, y] == "kO") && gameBg[x + 1, y + 1] == "\0 " && gameBg[x + 2, y + 2] == "N ") { int tempX = x + 1; int tempY = y + 1; dect.AnotherMove = false; score1.Add(x.ToString() + "," + y.ToString() + "-" + tempX.ToString() + "," + tempY.ToString()); } //finds moves for O or kO looks looks for a space DOWN and RIGHT and a space DOWN and RIGHT if ((gameBg[x, y] == "O " || gameBg[x, y] == "kO") && gameBg[x + 1, y - 1] == "X " && (gameBg[x + 2, y - 2] == "\0 ")) { int tempX = x + 1; int tempY = y - 1; dect.CheckerTaken = true; score2.Add(x.ToString() + "," + y.ToString() + "-" + tempX.ToString() + "," + tempY.ToString()); } //finds moves for O or kO looks looks for a space DOWN and LEFT and a space DOWN and LEFT if ((gameBg[x, y] == "O " || gameBg[x, y] == "kO") && gameBg[x + 1, y + 1] == "X " && gameBg[x + 2, y + 2] == "\0 ") { int tempX = x + 1; int tempY = y + 1; dect.CheckerTaken = true; score2.Add(x.ToString() + "," + y.ToString() + "-" + tempX.ToString() + "," + tempY.ToString()); } //finds moves for O or kO looks looks for a space DOWN and RIGHT and a space DOWN and RIGHT if ((gameBg[x, y] == "O " || gameBg[x, y] == "kO") && gameBg[x + 1, y - 1] == "kX" && (gameBg[x + 2, y - 2] == "\0 ")) { int tempX = x + 1; int tempY = y - 1; dect.CheckerTaken = true; score3.Add(x.ToString() + "," + y.ToString() + "-" + tempX.ToString() + "," + tempY.ToString()); } //finds moves for O or kO looks looks for a space DOWN and LEFT and a space DOWN and LEFT if ((gameBg[x, y] == "O " || gameBg[x, y] == "kO") && gameBg[x + 1, y + 1] == "kX" && gameBg[x + 2, y + 2] == "\0 ") { int tempX = x + 1; int tempY = y + 1; dect.CheckerTaken = true; score3.Add(x.ToString() + "," + y.ToString() + "-" + tempX.ToString() + "," + tempY.ToString()); } //checks for O and kO checks if the row is 9 so checker changes to king down and RIGHT for space if (gameBg[x, y] == "O " && x == 9 && gameBg[x + 1, y - 1] == "\0 ") { int tempX = x + 1; int tempY = y - 1; dect.AnotherMove = false; score4.Add(x.ToString() + "," + y.ToString() + "-" + tempX.ToString() + "," + tempY.ToString()); } //checks for O and kO checks if the row is 9 so checker changes to king down and LEFT for space if (gameBg[x, y] == "O " && x == 9 && gameBg[x + 1, y + 1] == "\0 ") { int tempX = x + 1; int tempY = y + 1; dect.AnotherMove = false; score4.Add(x.ToString() + "," + y.ToString() + "-" + tempX.ToString() + "," + tempY.ToString()); } //*******************************************************************************************88 //up movement for kings //finds moves f kO looks for a space UP and RIGHT and a space DOWN and RIGHT if (gameBg[x, y] == "kO" && gameBg[x - 1, y + 1] == "kX" && (gameBg[x - 2, y + 2] == "\0 ")) { int tempX = x - 1; int tempY = y + 1; dect.CheckerTaken = true; score4.Add(x.ToString() + "," + y.ToString() + "-" + tempX.ToString() + "," + tempY.ToString()); } //finds moves for kO looks for a space UP and LEFT and a space DOWN and LEFT if (gameBg[x, y] == "kO" && gameBg[x - 1, y - 1] == "kX" && gameBg[x - 2, y - 2] == "\0 ") { int tempX = x - 1; int tempY = y - 1; dect.CheckerTaken = true; score4.Add(x.ToString() + "," + y.ToString() + "-" + tempX.ToString() + "," + tempY.ToString()); } //*******************************************************************************************88 if (gameBg[x, y] == "kO" && gameBg[x - 1, y - 1] == "\0 " && gameBg[x - 2, y - 2] == "N ") { int tempX = x - 1; int tempY = y - 1; dect.AnotherMove = false; score1.Add(x.ToString() + "," + y.ToString() + "-" + tempX.ToString() + "," + tempY.ToString()); } //finds moves for O or kO looks looks for a space DOWN and LEFT and a space DOWN and LEFT if (gameBg[x, y] == "kO" && gameBg[x - 1, y - 1] == "\0 " && gameBg[x - 2, y - 2] == "N ") { int tempX = x - 1; int tempY = y - 1; dect.AnotherMove = false; score1.Add(x.ToString() + "," + y.ToString() + "-" + tempX.ToString() + "," + tempY.ToString()); } //finds moves for O or kO looks looks for a space DOWN and RIGHT and a space UP and RIGHT if (gameBg[x, y] == "kO" && gameBg[x - 1, y + 1] == "X " && (gameBg[x - 2, y + 2] == "\0 ")) { int tempX = x - 1; int tempY = y + 1; dect.CheckerTaken = true; score2.Add(x.ToString() + "," + y.ToString() + "-" + tempX.ToString() + "," + tempY.ToString()); } //finds moves for O or kO looks looks for a space DOWN and LEFT and a space DOWN and LEFT if (gameBg[x, y] == "kO" && gameBg[x - 1, y + 1] == "X " && gameBg[x - 2, y + 2] == "\0 ") { int tempX = x - 1; int tempY = y + 1; dect.CheckerTaken = true; score2.Add(x.ToString() + "," + y.ToString() + "-" + tempX.ToString() + "," + tempY.ToString()); } //finds moves for O or kO looks looks for a space DOWN and RIGHT and a space DOWN and RIGHT if (gameBg[x, y] == "kO" && gameBg[x - 1, y - 1] == "kX" && gameBg[x - 2, y - 2] == "\0 ") { int tempX = x - 1; int tempY = y - 1; dect.CheckerTaken = true; score3.Add(x.ToString() + "," + y.ToString() + "-" + tempX.ToString() + "," + tempY.ToString()); } } } }
private void Receive() { byte[] buffer = new byte[1024]; while (true) { try { using (Socket listener = new Socket(localIp.AddressFamily, SocketType.Stream, ProtocolType.Tcp)) { listener.Bind(localEP); listener.Listen(5); using (Socket socket = listener.Accept()) { int count = 0; count = socket.Receive(buffer); message = Encoding.UTF8.GetString(buffer, 0, count); if (message.Contains("/s") && message.Contains("1")) { Player1Start = true; Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate() { CheckStart(); }); } if (message.Contains("/s") && message.Contains("2")) { Player2Start = true; Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate() { CheckStart(); }); } if (message.Contains("/l")) { if (message.Contains(NormArr[next])) { if (Common.IsHost) { Combo2++; Score2 += Combo2 * 2; Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate() { ScoreBox2.Text = Score2.ToString(); ComboBox2.Text = Combo2.ToString(); Margin_Letter = 0; InitPicTimer2(); LetterBox.Text = NormArr[GenerateNext()]; EnemyImg.Margin = new Thickness(0, 0, 0, 350); }); } else { Combo1++; Score1 += Combo1 * 2; Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate() { ScoreBox1.Text = Score1.ToString(); ComboBox1.Text = Combo1.ToString(); Margin_Letter = 0; InitPicTimer1(); LetterBox.Text = NormArr[GenerateNext()]; EnemyImg.Margin = new Thickness(0, 0, 0, 350); }); } } else { if (Common.IsHost) { Combo2 = 0; Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate() { ComboBox2.Text = Combo2.ToString(); }); } else { Combo1 = 0; Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate() { ComboBox1.Text = Combo1.ToString(); }); } } } if (message.Contains("/p")) { Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate() { Margin_Letter = 0; timerMove.Stop(); timerPlay.Stop(); TimeBox.Text = ""; LetterBox.Text = ""; EnemyImg.Visibility = Visibility.Hidden; LetterBox.Visibility = Visibility.Hidden; EnemyImg.Margin = new Thickness(0, 0, 0, 350); Player1Start = false; Player2Start = false; }); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public void ScoreBoard(Player _User1, Player _User2, int Round) { Console.Clear(); if (Round < 13) { TAces = 0; TDeuces = 0; TThrees = 0; TFours = 0; TFives = 0; TSixes = 0; TChoice = 0; TFOAK = 0; TFullHouse = 0; TSStraight = 0; TLStraight = 0; TYacht = 0; if (Dice[0] > 0) { for (int i = 0; i < Dice.Length; i++) { switch (Dice[i]) { case 1: TAces += 1; break; case 2: TDeuces += 2; break; case 3: TThrees += 3; break; case 4: TFours += 4; break; case 5: TFives += 5; break; case 6: TSixes += 6; break; default: break; }//Aces ~ Sixes TChoice += Dice[i];// Choice if (Dice[i] == 2) { for (int j = 0; j < Dice.Length; j++) { if (Dice[j] == 3) { for (int k = 0; k < Dice.Length; k++) { if (Dice[k] == 4) { for (int l = 0; l < Dice.Length; l++) { if (Dice[l] == 5) { for (int m = 0; m < Dice.Length; m++) { if (Dice[m] == 6 || Dice[m] == 1) { TLStraight = 30; TSStraight = 15; } } if (TLStraight != 30) { TSStraight = 15; } } else if (Dice[l] == 1) { TSStraight = 15; } } } } } } }// LStraight, SStraight2345, 3456 if (Dice[i] == 1) { for (int j = 0; j < Dice.Length; j++) { if (Dice[j] == 2) { for (int k = 0; k < Dice.Length; k++) { if (Dice[k] == 3) { for (int l = 0; l < Dice.Length; l++) { if (Dice[l] == 4) { TSStraight = 15; } } } } } } }// SStraight1234 } int YCount = 0; //Dice[0]과 같은 수 count int ENumber = 0; //Dice[0]와 다른 마지막 수 int ECount = 0; //ENumber와 같은 수 count for (int i = 0; i < Dice.Length - 1; i++) { if (Dice[0] == Dice[i + 1]) { YCount++; } else { ENumber = Dice[i + 1]; } } //같은 숫자 카운트 -> YCount if (YCount == 4) { TYacht = 50; } // Yacht if (YCount >= 3) { for (int i = 0; i < Dice.Length; i++) { TFOAK += Dice[i]; } } // 첫번째 주사위를 포함한 FOAK else { if (Dice[1] == Dice[2] && Dice[2] == Dice[3] && Dice[3] == Dice[4]) { for (int i = 0; i < Dice.Length; i++) { TFOAK += Dice[i]; } } } // 첫번째 주사위만 다른 FOAK if (YCount == 2) { for (int i = 0; i < Dice.Length; i++) { if (ENumber == Dice[i]) { ECount++; } } if (ECount == 2) { for (int i = 0; i < Dice.Length; i++) { TFullHouse += Dice[i]; } } } // 첫번째 주사위 수가 3개인 FullHouse else if (YCount == 1) { for (int i = 0; i < Dice.Length; i++) { if (ENumber == Dice[i]) { ECount++; } } if (ECount == 3) { for (int i = 0; i < Dice.Length; i++) { TFullHouse += Dice[i]; } } } // 첫번째 주사위 수가 2개인 FullHouse } // 족보에따른 TScore 계산 } // 라운드 진행 중일때 TScore 초기화 후 족보에 따른 TScore 계산 else { if (_User1.Total > _User2.Total) { WinAsci(); Console.ReadKey(); Console.Clear(); } else if (_User1.Total == _User2.Total) { DrawAsci(); Console.ReadKey(); Console.Clear(); } else { WinAsci(); Console.ReadKey(); Console.Clear(); } } // 12라운드 끝난 후 결과 출력 void TurnWrite() { if (Round < 13) { Console.WriteLine("ㅣ Turn ㅣ ㅣ ㅣ"); } } void RoundWrite() { if (Round < 13) { Console.WriteLine("ㅣ " + Round.ToString("D2") + " / 12 ㅣ ㅣ ㅣ"); } else { Console.WriteLine("ㅣ Result ㅣ ㅣ ㅣ"); } } void NameWrite(string Name1, string Name2) { Console.Write("ㅣ-------------ㅣ"); if (Name1 == Name) { if (Round < 13) { Console.ForegroundColor = ConsoleColor.Red; } } Console.Write(Name1); Console.ForegroundColor = ConsoleColor.White; Console.Write("ㅣ"); if (Name2 == Name) { if (Round < 13) { Console.ForegroundColor = ConsoleColor.Red; } } Console.Write(Name2); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("ㅣ"); }//2인용 보드에 Name줄 출력(본인 턴에 빨간 색 됨) void ScoreWrite(string _Name, int Score1, int TScore1, int PScore1, int Score2, int TScore2, int PScore2) { Console.Write(_Name); if (PScore1 != 1) { Console.ForegroundColor = ConsoleColor.DarkGray; Console.Write(TScore1.ToString("D2")); Console.ForegroundColor = ConsoleColor.White; } else { Console.ForegroundColor = ConsoleColor.Blue; Console.Write(Score1.ToString("D2")); Console.ForegroundColor = ConsoleColor.White; } Console.Write(" ㅣ "); if (PScore2 != 1) { Console.ForegroundColor = ConsoleColor.DarkGray; Console.Write(TScore2.ToString("D2")); Console.ForegroundColor = ConsoleColor.White; } else { Console.ForegroundColor = ConsoleColor.Blue; Console.Write(Score2.ToString("D2")); Console.ForegroundColor = ConsoleColor.White; } Console.WriteLine(" ㅣ"); } //2인용 보드에 Score있는 줄 출력 함수(점수 입력시 색 바뀜) void RenderBoard() { Console.WriteLine(" _______________________________"); TurnWrite(); Console.WriteLine("ㅣ ㅣ ㅣ ㅣ"); RoundWrite(); NameWrite(_User1.Name, _User2.Name); Console.WriteLine("ㅣCategorise ㅣ ㅣ ㅣ"); Console.WriteLine("ㅣ-------------ㅣ------ㅣ------ㅣ"); ScoreWrite("ㅣ1.Aces ㅣ ", _User1.Aces, _User1.TAces, _User1.PAces, _User2.Aces, _User2.TAces, _User2.PAces); ScoreWrite("ㅣ2.Deuces ㅣ ", _User1.Deuces, _User1.TDeuces, _User1.PDeuces, _User2.Deuces, _User2.TDeuces, _User2.PDeuces); ScoreWrite("ㅣ3.Threes ㅣ ", _User1.Threes, _User1.TThrees, _User1.PThrees, _User2.Threes, _User2.TThrees, _User2.PThrees); ScoreWrite("ㅣ4.Fours ㅣ ", _User1.Fours, _User1.TFours, _User1.PFours, _User2.Fours, _User2.TFours, _User2.PFours); ScoreWrite("ㅣ5.Fives ㅣ ", _User1.Fives, _User1.TFives, _User1.PFives, _User2.Fives, _User2.TFives, _User2.PFives); ScoreWrite("ㅣ6.Sixes ㅣ ", _User1.Sixes, _User1.TSixes, _User1.PSixes, _User2.Sixes, _User2.TSixes, _User2.PSixes); Console.WriteLine("ㅣ-------------ㅣ------ㅣ------ㅣ"); Console.WriteLine("ㅣSubtotal ㅣ " + _User1.SubTotal.ToString("D2") + "/63ㅣ " + _User2.SubTotal.ToString("D2") + "/63ㅣ"); Console.WriteLine("ㅣ+35 Bonus ㅣ +" + _User1.Bonus.ToString("D2") + " ㅣ +" + _User2.Bonus.ToString("D2") + " ㅣ"); Console.WriteLine("ㅣ-------------ㅣ------ㅣ------ㅣ"); ScoreWrite("ㅣ7.Choice ㅣ ", _User1.Choice, _User1.TChoice, _User1.PChoice, _User2.Choice, _User2.TChoice, _User2.PChoice); ScoreWrite("ㅣ8.4 of a Kindㅣ ", _User1.FOAK, _User1.TFOAK, _User1.PFOAK, _User2.FOAK, _User2.TFOAK, _User2.PFOAK); ScoreWrite("ㅣ9.Full House ㅣ ", _User1.FullHouse, _User1.TFullHouse, _User1.PFullHouse, _User2.FullHouse, _User2.TFullHouse, _User2.PFullHouse); ScoreWrite("ㅣ0.S. Straightㅣ ", _User1.SStraight, _User1.TSStraight, _User1.PSStraight, _User2.SStraight, _User2.TSStraight, _User2.PSStraight); ScoreWrite("ㅣ-.L. Straightㅣ ", _User1.LStraight, _User1.TLStraight, _User1.PLStraight, _User2.LStraight, _User2.TLStraight, _User2.PLStraight); ScoreWrite("ㅣ=.Yacht ㅣ ", _User1.Yacht, _User1.TYacht, _User1.PYacht, _User2.Yacht, _User2.TYacht, _User2.PYacht); Console.WriteLine("ㅣ-------------ㅣ------ㅣ------ㅣ"); Console.WriteLine("ㅣ ㅣ ㅣ ㅣ"); Console.WriteLine("ㅣTotal ㅣ " + _User1.Total.ToString("D3") + " ㅣ " + _User2.Total.ToString("D3") + " ㅣ"); Console.WriteLine("ㅣ_____________ㅣ______ㅣ______ㅣ"); } //점수판 출력 RenderBoard(); if (Round < 13) { if (RollCount != 0) { switch (Console.ReadKey().Key) { case ConsoleKey.D1: if (PAces == 0) { Aces = TAces; PAces = 1; RollCount = 4; SubTotal = Aces + Deuces + Threes + Fours + Fives + Sixes; if (SubTotal > 62) { Bonus = 35; } Total = Aces + Deuces + Threes + Fours + Fives + Sixes + Choice + FOAK + FullHouse + SStraight + LStraight + Yacht + Bonus; Console.Clear(); RenderBoard(); Console.ReadKey(); } else { Console.Clear(); ScoreBoard(_User1, _User2, Round); } break; case ConsoleKey.D2: if (PDeuces == 0) { Deuces = TDeuces; PDeuces = 1; RollCount = 4; SubTotal = Aces + Deuces + Threes + Fours + Fives + Sixes; if (SubTotal > 62) { Bonus = 35; } Total = Aces + Deuces + Threes + Fours + Fives + Sixes + Choice + FOAK + FullHouse + SStraight + LStraight + Yacht + Bonus; Console.Clear(); RenderBoard(); Console.ReadKey(); } else { Console.Clear(); ScoreBoard(_User1, _User2, Round); } break; case ConsoleKey.D3: if (PThrees == 0) { Threes = TThrees; PThrees = 1; RollCount = 4; SubTotal = Aces + Deuces + Threes + Fours + Fives + Sixes; if (SubTotal > 62) { Bonus = 35; } Total = Aces + Deuces + Threes + Fours + Fives + Sixes + Choice + FOAK + FullHouse + SStraight + LStraight + Yacht + Bonus; Console.Clear(); RenderBoard(); Console.ReadKey(); } else { Console.Clear(); ScoreBoard(_User1, _User2, Round); } break; case ConsoleKey.D4: if (PFours == 0) { Fours = TFours; PFours = 1; RollCount = 4; SubTotal = Aces + Deuces + Threes + Fours + Fives + Sixes; if (SubTotal > 62) { Bonus = 35; } Total = Aces + Deuces + Threes + Fours + Fives + Sixes + Choice + FOAK + FullHouse + SStraight + LStraight + Yacht + Bonus; Console.Clear(); RenderBoard(); Console.ReadKey(); } else { Console.Clear(); ScoreBoard(_User1, _User2, Round); } break; case ConsoleKey.D5: if (PFives == 0) { Fives = TFives; PFives = 1; RollCount = 4; SubTotal = Aces + Deuces + Threes + Fours + Fives + Sixes; if (SubTotal > 62) { Bonus = 35; } Total = Aces + Deuces + Threes + Fours + Fives + Sixes + Choice + FOAK + FullHouse + SStraight + LStraight + Yacht + Bonus; Console.Clear(); RenderBoard(); Console.ReadKey(); } else { Console.Clear(); ScoreBoard(_User1, _User2, Round); } break; case ConsoleKey.D6: if (PSixes == 0) { Sixes = TSixes; PSixes = 1; RollCount = 4; SubTotal = Aces + Deuces + Threes + Fours + Fives + Sixes; if (SubTotal > 62) { Bonus = 35; } Total = Aces + Deuces + Threes + Fours + Fives + Sixes + Choice + FOAK + FullHouse + SStraight + LStraight + Yacht + Bonus; Console.Clear(); RenderBoard(); Console.ReadKey(); } else { Console.Clear(); ScoreBoard(_User1, _User2, Round); } break; case ConsoleKey.D7: if (PChoice == 0) { Choice = TChoice; PChoice = 1; RollCount = 4; SubTotal = Aces + Deuces + Threes + Fours + Fives + Sixes; if (SubTotal > 62) { Bonus = 35; } Total = Aces + Deuces + Threes + Fours + Fives + Sixes + Choice + FOAK + FullHouse + SStraight + LStraight + Yacht + Bonus; Console.Clear(); RenderBoard(); Console.ReadKey(); } else { Console.Clear(); ScoreBoard(_User1, _User2, Round); } break; case ConsoleKey.D8: if (PFOAK == 0) { FOAK = TFOAK; PFOAK = 1; RollCount = 4; SubTotal = Aces + Deuces + Threes + Fours + Fives + Sixes; if (SubTotal > 62) { Bonus = 35; } Total = Aces + Deuces + Threes + Fours + Fives + Sixes + Choice + FOAK + FullHouse + SStraight + LStraight + Yacht + Bonus; Console.Clear(); RenderBoard(); Console.ReadKey(); } else { Console.Clear(); ScoreBoard(_User1, _User2, Round); } break; case ConsoleKey.D9: if (PFullHouse == 0) { FullHouse = TFullHouse; PFullHouse = 1; RollCount = 4; SubTotal = Aces + Deuces + Threes + Fours + Fives + Sixes; if (SubTotal > 62) { Bonus = 35; } Total = Aces + Deuces + Threes + Fours + Fives + Sixes + Choice + FOAK + FullHouse + SStraight + LStraight + Yacht + Bonus; Console.Clear(); RenderBoard(); Console.ReadKey(); } else { Console.Clear(); ScoreBoard(_User1, _User2, Round); } break; case ConsoleKey.D0: if (PSStraight == 0) { SStraight = TSStraight; PSStraight = 1; RollCount = 4; SubTotal = Aces + Deuces + Threes + Fours + Fives + Sixes; if (SubTotal > 62) { Bonus = 35; } Total = Aces + Deuces + Threes + Fours + Fives + Sixes + Choice + FOAK + FullHouse + SStraight + LStraight + Yacht + Bonus; Console.Clear(); RenderBoard(); Console.ReadKey(); } else { Console.Clear(); ScoreBoard(_User1, _User2, Round); } break; case ConsoleKey.OemMinus: if (PLStraight == 0) { LStraight = TLStraight; PLStraight = 1; RollCount = 4; SubTotal = Aces + Deuces + Threes + Fours + Fives + Sixes; if (SubTotal > 62) { Bonus = 35; } Total = Aces + Deuces + Threes + Fours + Fives + Sixes + Choice + FOAK + FullHouse + SStraight + LStraight + Yacht + Bonus; Console.Clear(); RenderBoard(); Console.ReadKey(); } else { Console.Clear(); ScoreBoard(_User1, _User2, Round); } break; case ConsoleKey.OemPlus: if (PYacht == 0) { Yacht = TYacht; PYacht = 1; RollCount = 4; SubTotal = Aces + Deuces + Threes + Fours + Fives + Sixes; if (SubTotal > 62) { Bonus = 35; } Total = Aces + Deuces + Threes + Fours + Fives + Sixes + Choice + FOAK + FullHouse + SStraight + LStraight + Yacht + Bonus; Console.Clear(); RenderBoard(); Console.ReadKey(); } else { Console.Clear(); ScoreBoard(_User1, _User2, Round); } break; default: return; } } // Roll을 한번 이상 했을때 Board창 입력에 따른 행동 else { Console.ReadKey(); Console.Clear(); } // Roll을 한번도 안하고 입력했을때 /*******턴이 넘어가면서 Tscore 초기화(안할 시 턴이 넘어가도 전 플레이어 Tscore 초기화 안됨)********/ TAces = 0; TDeuces = 0; TThrees = 0; TFours = 0; TFives = 0; TSixes = 0; TChoice = 0; TFOAK = 0; TFullHouse = 0; TSStraight = 0; TLStraight = 0; TYacht = 0; } // 라운드 진행 중일때 보드 입력값에 따른 행동 후 Tscore 초기화 else { if (_User1.Total > _User2.Total) { Console.WriteLine("" + _User1.Name + "님이 이겼습니다!"); Console.WriteLine("1. 메인 화면으로"); Console.WriteLine("2. 게임 종료"); switch (Console.ReadKey().Key) { case ConsoleKey.D1: break; case ConsoleKey.D2: Environment.Exit(0); break; } }// User1이 이겼을때 else if (_User1.Total == _User2.Total) { Console.WriteLine("" + _User1.Name + "님과 " + _User2.Name + "님이 비겼습니다!"); Console.WriteLine("1. 메인 화면으로"); Console.WriteLine("2. 게임 종료"); switch (Console.ReadKey().Key) { case ConsoleKey.D1: break; case ConsoleKey.D2: Environment.Exit(0); break; } }// 비겼을때 else { Console.WriteLine("" + _User2.Name + "님이 이겼습니다!"); Console.WriteLine("1. 메인 화면으로"); Console.WriteLine("2. 게임 종료"); switch (Console.ReadKey().Key) { case ConsoleKey.D1: break; case ConsoleKey.D2: Environment.Exit(0); break; } } // User2가 이겼을때 } // 12라운드 끝난 후 누가 이겼는지 출력 후 메뉴OR게임종료 } // 2P플레이 점수판 출력 후 점수 기록 함수
public override int GetHashCode() { return(Score1.GetHashCode() ^ Score2.GetHashCode()); }
public override string ToString() { return(Name + ": " + Score1.ToString() + ", " + Score2.ToString() + ", " + Score3.ToString()); }