public BaseChess Clone() { Type theType = this.GetType(); BaseChess theChess = (BaseChess)Activator.CreateInstance(theType); theChess.Type = this.Type; theChess.GridX = this.GridX; theChess.GridY = this.GridY; theChess.PreviousGridX = this.PreviousGridX; theChess.PreviousGridY = this.PreviousGridY; theChess.Text = this.Text; theChess.InitChess(); return(theChess); }
public static BaseChess getChessOnPoint(Panel parent, int gridX, int gridY) { foreach (Control curItem in parent.Controls) { if (curItem is BaseChess) { BaseChess ci = (BaseChess)curItem; if (ci.GridX == gridX && ci.GridY == gridY) { return(ci); } } } return(null); }
public bool hasChessOnPoint(int gridX, int gridY) { if (this.Parent is Panel) { foreach (Control curItem in this.Parent.Controls) { if (curItem is BaseChess) { BaseChess ci = (BaseChess)curItem; if (ci.GridX == gridX && ci.GridY == gridY) { return(true); } } } } return(false); }