Ejemplo n.º 1
0
    private void ButtonControl()
    {
        // Exit to menu has highest priority:
        if (userInterface.GetMenuPressed())
        {
            userInterface.ResetMenuButton();
            ExitGame();
        }
        // If it is the AI´s turn, disable the playbuttons,
        // otherwise enable the appropriate buttons for the player:
        if (Parameters.AIPlaying)
        {
            userInterface.buttons.DisableRoll();
            userInterface.buttons.DisableBank();
        }
        else
        {
            if (diceController.CanRoll())
            {
                userInterface.buttons.EnableRoll();
            }
            else
            {
                userInterface.buttons.DisableRoll();
            }

            if (diceController.CanBank(playerScore[currentPlayer]))
            {
                userInterface.buttons.EnableBank();
            }
            else
            {
                userInterface.buttons.DisableBank();
            }
        }
    }