// 找出一组牌中某种花色的对子 public static List <TLJCommon.PokerInfo> choiceDoublePoker(List <TLJCommon.PokerInfo> myPokerList, TLJCommon.Consts.PokerType pokerType) { // 优先使用热更新的代码 if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("GameUtil_hotfix", "choiceDoublePoker")) { List <TLJCommon.PokerInfo> list = (List <TLJCommon.PokerInfo>)ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.GameUtil_hotfix", "choiceDoublePoker", null, myPokerList, pokerType); return(list); } // 先筛选出同花色的牌 List <TLJCommon.PokerInfo> pokerList = new List <TLJCommon.PokerInfo>(); for (int i = myPokerList.Count - 1; i >= 0; i--) { if (myPokerList[i].m_pokerType == pokerType) { pokerList.Add(myPokerList[i]); } } List <TLJCommon.PokerInfo> singleList = new List <TLJCommon.PokerInfo>(); List <TLJCommon.PokerInfo> doubleList = new List <TLJCommon.PokerInfo>(); if (pokerList.Count > 1) { for (int i = pokerList.Count - 1; i >= 1; i--) { if (pokerList[i].m_num == pokerList[i - 1].m_num) { doubleList.Add(pokerList[i]); --i; if (i == 1) { singleList.Add(pokerList[i - 1]); } } else { singleList.Add(pokerList[i]); if (i == 1) { singleList.Add(pokerList[i - 1]); } } } } else if (pokerList.Count == 1) { singleList.Add(pokerList[0]); } return(doubleList); }
// 找出一组牌中某种花色的对子 public static List <TLJCommon.PokerInfo> choiceDoublePoker(List <TLJCommon.PokerInfo> myPokerList, TLJCommon.Consts.PokerType pokerType) { // 先筛选出同花色的牌 List <TLJCommon.PokerInfo> pokerList = new List <TLJCommon.PokerInfo>(); for (int i = myPokerList.Count - 1; i >= 0; i--) { if (myPokerList[i].m_pokerType == pokerType) { pokerList.Add(myPokerList[i]); } } List <TLJCommon.PokerInfo> singleList = new List <TLJCommon.PokerInfo>(); List <TLJCommon.PokerInfo> doubleList = new List <TLJCommon.PokerInfo>(); if (pokerList.Count > 1) { for (int i = pokerList.Count - 1; i >= 1; i--) { if (pokerList[i].m_num == pokerList[i - 1].m_num) { doubleList.Add(pokerList[i]); --i; if (i == 1) { singleList.Add(pokerList[i - 1]); } } else { singleList.Add(pokerList[i]); if (i == 1) { singleList.Add(pokerList[i - 1]); } } } } else if (pokerList.Count == 1) { singleList.Add(pokerList[0]); } return(doubleList); }