Exemple #1
0
 protected virtual void OnGameOverOccured(GameOverEventArgs e)
 {
     if (GameOver != null)
     {
         GameOver.Invoke(this, e);
     }
 }
Exemple #2
0
        // Game over Occurd
        private void m_CheckersLogic_GameOverOccured(object sender, GameOverEventArgs e)
        {
            string message;
            if (e.Tie)
            {
                message = string.Format(
@"It's a Tie!
First Player : {0} scored {1} points!
Second Player : {2} scored {3} points!
Another Round?",
               e.StrongerPlayer.Name,
               e.StrongerPlayer.Score,
               e.WeakerPlayer.Name,
               e.WeakerPlayer.Score);
            }
            else
            {
                message = string.Format(
                @"{0} is the Winner !
{1} scored {2} points!
{3} scored {4} points!
Another Round?",
               e.StrongerPlayer.Name,
               e.StrongerPlayer.Name,
               e.StrongerPlayer.Score,
               e.WeakerPlayer.Name,
               e.WeakerPlayer.Score);
            }

            // updating new score
            if (e.StrongerPlayer.PlayerTag == Checkers.ePlayerTag.First)
            {
                this.labelPlayer1Score.Text = e.StrongerPlayer.Score.ToString();
                this.labelPlayer2Score.Text = e.WeakerPlayer.Score.ToString();
            }
            else
            {
                this.labelPlayer1Score.Text = e.WeakerPlayer.Score.ToString();
                this.labelPlayer2Score.Text = e.StrongerPlayer.Score.ToString();
            }

            // ask to keep playing or exit
            DialogResult result = MessageBox.Show(message, this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (result == DialogResult.Yes)
            {
                this.r_CheckersLogic.ResetGame();
            }
            else
            {
                Application.Exit();
            }
        }
Exemple #3
0
 protected virtual void OnGameOverOccured(GameOverEventArgs e)
 {
     if (GameOver != null)
     {
         GameOver.Invoke(this, e);
     }
 }