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)); } }
public void MoveTo(int moveNo) { Notations.MoveTo(moveNo); Book.MoveTo(moveNo); SetCapturedPiecesParameters(); CapturedPieces.MoveTo(moveNo); }
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(); }
public void MoveTo(MoveToE moveTo) { Move m = null; switch (moveTo) { case MoveToE.First: m = Moves.First; //Notations.MoveTo(moveTo); break; case MoveToE.Last: m = Moves.Last; break; case MoveToE.Next: m = Moves.Next(CurrentMove); //Notations.MoveTo(moveTo); break; case MoveToE.Previous: m = Moves.Prev(CurrentMove); //Notations.MoveTo(moveTo); break; case MoveToE.Up: break; case MoveToE.Down: break; default: break; } if (m == null && moveTo == MoveToE.Previous) { return; } if (m == null) { Book.MoveTo(moveTo, true); return; } if (CurrentMove.Id == m.Id) { Book.MoveTo(moveTo, true); } else { CurrentMove = m.Clone(); Flags.IsMoveInProgress = true; Flags.IsClickedByUser = true; Clock.Stop(); Clock.SetClock(CurrentMove); Flags.IsRetracMove = false; Flags.IsMoveInProgress = false; Notations.Set(); Book.MoveTo(moveTo, false); SetCapturedPiecesParameters(); CapturedPieces.MoveTo(moveTo); SetFen(CurrentMove.Fen); } }