Beispiel #1
0
    public void UpdateButtonColors()
    {
        List <Player> alivePlayers     = mRestaurantScript.getAlivePlayers();
        List <Player> playersWithTurns = mRestaurantScript.getPlayersWithTurnsLeft();

        //Reset all colors.
        for (int i = 0; i < mPlayerNamecards.Count; ++i)
        {
            Button b = mPlayerNamecards[i];
            if (b.enabled)
            {
                b.image.color = mPlayerNamecards[i].colors.normalColor;
            }
            else
            {
                b.image.color = mPlayerNamecards[i].colors.disabledColor;
            }
        }

        for (int i = 0; i < mPlayerNamecards.Count; ++i)
        {
            //If the player is out of turns, disable their button
            Button b = mPlayerNamecards[i];

            //will turn selected player yellow and all others as active color
            if (mRestaurantScript.mSelectedPlayer != null)
            {
                if (alivePlayers [i] == mRestaurantScript.mSelectedPlayer)
                {
                    mPlayerNamecards [i].image.color = Color.yellow;
                }
                else
                {
                    b.image.color = mPlayerNamecards [i].colors.normalColor;
                }
            }
            //will turn all players their correct color
            else
            {
                if (playersWithTurns.Contains(alivePlayers [i]))
                {
                    b.image.color = mPlayerNamecards [i].colors.normalColor;
                }
                else
                {
                    b.image.color = mPlayerNamecards [i].colors.disabledColor;
                }
            }
        }
    }
Beispiel #2
0
    public void UpdateButtonColors()
    {
        //List<Player> outOfTurnPlayers = mRestaurantScript.getOutOfTurnPlayers();
        List <Player> alivePlayers     = mRestaurantScript.getAlivePlayers();
        List <Player> playersWithTurns = mRestaurantScript.getPlayersWithTurnsLeft();

        //Reset all colors.
        for (int i = 0; i < mPlayerNamecards.Count; ++i)
        {
            Button b = mPlayerNamecards[i];
            if (b.enabled)
            {
                b.image.color = mPlayerNamecards[i].colors.normalColor;
            }
            else
            {
                b.image.color = mPlayerNamecards[i].colors.disabledColor;
            }
        }

        //Debug.Log("CLEAR SELECT");

        //for (int i = 0; i < mPlayerNamecards.Count; ++i)
        //{
        //    //If the player is selected then make them gold.
        //    if (mRestaurantScript.mSelectedPlayer != null && alivePlayers[i] == mRestaurantScript.mSelectedPlayer)
        //    {
        //        mPlayerNamecards[i].image.color = Color.yellow;
        //    }
        //
        //    //This is what it should be in the future instead of restaurant holding everything
        //    //if (alivePlayers[i].isTurn())
        //    //{
        //        //set golden
        //    //}
        //
        //    //if (alivePlayers[i].outOfTurns())
        //    //{
        //        //Set disabled
        //    //}
        //}

        for (int i = 0; i < mPlayerNamecards.Count; ++i)
        {
            //If the player is out of turns, disable their button
            Button b = mPlayerNamecards[i];

            //will turn selected player yellow and all others as active color
            if (mRestaurantScript.mSelectedPlayer != null)
            {
                if (alivePlayers [i] == mRestaurantScript.mSelectedPlayer)
                {
                    mPlayerNamecards [i].image.color = Color.yellow;
                }
                else
                {
                    b.image.color = mPlayerNamecards [i].colors.normalColor;
                }
            }
            //will turn all players their correct color
            else
            {
                if (playersWithTurns.Contains(alivePlayers [i]))
                {
                    b.image.color = mPlayerNamecards [i].colors.normalColor;
                }
                else
                {
                    b.image.color = mPlayerNamecards [i].colors.disabledColor;
                }
            }
        }

        //Debug.Log("YELLOW SELECT");
    }