Inheritance: ScoringRules
 public void ShouldCreateOnConstruction()
 {
     var rules = new PokerRules();
     rules.Deck.ShouldNotBeNull();
     rules.Deck.Count.ShouldBe(52);
     rules.Deck.Game.ShouldBeOfType<PokerGame>();
 }
Beispiel #2
0
    /// <summary>
    /// 出牌判断
    /// </summary>
    /// <returns></returns>
    public bool IFOutPoker()
    {
        if (PokerManage.waitPoker == null)
        {
            return(false);
        }
        //表示当前是空等待,可以添加牌组(电脑牌组跳过)
        if (PokerManage.waitPoker.Count == 0)
        {
            //从手牌中确定是否有扑克选中
            for (int i = 0; i < pokerList.Count; i++)
            {
                if (pokerList[i].isSelect)
                {
                    //选中添加至等待扑克
                    PokerManage.waitPoker.Add(pokerList[i]);
                    pokerList[i].isSelect = false;
                }
            }
        }

        //等待扑克为空跳出,无选中
        if (PokerManage.waitPoker.Count <= 0)
        {
            return(false);
        }

        //返回扑克最大值
        int value = 0;

        //判断是否符合出牌规则
        if (PokerRules.IsOutPokerRule(PokerManage.waitPoker, ref value))
        {
            //判断数目是否相同,或者扑克值比较大,怀疑是炸弹
            if (PokerManage.waitPoker.Count == PokerManage.lastPoker.Count || value >= 100)
            {
                //判断值是否比上一次牌值大
                if (value > PokerManage.maxPokerValue)
                {
                    OutPoker(value);
                    return(true);
                }
            }
            //不相同判断是否为第一次出牌
            else if (PokerManage.maxPokerValue == -1)
            {
                OutPoker(value);
                return(true);
            }
        }
        //当不符合出牌规则时清空等待扑克组
        PokerManage.waitPoker.Clear();
        //重新显示扑克
        ShowPoker();
        return(false);
    }
        public void ShouldPassComparerCallsToItsComparer()
        {
            IEnumerable<ICard> hand1 = null;
            IEnumerable<ICard> hand2 = null;
            var mock = Mock<IComparer<IEnumerable<ICard>>>();
            mock.Stub(c => c.Compare(null, null)).Return(0);

            var rules = new PokerRules(new PokerGame(), mock);
            rules.Compare(hand1, hand2);

            mock.AssertWasCalled(c => c.Compare(null, null));
        }
Beispiel #4
0
    /// <summary>
    /// 验证玩家准备出的牌
    /// </summary>
    /// <param name="toPlayCards"></param>
    /// <returns></returns>
    public bool CheckToCards()
    {
        //获取当前手牌的大小
        List <int> myList = new List <int>();

        for (int i = 0; i < players[playerIndex % 3].myCardInfo.Count; i++)
        {
            if (players[playerIndex % 3].myCardInfo[i].isSelected)
            {
                myList.Add(players[playerIndex % 3].myCardInfo[i].cardIndex);
            }
        }

        //获取上个玩家手牌的大小
        List <int> last = new List <int>();

        if (lastCards.Count != 0)
        {
            for (int i = 0; i < lastCards.Count; i++)
            {
                last.Add(lastCards[i].cardIndex);
            }
        }
        //要排序
        myList.Sort();
        last.Sort();

        //不符合重新出
        if (!PokerRules.PopEnable(myList, out players[playerIndex % 3].myType))
        {
            Debug.Log("出的牌不符合规则");
            return(false);
        }
        //合法的话,如果不是第一次出,判断是不是比上家的牌大
        if (lastCards.Count != 0)
        {
            if (!PokerRules.isSelectCardCanPut(myList, players[playerIndex % 3].myType, last, lastType))
            {
                //比上家小,不出
                if (playerIndex % 3 != 0)
                {
                    NotPlayCards();
                }
                Debug.Log("出的牌比上家小或者牌型不对");
                return(false);
            }
        }
        return(true);
    }
        public void ShouldDealFivesCardsToEachPlayer()
        {
            var p1 = new Player();
            var p2 = new Player();
            var p3 = new Player();
            var p4 = new Player();
            var rules = new PokerRules();

            rules.Deal(p1, p2, p3, p4);

            p1.Hand.ShouldNotBeNull();
            p2.Hand.ShouldNotBeNull();
            p3.Hand.ShouldNotBeNull();
            p4.Hand.ShouldNotBeNull();

            rules.Deck.Count.ShouldBe(32);
        }
 /// <summary>"提示"按钮事件
 /// </summary>
 public void ClickBtnTripPokerEnvet()
 {
     if (PokerRules.SelectPoker(player[curPlayer].pokerList, PokerManage.maxPokerValue, PokerManage.lastPoker))
     {
         if (PokerManage.waitPoker.Count == 0)
         {
         }
         for (int i = 0; i < PokerManage.waitPoker.Count; i++)
         {
             PokerManage.waitPoker[i].ChangeSelect();
         }
         PokerManage.waitPoker.Clear();
     }
     else
     {
         ClickBtnPassPokerEvent();
     }
 }
 public void ShouldCreateAnEmptyDiscardPileOnConstruction()
 {
     var rules = new PokerRules();
     rules.DiscardDeck.ShouldNotBeNull();
     rules.DiscardDeck.Count.ShouldBe(0);
 }
