Ejemplo n.º 1
0
 public void Awake()
 {
     roomBehaiorCpt         = GetParent <DDZRoomBehaiorCpt>();
     playLastCircleCards    = new List <DDZCompareCard>();
     lastPlayerCards        = new DDZCompareCard();
     lastPlayerCards.pokers = new List <byte>();
     surCardsNum            = new int[3];
     gamePlayrMap           = new DDZPlayerData[3];
 }
Ejemplo n.º 2
0
 public void SaveLastPlayerCards(long userId)
 {
     lastPlayerCards = new DDZCompareCard
     {
         userId     = userId,
         POKER_TYPE = roomBehaiorCpt.ddzPokerCompareCpt.currCard.POKER_TYPE,
     };
     lastPlayerCards.pokers = new List <byte>();
     roomBehaiorCpt.ddzPokerCompareCpt.currCard.pokers.ForEach(u => lastPlayerCards.pokers.Add(u));
 }
Ejemplo n.º 3
0
        public void UpdataplayLastCircleCards(DDZCompareCard card)
        {
            if (playLastCircleCards.Count >= 2)
            {
                playLastCircleCards.RemoveAt(0);
            }

            for (int i = 0; i < playLastCircleCards.Count; i++)
            {
                if (playLastCircleCards[i].userId == card.userId)
                {
                    playLastCircleCards.Remove(playLastCircleCards[i]);
                }
            }

            playLastCircleCards.Add(card);
        }
Ejemplo n.º 4
0
        public bool CompareCards(List <byte> myCards, long userId, List <DDZCompareCard> lastCardsList)
        {
            DDZCompareCard lastCards = new DDZCompareCard(); lastCards.pokers = new List <byte>();

            if (lastCardsList.Count > 0)
            {
                for (int i = lastCardsList.Count - 1; i > -1; i--)
                {
                    if (lastCardsList[i].POKER_TYPE == DDZCardType.DDZ_POKER_TYPE.DDZ_PASS && lastCardsList[i].pokers.Count == 0)
                    {
                        continue;
                    }

                    lastCards.POKER_TYPE = lastCardsList[i].POKER_TYPE; lastCardsList[i].pokers.ForEach(u => lastCards.pokers.Add(u)); lastCards.userId = lastCardsList[i].userId;

                    break;
                }
            }
            DDZCardType.DDZ_POKER_TYPE myCardType = DDZCardType.DDZ_POKER_TYPE.DDZ_PASS;

            bool IsPopEnable = PopEnable(myCards, out myCardType);

            if (!IsPopEnable)
            {
                return(false);
            }

            if (lastCards.pokers.Count == 0 && lastCards.POKER_TYPE == DDZCardType.DDZ_POKER_TYPE.DDZ_PASS)
            {
                if (myCardType == DDZCardType.DDZ_POKER_TYPE.KING_BOMB || myCardType == DDZCardType.DDZ_POKER_TYPE.FOUR_BOMB)
                {
                    bombNum++;
                }

                ChangeCard(myCards, userId, myCardType);
                return(true);
            }
            else
            {
                if (lastCards.POKER_TYPE == DDZCardType.DDZ_POKER_TYPE.KING_BOMB)
                {
                    return(false);
                }
                else if (myCardType == DDZCardType.DDZ_POKER_TYPE.KING_BOMB)
                {
                    bombNum++;
                    ChangeCard(myCards, userId, myCardType);
                    return(true);
                }
                if (lastCards.POKER_TYPE != DDZCardType.DDZ_POKER_TYPE.FOUR_BOMB && myCardType == DDZCardType.DDZ_POKER_TYPE.FOUR_BOMB)
                {
                    bombNum++;
                    ChangeCard(myCards, userId, myCardType);
                    return(true);
                }

                if (myCards.Count != lastCards.pokers.Count)
                {
                    return(false);
                }

                if (myCardType != lastCards.POKER_TYPE)
                {
                    return(false);
                }

                var pokerNum0 = PokerCardsHelper.GetPokerNum(lastCards.pokers[0]);
                var pokerNum1 = PokerCardsHelper.GetPokerNum(myCards[0]);

                if (pokerNum1 == 2 && pokerNum0 <= 14 && pokerNum0 != 2)
                {
                    if (myCardType == DDZCardType.DDZ_POKER_TYPE.FOUR_BOMB)
                    {
                        bombNum++;
                    }
                    ChangeCard(myCards, userId, myCardType);
                    return(true);
                }
                else if (pokerNum0 == 2 && pokerNum1 <= 14)
                {
                    return(false);
                }
                if (pokerNum1 > pokerNum0)
                {
                    if (myCardType == DDZCardType.DDZ_POKER_TYPE.FOUR_BOMB)
                    {
                        bombNum++;
                    }
                    ChangeCard(myCards, userId, myCardType);
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 5
0
 public void Awake()
 {
     currCard        = new DDZCompareCard();
     currCard.pokers = new List <byte>();
     bombNum         = 0;
 }