Esempio n. 1
0
        public static string ConvertPokerCardToString(PokerCard card)
        {
            string suit = "";
            string rank = "";

            switch (card.GetSuit())
            {
            case Puppet.ECardSuit.Bitch:
                suit = "c";
                break;

            case Puppet.ECardSuit.Diamond:
                suit = "d";
                break;

            case Puppet.ECardSuit.Heart:
                suit = "h";
                break;

            case Puppet.ECardSuit.Spade:
                suit = "s";
                break;
            }
            switch (card.GetRank())
            {
            case Puppet.ECardRank.King:
                rank = "K";
                break;

            case Puppet.ECardRank.Queen:
                rank = "Q";
                break;

            case Puppet.ECardRank.Ace:
                rank = "A";
                break;

            case Puppet.ECardRank.Jack:
                rank = "J";
                break;

            default:
                rank = ((int)card.GetRank()).ToString();
                break;
            }
            return(rank + suit);
        }
Esempio n. 2
0
 public static string ConvertPokerCardToString(PokerCard card) {
     string suit = "";
     string rank = "";
     switch (card.GetSuit()) { 
         case Puppet.ECardSuit.Bitch :
             suit = "c";
             break;
         case Puppet.ECardSuit.Diamond :
             suit = "d";
             break;
         case Puppet.ECardSuit.Heart :
             suit = "h";
             break;
         case Puppet.ECardSuit.Spade :
             suit = "s";
             break;
     }
     switch (card.GetRank()) {
         case Puppet.ECardRank.King:
             rank = "K";
             break;
         case Puppet.ECardRank.Queen:
             rank = "Q";
             break;
         case Puppet.ECardRank.Ace:
             rank = "A";
             break;
         case Puppet.ECardRank.Jack:
             rank = "J";
             break;
         default :
             rank = ((int)card.GetRank()).ToString();
             break;
     }
     return rank + suit;
 }
Esempio n. 3
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;
            }
        }
    }