Beispiel #8
0
        /// <summary>
        /// Validate the current hand
        /// </summary>
        private void ValidateHand()
        {
            if (HasFlush)
            {
                //Can be Flush, Straight Flush o Royal Flush
                if (HasStraight)
                {
                    if (this.CardValueString == "TJQKA")
                    {
                        this.Hand = PokerRules.Royal_Flush;
                    }
                    else
                    {
                        this.Hand = PokerRules.Straight_Flush;
                    }
                }
                else
                {
                    this.Hand = PokerRules.Flush;
                }
            }
            else
            {
                Dictionary <Card, int> countCards = new Dictionary <Card, int>();
                foreach (Card c in Cards)
                {
                    if (!ContainsCardValue(countCards, c))
                    {
                        countCards.Add(c, 1);
                    }
                    else
                    {
                        AddCount(countCards, c);
                    }
                }
                try { PokerCard = countCards.Where <KeyValuePair <Card, int> >(X => X.Value == 4).FirstOrDefault().Key.Value; }
                catch (Exception) { PokerCard = CardValue.Joker; }

                try { Tertia = countCards.Where <KeyValuePair <Card, int> >(X => X.Value == 3).FirstOrDefault().Key.Value; }
                catch (Exception) { Tertia = CardValue.Joker; }
                Pairs = countCards.Where <KeyValuePair <Card, int> >(X => X.Value == 2).Select <KeyValuePair <Card, int>, Card>(X => X.Key).ToArray();

                if (PokerCard != CardValue.Joker)
                {
                    this.Hand = PokerRules.Poker;
                }
                else if (Tertia != CardValue.Joker && Pairs.Length == 1)
                {
                    this.Hand      = PokerRules.Full_House;
                    this.FullHouse = new CardValue[] { Tertia, Pairs[0].Value };
                }
                else if (Tertia != CardValue.Joker && Pairs.Length == 0)
                {
                    this.Hand = PokerRules.Three_of_a_Kind;
                }
                else if (Pairs.Length == 1)
                {
                    this.Hand = PokerRules.One_Pair;
                }
                else if (Pairs.Length == 2)
                {
                    this.Hand = PokerRules.Two_Pairs;
                }
                else
                {
                    if (HasStraight)
                    {
                        this.Hand = PokerRules.Straight;
                    }
                    else
                    {
                        this.Hand = PokerRules.High_Card;
                    }
                }
            }
        }
