牌型的定义在http://blog.csdn.net/csdn_cjt/article/details/78593140 第一章 这是第四章
下面是代码
#region 提示出牌
public static Dictionary<int, List<int>> FindPromptCards(List<int> myCards,
List<int> lastCards, DDZ_POKER_TYPE lastCardType) {
Dictionary<int, List<int>> PromptCards = new Dictionary<int, List<int>>();
Hashtable tempMyCardHash = SortCardUseHash1(myCards);
// 上一首牌的个数
int prevSize = lastCards.Count;
int mySize = myCards.Count;
// 我先出牌,上家没有牌
if (prevSize == 0 && mySize != 0)
{
//把所有牌权重存入返回
Debug.Log("上家没有牌");
List<int> myCardsHashKey = new List<int>();
foreach (int key in tempMyCardHash.Keys)
{
myCardsHashKey.Add(key);
}
myCardsHashKey.Sort();
for (int i = 0; i < myCardsHashKey.Count; i++) {
List<int> tempIntList = new List<int>();
tempIntList.Add(myCardsHashKey[i]);
PromptCards.Add(i, tempIntList);
}
}
// 集中判断是否王炸,免得多次判断王炸
if (lastCardType == DDZ_POKER_TYPE.KingBomb)
{
Debug.Log("上家王炸,肯定不能出。");
}
int prevGrade = 0;
if (prevSize > 0) {
prevGrade = lastCards[0];
Debug.Log("prevGrade" + prevGrade);
}
// 比较2家的牌,主要有2种情况,1.我出和上家一种类型的牌,即对子管对子;
// 2.我出炸弹,此时,和上家的牌的类型可能不同
// 王炸的情况已经排除
// 上家出单
if (lastCardType == DDZ_POKER_TYPE.Single)
{
int tempCount = 0;
List<int> myCardsHashKey = new List<int>();
foreach (int key in tempMyCardHash.Keys)
{
myCardsHashKey.Add(key);
}
myCardsHashKey.Sort();
for (int i = 0; i < myCardsHashKey.Count; i++)
{
if (myCardsHashKey[i] > prevGrade){
List<int> tempIntList = new List<int>();
tempIntList.Add(myCardsHashKey[i]);
PromptCards.Add(tempCount, tempIntList);
tempCount++;
}
}
}
// 上家出对子
else if (lastCardType == DDZ_POKER_TYPE.Twin)
{
int tempCount = 0;
List<int> myCardsHashKey = new List<int>();
foreach (int key in tempMyCardHash.Keys)
{
myCardsHashKey.Add(key);
}
myCardsHashKey.Sort();
for (int i = 0; i < myCardsHashKey.Count; i++)
{
if (myCardsHashKey[i] > prevGrade&& (int)tempMyCardHash[myCardsHashKey[i]]>=2)
{
List<int> tempIntList = new List<int>();
tempIntList.Add(myCardsHashKey[i]);
tempIntList.Add(myCardsHashKey[i]);
PromptCards.Add(tempCount, tempIntList);
tempCount++;
}
}
}
// 上家出3不带
else if (lastCardType == DDZ_POKER_TYPE.Triple)
{
int tempCount = 0;
List<int> myCardsHashKey =