Beispiel #1
0
 static void chess_StatusChanged(object sender, GameStatusEventArgs e)
 {
     if (e.GameStatus != GameStatus.Normal && e.GameStatus != GameStatus.WhiteIsCheck && e.GameStatus != GameStatus.BlackIsCheck)
     Console.WriteLine(e.GameStatus);
 }
Beispiel #2
0
        private void HandleStateChangedEvent(object sender, GameStatusEventArgs e)
        {
            string message = "";
              m_messagesGraphic.Clear(Color.White);

              switch (e.GameStatus)
              {
            case GameStatus.WhiteCheckmateVictory:
              message = Resources.WHITE_WIN + "\n" + Resources.BLACK_MATE;
              break;

            case GameStatus.BlackCheckmateVictory:
              message = Resources.BLACK_WIN + "\n" + Resources.WHITE_MATE;
              break;

            case GameStatus.WhiteTimeVictory:
              message = Resources.WHITE_WIN + "\n" + Resources.BLACK_TIME;
              break;

            case GameStatus.BlackTimeVictory:
              message = Resources.BLACK_WIN + "\n" + Resources.WHITE_TIME;
              break;

            case GameStatus.StalemateDraw:
              message = Resources.DRAW + "\n" + Resources.STALEMATE;
              break;

            case GameStatus.InsufficientPiecesDraw:
              message = Resources.DRAW + "\n" + Resources.INSUFFICIENT_PIECES;
              break;

            case GameStatus.MoveRepetitionDraw:
              message = Resources.DRAW + "\n" + Resources.MOVE_REPETITION;
              break;

            case GameStatus.FiftyMovesDraw:
              message = Resources.DRAW + "\n" + Resources.FIFTY_MOVE_RULE;
              break;

            case GameStatus.WhiteIsCheck:
              message = Resources.CHECK + "\n" + Resources.WHITE_CHECK;
              break;

            case GameStatus.BlackIsCheck:
              message = Resources.CHECK + "\n" + Resources.BLACK_CHECK;
              break;
              }

              m_messagesGraphic.DrawString(message, m_panelFont, m_blackBrush, 5, 5);
              pictureStateMessages.Refresh();
        }