Ejemplo n.º 1
0
    private bool moveLeft(bool aPlayerOne = true)
    {
        if (mGrid == null || mGrid.getColumnCount() == 1)
        {
            return(false);
        }

        bool foundIndex = false;

        if (aPlayerOne || mInputType == TYPE_ONE_PLAYER)
        {
            while (!foundIndex)
            {
                if (mIndexPlayer1 != 0)
                {
                    mIndexPlayer1 -= 1;
                }
                else
                {
                    mIndexPlayer1 = mGrid.getButtonCount() - 1;
                }

                if (!mGrid.getButton(mIndexPlayer1).isHidden())
                {
                    foundIndex = true;
                }
            }

            updateIndicator();
        }
        else
        {
            while (!foundIndex)
            {
                if (mIndexPlayer2 != 0)
                {
                    mIndexPlayer2 -= 1;
                }
                else
                {
                    mIndexPlayer2 = mGrid.getButtonCount() - 1;
                }

                if (!mGrid.getButton(mIndexPlayer2).isHidden())
                {
                    foundIndex = true;
                }
            }

            updateIndicator(false);
        }

        return(true);
    }