コード例 #1
0
        public void UpdateGameState(object sender, GameEventArgs eventArgs)
        {
            switch (eventArgs.State)
            {
            case GameState.WhiteTurn:
                moveHistory.AddText(false, _game.PastMoves.Peek().ToString());
                _game.IncrementTurn();
                break;

            case GameState.BlackTurn:
                moveHistory.AddText(true, _game.TurnCounter + ".  " + _game.PastMoves.Peek().ToString());
                break;

            case GameState.WhiteInCheck:
                moveHistory.AddText(false, _game.PastMoves.Peek().ToString() + "+");
                _game.IncrementTurn();
                break;

            case GameState.BlackInCheck:
                moveHistory.AddText(true, _game.TurnCounter + ".  " + _game.PastMoves.Peek().ToString() + "+");
                break;

            case GameState.WhiteMated:
                moveHistory.AddText(false, _game.PastMoves.Peek().ToString() + "#");
                moveHistory.AddText(true, "    0-1");
                break;

            case GameState.BlackMated:
                moveHistory.AddText(true, _game.TurnCounter + ".  " + _game.PastMoves.Peek().ToString() + "#");
                moveHistory.AddText(false, "1-0");
                break;

            case GameState.WhiteStalemate:
                moveHistory.AddText(false, "0.5-0.5");
                break;

            case GameState.BlackStalemate:
                moveHistory.AddText(true, "    0.5-0.5");
                break;
            }

            UpdateBoardUI();
        }