Ejemplo n.º 1
0
    public void UpdateUI()
    {
        //spriteBackground.spriteName = card.cardId < 0 ? BACKGROUND[0] : BACKGROUND[1];
        spriteBackground.spriteName = BACKGROUND[0];
        int rank = (int)card.GetRank();
        int suit = (int)card.GetSuit();

        NGUITools.SetActive(spriteIcon.gameObject, card.cardId >= 0);
        NGUITools.SetActive(spriteRank.gameObject, rank > 0);
        NGUITools.SetActive(spriteSuit.gameObject, suit >= 0);

        if (rank > 0)
        {
            spriteRank.spriteName = RANK_IMAGE[rank - 1];
        }

        if (suit >= 0)
        {
            spriteSuit.spriteName = SUIT_IMAGE[suit];
        }

        if (rank > 0 && rank < 11)
        {
            spriteIcon.spriteName = spriteSuit.spriteName;
            //spriteIcon.MakePixelPerfect();
            spriteIcon.width  = 42;
            spriteIcon.height = 48;
            OnShowFaceCard(2);
        }
        else if (rank >= 11)
        {
            spriteIcon.spriteName = ICON_IMAGE[rank - 11];
            //spriteIcon.MakePixelPerfect();
            spriteIcon.width  = 51;
            spriteIcon.height = 59;
            OnShowFaceCard(2);
        }

        if (card.cardId >= 0)
        {
            spriteSuit.color = spriteRank.color = card.IsRedCard() ? Color.red : Color.black;
            if (rank < 11)
            {
                spriteIcon.color = spriteSuit.color;
            }
        }
    }