Guest User

Untitled

a guest
Jan 18th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1.         private void PanelOnMouseDown(object sender, MouseEventArgs e)
  2.         {
  3.             if (_game.Board.SelectedPiece == null)
  4.             {
  5.                 ChessPiece piece = _game.Board.GetPiece(e.Location, _ratio);
  6.                 if (piece != null)
  7.                 {
  8.                     _game.Board.SelectedPiece = piece;
  9.                 }
  10.             }
  11.             else
  12.             {
  13.                 Point p = _game.Board.GetGridLocation(e.Location, _ratio);
  14.                 if (p != Point.Empty)
  15.                 {
  16.                     _game.MovePiece(_game.Board.SelectedPiece, p);
  17.                 }
  18.             }
  19.         }
Add Comment
Please, Sign In to add comment