private void Menu_HighScore2P() { //Game selects the winner as the pleyer with highest score //In case of tie chooses the winner by remaing pacman lives if (Score < Score2 || (Score == Score2 && Lives <= 0)) { GameOverLabel.Text = "GHOSTS WIN"; GameOverLabel.ForeColor = Color.Red; GameOverLabel.Location = new Point(36, 33); HighScoreLabel.Text = "2UP"; HighScoreLabel.ForeColor = Color.Red; HighScoreNum.Text = Score2.ToString(); HighScoreNum.ForeColor = Color.Red; ScoreLabel.Text = "1UP"; ScoreNum.Text = Score.ToString(); } else { GameOverLabel.Text = "PACMAN WINS"; GameOverLabel.ForeColor = Color.Yellow; GameOverLabel.Location = new Point(34, 33); HighScoreLabel.Text = "1UP"; HighScoreNum.Text = Score.ToString(); ScoreLabel.Text = "2UP"; ScoreNum.Text = Score2.ToString(); } }
private void bcgWorker_DoWork(object sender, DoWorkEventArgs e) { try { sb = new StringBuilder(); sb.Clear(); var selectedCellCount = dtgridView.GetCellCount(DataGridViewElementStates.Selected); if (selectedCellCount > 2) { if (dtgridView.AreAllCellsSelected(true)) { MessageBox.Show("Select some cells, but not all of them!", "Selected Cells"); } else { for (int i = selectedCellCount - 1; i >= 0; --i) { var a = dtgridView.SelectedCells[i].RowIndex; var b = dtgridView.SelectedCells[i].ColumnIndex; sb.Append(dtgridView.Rows[a].Cells[b].Value); } if (objFiles.ReadFromFile()) { if (objFiles.AddToFile(sb.ToString())) { sb.Clear(); throw new ArgumentException("This word is alredy used!"); } objFiles.AddScore(player); } } } else { MessageBox.Show("You should select char's more than 2!"); } dtGrVwSymb.Enabled = true; radTxtBxScorePl1.Text = Score1.ToString(); radTxtBxScorePl2.Text = Score2.ToString(); if (player) { MessageBox.Show("Player1 playes now!"); player = false; } else { MessageBox.Show("Player2 playes now!"); player = true; } } catch (ArgumentException ex) { MessageBox.Show(ex.Message); } catch { MessageBox.Show("Fatal error!", "Check the word"); } }
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(); }
public void AddScore(string Name, string DevID) { Player tempPlayer = new Player(Name, DevID); //for (int i = 0; i < AllPlayers.Count; i++) { if (Name == AllPlayers [0].Name) { Score1++; Score1Text.text = "" + Score1; PubNubComm.Instance.AddScoreCallback(Name, DevID, Score1.ToString()); } if (Name == AllPlayers [1].Name) { Score2++; Score2Text.text = "" + Score2; PubNubComm.Instance.AddScoreCallback(Name, DevID, Score2.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(); } } }
/// <summary> /// Function that loads score labels and pacman lives. /// </summary> /// <param name="hp">Number of lives to be displayed.</param> private void LoadHud(int hp) { const int heartSizeInPx = 32; int lives = 0; up1 = new Label(); PlaceLabel(up1, "1UP", Color.White, new Point(3 * TileSizeInPxs, 0), new Font("Arial", 13, FontStyle.Bold)); PlaceLabel(ScoreBox, Score > 0 ? Score.ToString() : "00", Color.White, new Point(4 * TileSizeInPxs, 20), new Font("Arial", 13, FontStyle.Bold)); //Selects labels depeding on game mode if (!Player2) { PlaceLabel(HighScoreBox, HighScore > 0 ? HighScore.ToString() : "00", Color.White, new Point(14 * TileSizeInPxs, 20), new Font("Arial", 13, FontStyle.Bold)); PlaceLabel(new Label(), "HIGH SCORE", Color.White, new Point(10 * TileSizeInPxs, 0), new Font("Arial", 13, FontStyle.Bold)); } else { up2 = new Label(); PlaceLabel(up2, "2UP", Color.White, new Point(22 * TileSizeInPxs, 0), new Font("Arial", 13, FontStyle.Bold)); PlaceLabel(Score2Box, Score2 > 0 ? Score2.ToString() : "00", Color.White, new Point(23 * TileSizeInPxs, 20), new Font("Arial", 13, FontStyle.Bold)); } // Places all lives on their supposed place. foreach (var item in PacLives) { item.Image = Image.FromFile("../textures/Life.png"); item.Location = new Point(lives * heartSizeInPx + TileSizeInPxs, ((FieldSizeInRows + 3) * TileSizeInPxs) + 4); item.Size = new Size(heartSizeInPx, heartSizeInPx); this.Controls.Add(item); lives++; } // Sets visibility of lives depending on number of player's lives. for (int i = MaxLives - 1; i > hp && i >= 0; i--) { PacLives[i].Visible = false; } }
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); }
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); } } }
private void Timer_Tick(object sender, EventArgs e) { for (int i = 0; i < balls.Count; i++) { int j; Ball b = balls[i]; for (int k = i + 1; k < balls.Count; k++) { Ball a = balls[k]; b.Collide(a); } j = b.Move(P1, P2); //Checks to see if any ball has collided if (j == 1) //Score a point for player 2 { Score2 += 1; lblScore2.Text = Score2.ToString(); if (Score2 >= 11) { //player 2 wins game Timer.Stop(); MessageBox.Show("Player 2 Wins!"); Wins2 += 1; lblWins2.Text = "Wins:" + Wins2.ToString(); Score1 = 0; lblScore1.Text = Score1.ToString(); Score2 = 0; lblScore2.Text = Score2.ToString(); btnStart.Enabled = true; } ResetAll(); } else if (j == 2) //Score a point for player 1 { Score1 += 1; lblScore1.Text = Score1.ToString(); if (Score1 >= 11) { //player 1 wins game Timer.Stop(); MessageBox.Show("Player 1 Wins!"); Wins1 += 1; lblWins1.Text = "Wins:" + Wins1.ToString(); Score1 = 0; lblScore1.Text = Score1.ToString(); Score2 = 0; lblScore2.Text = Score2.ToString(); btnStart.Enabled = true; } ResetAll(); } } //moving on keydown, stopping on key up if (W == true) { P1.Move(1); } if (S == true) { P1.Move(-1); } if (I == true) { P2.Move(1); } if (K == true) { P2.Move(-1); } pbGame.Invalidate(); }
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 string ToString() { return(Name + ": " + Score1.ToString() + ", " + Score2.ToString() + ", " + Score3.ToString()); }
// Update is called once per frame void Update() { s1.text = Score1.ToString(); s2.text = Score2.ToString(); }