Beispiel #9
0
    /// <summary>
    /// AI出牌
    /// </summary>
    /// <returns></returns>
    public bool AIPlayCards()
    {
        BasePlayer c = players[playerIndex % 3];
        //获取当前手牌的大小
        List <int> myList = new List <int>();

        for (int i = 0; i < c.myCardInfo.Count; i++)
        {
            myList.Add(c.myCardInfo[i].cardIndex);
        }

        //获取上个玩家手牌的大小
        List <int> last = new List <int>();

        if (lastCards.Count != 0)
        {
            for (int i = 0; i < lastCards.Count; i++)
            {
                last.Add(lastCards[i].cardIndex);
            }
        }

        //要排序
        myList.Sort();
        last.Sort();

        //所有符合该牌型的组合,存到字典中
        Dictionary <int, List <int> > result = PokerAI.FindPromptCards(myList, last, lastType);

        //是否能出牌
        if (result == null || result.Count == 0)
        {
            //Debug.Log("字典为空");
            //没有比上家大的牌,不出
            NotPlayCards();
            return(false);
        }

        //所有的key
        List <int> keys = new List <int>();
        //某一个key的值
        List <int> value = new List <int>();

        //循环取到所有的key
        foreach (var item in result.Keys)
        {
            keys.Add(item);
        }

        //随机选择众多结果中的一个结果出 = =
        int vauleCount = MyUtil.GetRange(0, keys.Count);

        value = result[keys[vauleCount]];

        //如上家出333, 那么value为444,有三个4,所以在当前手牌中需要取3个4
        for (int i = 0; i < value.Count; i++)
        {
            for (int j = 0; j < c.myCardInfo.Count; j++)
            {
                if (value[i] == c.myCardInfo[j].cardIndex && c.myCardInfo[j].isSelected == false)
                {
                    c.myCardInfo[j].isSelected = true;
                    break;
                }
            }
        }

        //能出牌,获取出牌牌型
        PokerRules.PopEnable(value, out c.myType);
        lastType = c.myType;

        return(true);
    }
