public string GetPokerSuitRes(int cardId)
    {
        string        result   = StringDefine.Instance.PokerResDir;
        PokerCardSuit cardSuit = GetCardSuit(cardId);
        string        suitStr  = "";

        switch (cardSuit)
        {
        case PokerCardSuit.SPADE:
            suitStr = "spade";
            break;

        case PokerCardSuit.HEART:
            suitStr = "heart";
            break;

        case PokerCardSuit.DIAMEND:
            suitStr = "diamend";
            break;

        case PokerCardSuit.CLUB:
            suitStr = "club";
            break;

        //Notice that joker card do not need suit image
        case PokerCardSuit.JOKER:
            result = "";
            break;
        }

        result += suitStr;
        return(result);
    }
Beispiel #2
0
        private bool IsFlush()
        {
            bool          flush     = true;
            PokerCardSuit flushSuit = PokerCardList[0].Suit;

            //If any suits do not match, not a flush
            for (int i = 1; i < PokerCardList.Count; i++)
            {
                if (PokerCardList[i].Suit != flushSuit)
                {
                    flush = false;
                }
            }

            return(flush);
        }
    public string GetPokerKeyRes(int cardId, PokerScaleType scaleType)
    {
        string        result   = StringDefine.Instance.PokerResDir;
        int           cardKey  = GetCardKey(cardId);
        PokerCardSuit cardSuit = GetCardSuit(cardId);

        if (cardSuit == PokerCardSuit.JOKER)
        {
            string jokerStr = cardKey == 0 ? "black_joker_" : "red_joker_";
            string scaleStr = "";
            switch (scaleType)
            {
            case PokerScaleType.TINY:
                scaleStr = "tiny";
                break;

            case PokerScaleType.MIDDLE:
                scaleStr = "middle";
                break;

            case PokerScaleType.BIG:
                scaleStr = "big";
                break;
            }

            result += jokerStr + scaleStr;
        }
        //spade and club show black number image, heart and diamend show red image
        else
        {
            //A-K refers 0-12 in logic, but refers 1-13 in image res
            if (cardSuit == PokerCardSuit.HEART || cardSuit == PokerCardSuit.DIAMEND)
            {
                result += "r" + (cardKey + 1);
            }
            else
            {
                result += cardKey + 1;
            }
        }

        return(result);
    }
    /*only use this value to compare two cards order priority
     * redJoker must be the biggest, 3 is smallest
     * ->RedJoker,BlackJoker,2,A,K-2<-
     * same key should be ordered as club, diamend, heart,spade
     */

    private float GetCardOrderValue(int cardId)
    {
        /*
         * redJoker-3 Refers 16-2;
         */
        float         result;
        int           originalKey = GetCardKey(cardId);
        int           key         = originalKey <= 1 ? originalKey + 13 : originalKey;
        PokerCardSuit suit        = GetCardSuit(cardId);

        if (suit == PokerCardSuit.JOKER)
        {
            result = 15 + key + (int)suit * 0.1f;
        }
        else
        {
            result = key + (int)suit * 0.1f;
        }

        return(result);
    }
Beispiel #5
0
 public PokerCard(PokerCardSuit suit, PokerCardRank rank)
 {
     this.rank = rank;
     this.suit = suit;
 }