예제 #1
0
 private static string GetPieceCode(PieceView Piece)
 {
     if (Piece is Pawn)
     {
         return("");
     }
     else if (Piece is Queen)
     {
         return("Q");
     }
     else if (Piece is Bishop)
     {
         return("B");
     }
     else if (Piece is Knight)
     {
         return("N");
     }
     else if (Piece is Rook)
     {
         return("R");
     }
     else if (Piece is King)
     {
         return("K");
     }
     else
     {
         throw new InvalidOperationException("Invalid Piece type: " + Piece.GetType().Name);
     }
 }
예제 #2
0
        public void DrawPiece(PieceView piece)
        {
            var image = UIImage.FromFile(string.Format("figures/{0}-{1}.png", piece.Color.ToString().ToLowerInvariant(), piece.GetType().Name.ToLowerInvariant()));

            piece.Image = image;
            piece.Frame = new RectangleF(GetX(piece.X), GetY(piece.Y), CellWidth, CellWidth);
            piece.CurrentFrame = piece.Frame;
            Add(piece);
        }
예제 #3
0
        public void DrawPiece(PieceView piece)
        {
            var image = UIImage.FromFile(string.Format("figures/{0}-{1}.png", piece.Color.ToString().ToLowerInvariant(), piece.GetType().Name.ToLowerInvariant()));

            piece.Image        = image;
            piece.Frame        = new RectangleF(GetX(piece.X), GetY(piece.Y), CellWidth, CellWidth);
            piece.CurrentFrame = piece.Frame;
            Add(piece);
        }
예제 #4
0
 private static string GetPieceCode(PieceView Piece)
 {
     if (Piece is Pawn)
         return "";
     else if (Piece is Queen)
         return "Q";
     else if (Piece is Bishop)
         return "B";
     else if (Piece is Knight)
         return "N";
     else if (Piece is Rook)
         return "R";
     else if (Piece is King)
         return "K";
     else
         throw new InvalidOperationException("Invalid Piece type: " + Piece.GetType().Name);
 }