Exemplo n.º 1
0
    // 檢查當前牌型可以用哪些牌型
    private void CheckCardTypeBtnEnable(List <Card> deck)
    {
        if (Judgment.CheckAllPlayerPass())
        {
            // 如果是你的自由出牌機會,則不給pass
            UIManger.btn_PassRank.interactable = false;

            if (CardTypeCheckMgr.FindPair(deck).Count != 0)
            {
                UIManger.btn_findpair.interactable = true;
            }

            if (CardTypeCheckMgr.FindThreeOfKinds(deck).Count != 0)
            {
                UIManger.btn_findthree.interactable = true;
            }

            if (CardTypeCheckMgr.FindStraight(deck).Count != 0)
            {
                UIManger.btn_findStraight.interactable = true;
            }

            if (CardTypeCheckMgr.FindFullHouse(deck).Count != 0)
            {
                UIManger.btn_findFullHouse.interactable = true;
            }

            if (CardTypeCheckMgr.FindFourOfKinds(deck).Count != 0)
            {
                UIManger.btn_findFour.interactable = true;
            }

            if (CardTypeCheckMgr.FindStraightFlush(deck).Count != 0)
            {
                UIManger.btn_findStraightFlush.interactable = true;
            }
        }
        else
        {
            UIManger.btn_PassRank.interactable = true;

            // 獲得最後一手牌
            var LastCardsOfTable = Judgment.GetLastTableCards();

            // 檢查最後一手牌的牌型
            var type = Judgment.CheckCardType(LastCardsOfTable);

            switch (type)
            {
            case CardsType.Pair:
                if (CardTypeCheckMgr.FindPair(deck).Count != 0)
                {
                    UIManger.btn_findpair.interactable = true;
                }
                break;

            case CardsType.ThreeOfKinds:
                if (CardTypeCheckMgr.FindThreeOfKinds(deck).Count != 0)
                {
                    UIManger.btn_findthree.interactable = true;
                }
                break;

            case CardsType.Straight:
                if (CardTypeCheckMgr.FindStraight(deck).Count != 0)
                {
                    UIManger.btn_findStraight.interactable = true;
                }
                break;

            case CardsType.FullHouse:
                if (CardTypeCheckMgr.FindFullHouse(deck).Count != 0)
                {
                    UIManger.btn_findFullHouse.interactable = true;
                }
                break;
            }

            if (CardTypeCheckMgr.FindFourOfKinds(deck).Count != 0)
            {
                UIManger.btn_findFour.interactable = true;
            }

            if (CardTypeCheckMgr.FindStraightFlush(deck).Count != 0)
            {
                UIManger.btn_findStraightFlush.interactable = true;
            }
        }
    }