private void gameOver() { if (m_GameLogic.GameOver) { r_UIEngine.DisplayGameOver(m_GameLogic.DataGameOver.Value); } else { int score = m_GameLogic.PlayerEnemy.Score - m_GameLogic.PlayerTurn.Score; m_GameLogic.PlayerEnemy.Score += score; DataGameOver dataGameOver = new DataGameOver(m_GameLogic.PlayerEnemy.Name, m_GameLogic.PlayerTurn.Name, score, false, true); r_UIEngine.DisplayGameOver(dataGameOver); } bool playersWantsToPlayAgain = r_UIEngine.IsPlayersWantsToPlayerAgain(m_GameLogic.PlayerTurn, m_GameLogic.PlayerEnemy); if (playersWantsToPlayAgain) { if (m_PlayerQuit) { m_GameLogic.ChangeTurn(); } startNewGame(); } }
public void DisplayGameOver(DataGameOver i_DataGameOver) { StringBuilder displayMassage = new StringBuilder("Game Over!").AppendLine().Append("Result: "); if (i_DataGameOver.Draw) { displayMassage.AppendLine("Draw (Non of the players have possible moves)"); } else { if (i_DataGameOver.Quit) { displayMassage.AppendFormat("{0} quit, ", i_DataGameOver.LoserName); } displayMassage.AppendFormat( "{0} is the winner with score {1}", i_DataGameOver.WinnerName, i_DataGameOver.WinnerScore); } Console.WriteLine(displayMassage); Console.WriteLine("Press any key to continue..."); Console.ReadKey(); }
private void showMessageBoxGameOver(DataGameOver i_DataGameOver) { StringBuilder messageBoxText = new StringBuilder(); if (i_DataGameOver.Draw) { messageBoxText.AppendLine("Tie!"); } else { messageBoxText.AppendFormat("{0} Won!", i_DataGameOver.WinnerName).AppendLine(); } messageBoxText.Append("Another Round?"); DialogResult dialogResult = MessageBox.Show( messageBoxText.ToString(), "Damka", MessageBoxButtons.YesNo, MessageBoxIcon.Question); playAgain(dialogResult); }
public GameStatusEventArgs(DataGameOver i_DataGameOver) { r_Data = i_DataGameOver; }