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); }
private void GeneratePlaySet(ref List <BigTwoPoker> currentSet, List <BigTwoPoker> currentHand, BigTwoDeck deck) { if (deck.IsFirstPlay() || deck.IsRoundPassed()) { GetBestInHand(ref currentSet, currentHand, deck); return; } List <BigTwoPoker> lastSet = deck.GetLastValidPlayPokerList(); if (0 == lastSet.Count) { return; } GetBiggerSet(ref currentSet, currentHand, lastSet, deck); }