Пример #1
0
    void OnGUI()
    {
        if (GUI.Button(new Rect(10, 10, 100, 28), "Start"))
        {
            foreach (PlayerPanel p in pp)
            {
                CardId card = cd.deck.GetTopCard();
                p.AddCard(card, (int)card.suite);
                finalhand.Add(card);
            }

            foreach (PlayerPanel p in pp)
            {
                CardId card = cd.deck.GetTopCard();
                p.AddCard(card, (int)card.suite);
                finalhand.Add(card);
            }

            for (int i = 0; i < table.cardSlots.Length; i++)
            {
                CardId card = cd.deck.GetTopCard();
                table.AddCard(card, 90);
                finalhand.Add(card);
            }


            HandRanker.setHandRanker(finalhand);
        }
    }
Пример #2
0
    public CardConstants.HandRank EvaluatPlayerHand(List <CardId> finalHand)
    {
        HandAnalizer = new HandRanker();
        HandAnalizer.setHandRanker(finalHand);


        if (IsRoyalFlush(finalHand))
        {
            return(CardConstants.HandRank.royalFlush);
        }
        if (IsStarightFlush(finalHand))
        {
            return(CardConstants.HandRank.strightFlush);
        }
        if (HandAnalizer.Rankcount[0] == 4)
        {
            return(CardConstants.HandRank.fourOfAKind);
        }
        if (HandAnalizer.Rankcount[0] == 3 && HandAnalizer.Rankcount[1] == 2)
        {
            return(CardConstants.HandRank.fullHouse);
        }
        if (HandAnalizer.Suits[0] >= 5)
        {
            return(CardConstants.HandRank.flush);
        }
        if (IsStright(finalHand))
        {
            return(CardConstants.HandRank.stright);
        }
        if (HandAnalizer.Rankcount[0] == 3)
        {
            return(CardConstants.HandRank.threeOfaKind);
        }
        if (HandAnalizer.Rankcount[0] == 2 && HandAnalizer.Rankcount[1] == 2)
        {
            return(CardConstants.HandRank.twoPairs);
        }
        if (HandAnalizer.Rankcount[0] == 2)
        {
            return(CardConstants.HandRank.onePair);
        }
        else
        {
            return(CardConstants.HandRank.highCard);
        }
    }//this function  determine hand value after the anlizer work on the player hand