示例#1
0
        public void MoveTo(Move m)
        {
            if (m == null)
            {
                return;
            }

            if (m.Id == CurrentMove.Id)
            {
                return;
            }

            if (BeforeMoveTo != null)
            {
                BeforeMoveTo(this, new MoveToEventArgs(m));
            }

            Flags.IsRetracMove = false;

            CurrentMove = m.Clone();

            Clock.MoveTo(CurrentMove);
            Notations.MoveTo(CurrentMove);
            Book.MoveTo(CurrentMove);
            CapturedPieces.MoveTo(CurrentMove);

            SetFen(CurrentMove.Fen);
            SwapPlayersIfNeeded();

            if (AfterMoveTo != null)
            {
                AfterMoveTo(this, new MoveToEventArgs(CurrentMove));
            }
        }
示例#2
0
 public void MoveTo(int moveNo)
 {
     Notations.MoveTo(moveNo);
     Book.MoveTo(moveNo);
     SetCapturedPiecesParameters();
     CapturedPieces.MoveTo(moveNo);
 }
示例#3
0
        public void MoveTo(MoveToE moveTo, bool moveFromBook)
        {
            Move m = null;

            if ((Flags.IsFirstMoveSelected || Flags.IsRootMoveSelected) && (moveTo == MoveToE.Previous || moveTo == MoveToE.First))
            {
                if (Flags.IsRootMoveSelected)
                {
                    return;
                }

                SetInitialPosition();
                return;
            }

            if (moveFromBook && moveTo == MoveToE.Next)
            {
                Book.MoveTo(moveTo, true);
                return;
            }

            if (Flags.IsFirtMove && moveTo == MoveToE.Next)
            {
                return;
            }

            switch (moveTo)
            {
            case MoveToE.First:
                m = Moves.First;
                break;

            case MoveToE.Last:
                m = Moves.Last;
                break;

            case MoveToE.Next:
                m = GetNextMove(CurrentMove);
                break;

            case MoveToE.Previous:
                m = Moves.Prev(CurrentMove);
                break;

            case MoveToE.Up:
                break;

            case MoveToE.Down:
                break;

            default:
                break;
            }


            Flags.IsRetracMove = false;

            CurrentMove = m.Clone();

            Clock.MoveTo(moveTo);
            Notations.MoveTo(moveTo);
            Book.MoveTo(moveTo, false);
            CapturedPieces.MoveTo(moveTo);

            SetFen(CurrentMove.Fen);
            SwapPlayersIfNeeded();
        }