示例#1
0
        public static Bitmap GetBitmap(int piece)
        {
            Chess.Base.Color color = Colors.Get(piece);
            Piece            type  = Pieces.Get(piece);

            if (color == Chess.Base.Color.White)
            {
                switch (type)
                {
                case Piece.Bishop:
                    return(WhiteBishop);

                case Piece.King:
                    return(WhiteKing);

                case Piece.Knight:
                    return(WhiteKnight);

                case Piece.Pawn:
                    return(WhitePawn);

                case Piece.Queen:
                    return(WhiteQueen);

                case Piece.Rook:
                    return(WhiteRook);
                }
            }
            if (color == Chess.Base.Color.Black)
            {
                switch (type)
                {
                case Piece.Bishop:
                    return(BlackBishop);

                case Piece.King:
                    return(BlackKing);

                case Piece.Knight:
                    return(BlackKnight);

                case Piece.Pawn:
                    return(BlackPawn);

                case Piece.Queen:
                    return(BlackQueen);

                case Piece.Rook:
                    return(BlackRook);
                }
            }

            return(null);
        }