Exemplo n.º 1
0
        private object Game_Promote(Move move)
        {
            PromotionForm frm = new PromotionForm();

            frm.ShowDialog();

            switch (frm.piece)
            {
            case "Queen":
                return(((int)move.MovedPiece % 2 == 0) ? Promotion.BQUEEN : Promotion.WQUEEN);

            case "Bishop":
                return(((int)move.MovedPiece % 2 == 0) ? Promotion.BBISHOP : Promotion.WBISHOP);

            case "Rook":
                return(((int)move.MovedPiece % 2 == 0) ? Promotion.BROOK : Promotion.WROOK);

            case "Knight":
                return(((int)move.MovedPiece % 2 == 0) ? Promotion.BKNIGHT : Promotion.WKNIGHT);

            case "default":
                return(((int)move.MovedPiece % 2 == 0) ? Promotion.BQUEEN : Promotion.WQUEEN);
            }
            return(((int)move.MovedPiece % 2 == 0) ? Promotion.BBISHOP : Promotion.WBISHOP);
        }
Exemplo n.º 2
0
        private object Game_Promote(Move move)
        {
            PromotionForm promotion = new PromotionForm();

            DialogResult d = promotion.ShowDialog();

            if (promotion.getSelection() == 1)
            {
                return(((int)move.MovedPiece % 2 == 0) ? Promotion.BQUEEN : Promotion.WQUEEN);
            }
            else if (promotion.getSelection() == 2)
            {
                return(((int)move.MovedPiece % 2 == 0) ? Promotion.BROOK : Promotion.WROOK);
            }
            else if (promotion.getSelection() == 3)
            {
                return(((int)move.MovedPiece % 2 == 0) ? Promotion.BBISHOP : Promotion.WBISHOP);
            }
            else if (promotion.getSelection() == 4)
            {
                return(((int)move.MovedPiece % 2 == 0) ? Promotion.BKNIGHT : Promotion.WKNIGHT);
            }
            else
            {
                return(-1);
            }
        }