Beispiel #10
0
    /// <summary>
    /// 确定能够出牌
    /// </summary>
    public void CanPlayCards()
    {
        //清除桌面上的牌
        if (tableCards.Count != 0)
        {
            for (int i = 0; i < tableCards.Count; i++)
            {
                pokerTable.MoveCard(tableCards[i], new Vector3(0, 0, 0), 0.01f);
            }
        }

        tableCards.Clear();

        List <int> list = new List <int>();

        list.Clear();
        //将要出的牌添加到桌面List中并排序
        for (int i = 0; i < players[playerIndex % 3].myCardInfo.Count; i++)
        {
            if (players[playerIndex % 3].myCardInfo[i].isSelected)
            {
                tableCards.Add(players[playerIndex % 3].myCardInfo[i]);
                list.Add(players[playerIndex % 3].myCardInfo[i].cardIndex);
            }
        }

        //tableCards = SortCards(tableCards);

        //保存上个玩家出的牌的信息
        lastCards.Clear();

        PokerRules.PopEnable(list, out players[playerIndex % 3].myType);
        lastType = players[playerIndex % 3].myType;

        for (int i = 0; i < tableCards.Count; i++)
        {
            lastCards.Add(tableCards[i]);
        }

        //移动要出的牌到指定的位置,并清除myCards中出去的牌
        GameObject table = pokerTable.table;
        Vector3    pos   = table.transform.position + new Vector3(-tableCards.Count * 0.48f, 0, 0);

        for (int i = 0; i < tableCards.Count; i++)
        {
            tableCards[i].parent = table.transform;
            pokerTable.SetCardParent(tableCards[i]);
            pokerTable.InitImage(tableCards[i], false);
            pokerTable.MoveCard(tableCards[i], pos += new Vector3(0.78f, 0, 0), 0.5f);
            players[playerIndex % 3].myCardInfo.Remove(tableCards[i]);
        }

        //判断是否获胜
        if (players[playerIndex % 3].myCardInfo.Count == 0)
        {
            UnitTool.ToolStartCoroutine(Win(players[playerIndex % 3]));
            return;
        }

        //是玩家出牌
        if (playerIndex % 3 == 0)
        {
            //对当前手牌进行重新显示
            pokerTable.ShowCards(players[0].myCardInfo);
        }

        //当前玩家轮回结束
        players[playerIndex % 3].myTerm = true;

        //开始下一个玩家的出牌
        StartPlay();
    }
    void Update()
    {
        if (Input.GetMouseButtonDown(1))
        {
            ClickBtnOutPokerEvent();
        }
        switch (state)
        {
        case GameState.Empty:
            break;

        case GameState.GameStart:
            //游戏开始发牌(协程动画)
            StartCoroutine(DealPoker());
            //开启发牌协程后为空等待
            state = GameState.Empty;
            break;

        ///抢地主阶段
        case GameState.GrabLandLord:
            timeCanvas.GetComponent <Canvas>().enabled = true;
            ShowTime.text = (int)(waitTime - time + 1) + "";
            //当前(上一把)没有人是赢家
            if (curPlayer == -1)
            {
                //随机玩家
                //curPlayer = Random.Range(0, player.Length);
                curPlayer = 0;
            }
            timeCanvas.SetParent(player[curPlayer].transform.Find("Time"));
            time += Time.deltaTime;
            //电脑随机选择抢不抢地主
            if (player[curPlayer].playerType != PlayerType.player)
            {
                if (time >= 1)
                {
                    //有几率选择抢地主
                    if (Random.Range(0, 3) < 1.5f)
                    {
                        ClickBtnIsGrabEvent();
                    }
                    else
                    {
                        ClickBtnNoGrabEvent();
                    }
                    time = 0;
                }
            }
            else
            {
                //玩家抢地主按钮控制
                View_GrabLandLord.SetActive(true);
            }
            //超过等待时间自动不抢
            if (time >= waitTime)
            {
                ClickBtnNoGrabEvent();
            }
            break;

        ///出牌阶段
        case GameState.OutPoker:
            timeCanvas.SetParent(player[curPlayer].transform.Find("Time"));
            //如果当前玩家是最大
            if (maxPlayerIndex == curPlayer)
            {
                //牌值为空,为准备下一次随意出牌
                PokerManage.maxPokerValue = -1;
                //牌型为空,为准备下一次随意出牌
                PokerRules.SelectPokerAct = null;
                //上次轮最大牌为空
                PokerManage.lastPoker.Clear();
                ShowTime.text = "oo";
            }
            else
            {
                ShowTime.text = (int)(waitTime - time + 1) + "";
            }

            time += Time.deltaTime;
            //如果玩家是电脑
            if (player[curPlayer].playerType != PlayerType.player)
            {
                //等待时间
                if (time > 0.5f)
                {
                    //如果是同一家不出牌
                    if (player[maxPlayerIndex].roleType == player[curPlayer].roleType && curPlayer != maxPlayerIndex)
                    {
                        ClickBtnPassPokerEvent();
                    }
                    //电脑找牌
                    else if (PokerRules.SelectPoker(player[curPlayer].pokerList, PokerManage.maxPokerValue, PokerManage.lastPoker))
                    {
                        ClickBtnOutPokerEvent();
                    }
                    else
                    {
                        ClickBtnPassPokerEvent();
                    }
                    time = 0;
                }
            }
            else
            {
                //玩家准备出牌,显示出牌按钮
                View_OutAndPassPoker.SetActive(true);
            }
            //等待时间自动过牌 并且 当前最大没有时间限制
            if (time >= waitTime && maxPlayerIndex != curPlayer)
            {
                //等待时间内未出牌时,过牌
                ClickBtnPassPokerEvent();
            }
            break;

        case GameState.GameOver:
            GameOver();
            break;

        default:
            break;
        }
    }
    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;

        int prevGrade = 0;

        if (prevSize > 0)
        {
            prevGrade = lastCards[0];
            //Debug.Log("prevGrade" + prevGrade);
        }

        // 我先出牌,上家没有牌
        if (prevSize == 0 && mySize != 0)
        {
            if (MyUtil.GetRange(0, 2) == 0 && mySize > 1)
            {
                lastCards.Add(0);
                lastCards.Add(0);
                prevSize = 2;

                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++;
                    }
                }
                if (PromptCards.Count == 0)
                {
                    lastCards.Clear();
                    prevSize = 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);
                    }
                }
            }
            else
            {
                //把所有牌权重存入返回
                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.KING_BOMB)
        {
            Debug.Log("上家王炸,肯定不能出。");
        }

        // 比较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 = 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]] >= 3)
                {
                    List <int> tempIntList = new List <int>();
                    tempIntList.Add(myCardsHashKey[i]);
                    tempIntList.Add(myCardsHashKey[i]);
                    tempIntList.Add(myCardsHashKey[i]);
                    PromptCards.Add(tempCount, tempIntList);
                    tempCount++;
                }
            }
        }
        // 上家出3带1
        else if (lastCardType == DDZ_POKER_TYPE.TRIPLE_WITH_SINGLE)
        {
            // 3带1 3不带 比较只多了一个判断条件
            if (mySize < 4)
            {
            }
            int grade3 = 0;
            foreach (int key in tempMyCardHash.Keys)
            {
                if (int.Parse(tempMyCardHash[key].ToString()) == 1)
                {
                    grade3 = key;
                    break;
                }
            }
            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]] >= 3)
                {
                    List <int> tempIntList = new List <int>();
                    tempIntList.Add(myCardsHashKey[i]);
                    tempIntList.Add(myCardsHashKey[i]);
                    tempIntList.Add(myCardsHashKey[i]);
                    tempIntList.Add(grade3);
                    PromptCards.Add(tempCount, tempIntList);
                    tempCount++;
                }
            }
        }
        // 上家出3带2
        else if (lastCardType == DDZ_POKER_TYPE.TRIPLE_WITH_TWIN)
        {
            // 3带1 3不带 比较只多了一个判断条件
            if (mySize < 5)
            {
            }
            int grade3 = 0;
            int grade4 = 0;
            foreach (int key in tempMyCardHash.Keys)
            {
                if (int.Parse(tempMyCardHash[key].ToString()) == 2)
                {
                    grade3 = key;
                    grade4 = key;
                    break;
                }
            }
            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]] >= 3)
                {
                    List <int> tempIntList = new List <int>();
                    tempIntList.Add(myCardsHashKey[i]);
                    tempIntList.Add(myCardsHashKey[i]);
                    tempIntList.Add(myCardsHashKey[i]);
                    tempIntList.Add(grade3);
                    tempIntList.Add(grade4);
                    PromptCards.Add(tempCount, tempIntList);
                    tempCount++;
                }
            }
        }
        // 上家出炸弹
        else if (lastCardType == DDZ_POKER_TYPE.FOUR_BOMB)
        {
            int tempCount = 0;
            // 4张牌可以大过上家的牌
            for (int i = mySize - 1; i >= 3; i--)
            {
                int grade0 = myCards[i];
                int grade1 = myCards[i - 1];
                int grade2 = myCards[i - 2];
                int grade3 = myCards[i - 3];

                if (grade0 == grade1 && grade0 == grade2 && grade0 == grade3)
                {
                    if (grade0 > prevGrade)
                    {
                        // 把四张牌存进去
                        List <int> tempIntList = new List <int>();
                        tempIntList.Add(grade0);
                        tempIntList.Add(grade1);
                        tempIntList.Add(grade2);
                        tempIntList.Add(grade3);

                        PromptCards.Add(tempCount, tempIntList);
                        tempCount++;
                    }
                }
            }
        }
        // 上家出4带2
        else if (lastCardType == DDZ_POKER_TYPE.FOUR_WITH_SINGLE)
        {
            // 4张牌可以大过上家的牌
            for (int i = mySize - 1; i >= 3; i--)
            {
                int grade0 = myCards[i];
                int grade1 = myCards[i - 1];
                int grade2 = myCards[i - 2];
                int grade3 = myCards[i - 3];

                if (grade0 == grade1 && grade0 == grade2 && grade0 == grade3)
                {
                    // 只要有炸弹,则返回true
                }
            }
        }
        // 上家出4带2 对子
        else if (lastCardType == DDZ_POKER_TYPE.FOUR_WITH_SINGLE)
        {
            // 4张牌可以大过上家的牌
            for (int i = mySize - 1; i >= 3; i--)
            {
                int grade0 = myCards[i];
                int grade1 = myCards[i - 1];
                int grade2 = myCards[i - 2];
                int grade3 = myCards[i - 3];

                if (grade0 == grade1 && grade0 == grade2 && grade0 == grade3)
                {
                    // 只要有炸弹,则返回true
                }
            }
        }
        // 上家出顺子
        else if (lastCardType == DDZ_POKER_TYPE.STRAIGHT_SINGLE)
        {
            if (mySize < prevSize)
            {
            }
            else
            {
                List <int> tempMyCards = new List <int>();
                tempMyCards = myCards;
                Hashtable myCardsHash = SortCardUseHash(tempMyCards);
                if (myCardsHash.Count < prevSize)
                {
                    Debug.Log("hash的总数小于顺子的count 肯定fales");
                }
                List <int> myCardsHashKey = new List <int>();
                foreach (int key in myCardsHash.Keys)
                {
                    myCardsHashKey.Add(key);
                }
                myCardsHashKey.Sort();
                int tempCount = 0;
                for (int i = myCardsHashKey.Count - 1; i >= prevSize - 1; i--)
                {
                    List <int> cards = new List <int>();
                    for (int j = 0; j < prevSize; j++)
                    {
                        cards.Add(myCardsHashKey[myCardsHashKey.Count - 1 - i + j]);
                    }
                    DDZ_POKER_TYPE myCardType = DDZ_POKER_TYPE.DDZ_PASS;
                    bool           isRule     = PokerRules.PopEnable(cards, out myCardType);

                    if (myCardType == DDZ_POKER_TYPE.STRAIGHT_SINGLE)
                    {
                        int myGrade2   = cards[cards.Count - 1];  // 最大的牌在最后
                        int prevGrade2 = lastCards[prevSize - 1]; // 最大的牌在最后

                        if (myGrade2 > prevGrade2)
                        {
                            //存进去PromptCards
                            PromptCards.Add(tempCount, cards);
                            tempCount++;
                        }
                    }
                }
            }
        }
        // 上家出连对
        else if (lastCardType == DDZ_POKER_TYPE.STRAIGHT_TWIN)
        {
            if (mySize < prevSize)
            {
            }
            else
            {
                List <int> tempMyCards = new List <int>();
                tempMyCards = myCards;
                Hashtable myCardsHash = SortCardUseHash(tempMyCards);
                if (myCardsHash.Count < prevSize)
                {
                    Debug.Log("hash的总数小于顺子的count 肯定fales");
                }
                List <int> myCardsHashKey = new List <int>();
                foreach (int key in myCardsHash.Keys)
                {
                    myCardsHashKey.Add(key);
                }
                myCardsHashKey.Sort();
                int tempCount = 0;
                for (int i = myCardsHashKey.Count - 1; i >= prevSize - 1; i--)
                {
                    List <int> cards = new List <int>();
                    for (int j = 0; j < prevSize; j++)
                    {
                        cards.Add(myCardsHashKey[myCardsHashKey.Count - 1 - i + j]);
                    }
                    DDZ_POKER_TYPE myCardType = DDZ_POKER_TYPE.DDZ_PASS;
                    bool           isRule     = PokerRules.PopEnable(cards, out myCardType);
                    if (myCardType == DDZ_POKER_TYPE.STRAIGHT_SINGLE)
                    {
                        int myGrade2   = cards[cards.Count - 1];  // 最大的牌在最后
                        int prevGrade2 = lastCards[prevSize - 1]; // 最大的牌在最后

                        if (myGrade2 > prevGrade2)
                        {
                            for (int ii = 0; ii < cards.Count; ii++)
                            {
                                if ((int)myCardsHash[cards[ii]] < 2)
                                {
                                    Debug.Log("是顺子但不是双顺");
                                    return(PromptCards);
                                }
                                else
                                {
                                    for (int iii = 0; iii < cards.Count; iii++)
                                    {
                                        cards.Add(cards[iii]);
                                    }
                                    //存进去PromptCards
                                    PromptCards.Add(tempCount, cards);
                                    tempCount++;
                                }
                            }
                        }
                    }
                }
            }
        }
        //上家出飞机
        else if (lastCardType == DDZ_POKER_TYPE.PLANE_PURE)
        {
            if (mySize < prevSize)
            {
            }
            else
            {
                int tempCount = 0;
                for (int i = 0; i <= mySize - prevSize; i++)
                {
                    List <int> cards = new List <int>();
                    for (int j = 0; j < prevSize; j++)
                    {
                        cards.Add(myCards[i + j]);
                    }

                    DDZ_POKER_TYPE myCardType = DDZ_POKER_TYPE.DDZ_PASS;
                    bool           isRule     = PokerRules.PopEnable(cards, out myCardType);
                    if (myCardType == DDZ_POKER_TYPE.PLANE_PURE)
                    {
                        int myGrade4   = cards[4];     //
                        int prevGrade4 = lastCards[4]; //

                        if (myGrade4 > prevGrade4)
                        {
                            //存进去PromptCards
                            PromptCards.Add(tempCount, cards);
                            tempCount++;
                        }
                    }
                }
            }
        }
        //上家出飞机带单
        else if (lastCardType == DDZ_POKER_TYPE.PLANE_WITH_SINGLE)
        {
            if (mySize < prevSize)
            {
            }
            else
            {
                int tempCount = 0;
                for (int i = 0; i <= mySize - prevSize; i++)
                {
                    List <int> cards = new List <int>();
                    for (int j = 0; j < prevSize - prevSize / 4; j++)
                    {
                        cards.Add(myCards[i + j]);
                    }

                    DDZ_POKER_TYPE myCardType = DDZ_POKER_TYPE.DDZ_PASS;
                    bool           isRule     = PokerRules.PopEnable(cards, out myCardType);
                    if (myCardType == DDZ_POKER_TYPE.PLANE_PURE)
                    {
                        int myGrade4   = cards[4];     //
                        int prevGrade4 = lastCards[4]; //

                        if (myGrade4 > prevGrade4)
                        {
                            int ii = 0;
                            //存进去PromptCards 然后再找一个最小的两个单
                            foreach (int key in tempMyCardHash.Keys)
                            {
                                if (int.Parse(tempMyCardHash[key].ToString()) == 1)
                                {
                                    cards.Add(key);
                                    ii++;
                                    if (ii == prevSize / 4)
                                    {
                                        break;
                                    }
                                }
                            }
                            PromptCards.Add(tempCount, cards);
                            tempCount++;
                        }
                    }
                }
            }
        }

        //上家出飞机带双
        else if (lastCardType == DDZ_POKER_TYPE.PLANE_WITH_TWIN)
        {
            if (mySize < prevSize)
            {
            }
            else
            {
                int tempCount = 0;
                for (int i = 0; i <= mySize - prevSize; i++)
                {
                    List <int> cards = new List <int>();
                    for (int j = 0; j < prevSize - prevSize / 5; j++)
                    {
                        cards.Add(myCards[i + j]);
                    }

                    DDZ_POKER_TYPE myCardType = DDZ_POKER_TYPE.DDZ_PASS;
                    bool           isRule     = PokerRules.PopEnable(cards, out myCardType);
                    if (myCardType == DDZ_POKER_TYPE.PLANE_PURE)
                    {
                        int myGrade4   = cards[4];     //
                        int prevGrade4 = lastCards[4]; //

                        if (myGrade4 > prevGrade4)
                        {
                            List <int> tempTwoList = new List <int>();
                            for (int ii = 0; ii < cards.Count; ii++)
                            {
                                int tempInt = 0;
                                for (int j = 0; j < cards.Count; j++)
                                {
                                    if (cards[ii] == cards[j])
                                    {
                                        tempInt++;
                                    }
                                }
                                if (tempInt == 2)
                                {
                                    tempTwoList.Add(cards[ii]);
                                }
                            }
                            if (tempTwoList.Count / 2 < prevSize / 5)
                            {
                            }
                            else
                            {
                                //存进去
                                int iii = 0;
                                //存进去PromptCards 然后再找一个最小的两个单
                                foreach (int key in tempMyCardHash.Keys)
                                {
                                    if (int.Parse(tempMyCardHash[key].ToString()) == 2)
                                    {
                                        cards.Add(key);
                                        cards.Add(key);
                                        iii++;
                                        if (iii == prevSize / 5)
                                        {
                                            break;
                                        }
                                    }
                                }
                                PromptCards.Add(tempCount, cards);
                                tempCount++;
                            }
                        }
                    }
                }
            }
        }



        // 集中判断对方不是炸弹,我出炸弹的情况
        if (lastCardType != DDZ_POKER_TYPE.FOUR_BOMB)
        {
            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 ((int)tempMyCardHash[myCardsHashKey[i]] == 4)
                {
                    List <int> tempIntList = new List <int>();
                    tempIntList.Add(myCardsHashKey[i]);
                    tempIntList.Add(myCardsHashKey[i]);
                    tempIntList.Add(myCardsHashKey[i]);
                    tempIntList.Add(myCardsHashKey[i]);
                    Debug.Log("PromptCards.Count" + PromptCards.Count);
                    PromptCards.Add(PromptCards.Count, tempIntList);
                }
            }
        }
        if (mySize >= 2)
        {
            List <int> myCardsHashKey = new List <int>();
            foreach (int key in tempMyCardHash.Keys)
            {
                myCardsHashKey.Add(key);
            }
            if (myCardsHashKey.Contains(53) && myCardsHashKey.Contains(54))
            {
                List <int> tempIntList = new List <int>();
                tempIntList.Add(53);
                tempIntList.Add(54);
                PromptCards.Add(PromptCards.Count, tempIntList);
            }
        }

        return(PromptCards);
    }