Exemple #1
0
        private void ReplaceBoard(SaveData _data)
        {
            BlackPlayer.Reset();
            WhitePlayer.Reset();
            Pawns.Clear();
            int number = 0;

            foreach (var color in _data.Pawns)
            {
                if (color == PawnColor.Black)
                {
                    Pawns.Add(new Pawn(BlackPlayer, number));
                }
                else if (color == PawnColor.White)
                {
                    Pawns.Add(new Pawn(WhitePlayer, number));
                }
                else
                {
                    Pawns.Add(new Pawn(null, number));
                }
                number++;
            }
            BlackPlayer.Time = _data.BlackTime;
            WhitePlayer.Time = _data.WhiteTime;
            CurrentPlayer    = WhitePlayer;
            if (_data.CurrentPlayer == PawnColor.Black)
            {
                CurrentPlayer = BlackPlayer;
            }
            GetLegalMove(CurrentPlayer);
            UpdateScore();
        }
Exemple #2
0
 public void NewGame()
 {
     PlayerPassName = null;
     BlackPlayer.Reset();
     WhitePlayer.Reset();
     Reset(BlackPlayer, WhitePlayer);
     CurrentPlayer = BlackPlayer;
     GetLegalMove(CurrentPlayer);
     UpdateScore();
     IsCreated = true;
     StartGame();
 }