public GameSession(int id, string name, Player player, ChessDotNet.Player side, string gamePassword = null)
        {
            if (string.IsNullOrWhiteSpace(name) | player == null)
            {
                throw new ArgumentNullException();
            }

            Description = new GameDescription()
            {
                Id       = id,
                Name     = name,
                Password = gamePassword
            };
            if (side == ChessDotNet.Player.Black)
            {
                Description.BlackPlayer = player;
            }
            else
            {
                Description.WhitePlayer = player;
            }
            State          = new Waiting(this);
            Turn           = new WhiteTurn(this);
            ChessLogicCore = new ChessDotNet.ChessGame();
        }
Пример #2
0
 private void NotifyPlayersAboutEndGame(GameDescription gameDesc)
 {
     try
     {
         gameDesc.WhitePlayer.Callback.GameUpdated(gameDesc);
     }
     catch (Exception) { }
     try
     {
         gameDesc.BlackPlayer.Callback.GameUpdated(gameDesc);
     }
     catch (Exception) { }
 }