예제 #1
0
파일: FourGame.cs 프로젝트: Dr1N/FourGame
 private void Game_StateChanged(object sender, StateChangeEventArg e)
 {
     stbCurrent.Text = String.Format("Current Color: {0}", e.CurrentColor);
     stbMoves.Text   = String.Format("Moves: {0}", e.Moves);
     if (!String.IsNullOrEmpty(e.Winner))
     {
         Text = Text + " [ Winner: " + e.Winner + " ]";
         MessageBox.Show(String.Format("Winner: {0}", e.Winner), Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #2
0
파일: GameBoard.cs 프로젝트: Dr1N/FourGame
        /// <summary>
        /// Raise state change event
        /// </summary>
        private void RaiseStateChanged()
        {
            if (StateChanged == null || isAnimate == true)
            {
                return;
            }

            StateChangeEventArg arg = new StateChangeEventArg()
            {
                CurrentColor = currentColor.Name,
                Moves        = GetMovesCount(),
            };

            if (isWon == true)
            {
                arg.Winner = (currentColor == firstColor ? secondColor.Name : firstColor.Name);
            }
            else
            {
                arg.Winner = String.Empty;
            }

            StateChanged(this, arg);
        }