예제 #1
0
        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);
        }
예제 #2
0
 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);
 }
예제 #3
0
 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);
 }