Пример #1
0
        /**
         * method that handles clicks on the board
         */
        private bool ClickedOnBoard(Tuple <bool, Vector2> click, IChessPiece[][] hypoBoard)
        {
            bool    executeVal = false;
            Vector2 clickLoc   = DecideVect(click.Item2);

            if (!currentPiece.Equals(currentBoard[(int)clickLoc.X][(int)clickLoc.Y]) &&
                turnColor == currentBoard[(int)clickLoc.X][(int)clickLoc.Y].Color)
            {
                drawManager.HighLightPiece(click.Item2);
                currentPiece   = currentBoard[(int)clickLoc.X][(int)clickLoc.Y];
                currentLoc     = clickLoc;
                currentCommand = commandDict[currentPiece.Type];
                clickedOnce    = true;
            }
            else if (clickedOnce == true && turnColor != currentBoard[(int)clickLoc.X][(int)clickLoc.Y].Color)
            {
                executeVal = currentCommand.Execute(hypoBoard, clickLoc, currentLoc);
            }
            return(executeVal);
        }