示例#1
0
        /**
         * update method for the scoremanager
         * determines what button was pressed and returns that information to the
         */
        public ChessPieceType.ClickCommand Update(Vector2 location)
        {
            if (turnColor == ChessPieceType.Color.White)
            {
                turnText.Text = "White's turn";
            }
            else
            {
                turnText.Text = "Black's turn";
            }
            blackScoreText.Text = "Black's Score: " + blackScore;
            whiteScoreText.Text = "Whites's Score: " + whiteScore;

            ChessPieceType.ClickCommand retVal = ChessPieceType.ClickCommand.NoClick;
            if (!clickDisabled)
            {
                retVal = ButtonPressed(location);
            }
            if (retVal != ChessPieceType.ClickCommand.NoClick)
            {
                clickDisabled = true;
            }
            if (clickDisabled)
            {
                clickBuffer++;
                if (clickBuffer > 2)
                {
                    clickBuffer   = 0;
                    clickDisabled = false;
                }
            }

            return(retVal);
        }
示例#2
0
 /**
  * method that handles clicks on the sidebar of the display
  */
 private bool ClickedOnSideBar(Tuple <bool, Vector2> click)
 {
     ChessPieceType.ClickCommand press = scoreManager.Update(click.Item2);
     if (press == ChessPieceType.ClickCommand.FlipBoard)
     {
         FlipBoard();
     }
     return(false);
 }
示例#3
0
        private ChessPieceType.ClickCommand ButtonPressed(Vector2 loc)
        {
            int button = buttonList[(int)loc.X - 8][(int)loc.Y];

            ChessPieceType.ClickCommand retVal = ChessPieceType.ClickCommand.NoClick;
            switch (button)
            {
            case 0:
                break;

            case 1:
                break;

            case 2:
                break;

            case 3:
                break;

            case 4:
                break;

            case 5:
                break;

            case 6:
                retVal = ChessPieceType.ClickCommand.FlipBoard;
                break;

            case 7:
                retVal = ChessPieceType.ClickCommand.FlipBoard;
                break;

            case 8:
                retVal = ChessPieceType.ClickCommand.PreviousBoard;
                break;

            case 9:
                retVal = ChessPieceType.ClickCommand.NextBoard;
                break;

            case 10:
                break;

            case 11:
                break;

            case 12:
                break;

            case 13:
                break;

            case 14:
                break;

            case 15:
                break;

            case 16:
                break;

            default:
                break;
            }
            return(retVal);
        }