public void OnClickPlayHand()
    {
        List <BigTwoPoker> listPoker = new List <BigTwoPoker> ();

        for (int i = 0; i < _listPokerInHand.Count; i++)
        {
            BigTwoPoker poker = _listPokerInHand [i];
            if (poker.IsSelected)
            {
                listPoker.Add(poker);
            }
        }
        if (0 == listPoker.Count && (_deck.IsFirstPlay() || _deck.IsRoundPassed()))
        {
            TipNotValid();
            return;
        }
        if (!_deck.IsFirstPlay() && !_deck.IsRoundPassed())
        {
            List <BigTwoPoker> lastSet = _deck.GetLastValidPlayPokerList();
            if (lastSet.Count > 0)
            {
                BigTwoRule.CompareResult result = _deck.Rule.IsPokerListBigger(listPoker, lastSet);
                if (result != BigTwoRule.CompareResult.BIGGER)
                {
                    TipNotValid();
                    return;
                }
            }
        }
        string cmd = _deck.CombinePokerListToCMD(listPoker);

        _roundBtns.SetActive(false);
        SendPlayHandCMD(cmd);
    }
示例#2
0
    public override string GetPlayCommand(List <BigTwoPoker> currentHand, BigTwoDeck deck)
    {
        List <BigTwoPoker> currentSet = new List <BigTwoPoker> ();

        GeneratePlaySet(ref currentSet, currentHand, deck);
        string cmd = deck.CombinePokerListToCMD(currentSet);

        return(cmd);
    }