Пример #1
0
 protected override void OnMouseDown(MouseEventArgs e)
 {
     base.OnMouseDown(e);
     StartCell   = CellAt(e.X, e.Y);
     ActivePiece = StartCell.Piece;
     if (ActivePiece?.Player != ActivePlayer)
     {
         ActivePiece = null;
     }
     Invalidate();
 }
Пример #2
0
 public TPiece PieceAtCell(TCell cell)
 {
     foreach (var piece in Pieces)
     {
         if (piece.Cell == cell)
         {
             return(piece);
         }
     }
     return(null);
 }
Пример #3
0
 public TBoard()
 {
     InitializeComponent();
     for (int y = 0; y < N; y++)
     {
         for (int x = 0; x < N; x++)
         {
             var cell = new TCell();
             cell.Board  = this;
             cell.X      = x;
             cell.Y      = y;
             Cells[y, x] = cell;
         }
     }
     Reset();
 }