예제 #1
0
        private void CreateCardSet(IGameSet gameSet)
        {
            int cardId = 0;

            foreach (var cardSet in gameSet.CardSets)
            {
                for (int i = 0; i < cardSet.Count; i++)
                {
                    switch (cardSet.CardType)
                    {
                    case CardType.GoldCard:
                        GoldCards.Add(new GoldCard(cardId++, cardSet.RouteType, cardSet.CardImage, cardSet.GoldCount));
                        break;

                    case CardType.RouteCard:
                        HandCards.Add(new RouteCard(cardId++, cardSet.RouteType, cardSet.CardImage, cardSet.GoldCount, cardSet.IsTroll, cardSet.HasGates));
                        break;

                    case CardType.ActionCard:
                        HandCards.Add(new ActionCard(cardId++, cardSet.CardImage, cardSet.ActionType));
                        break;

                    case CardType.StairsCard:
                        HandCards.Add(new StairsCard(cardId++, cardSet.RouteType, cardSet.CardImage));
                        break;
                    }
                }
            }
        }
예제 #2
0
        public Card AddCard()
        {
            // Add a card from the deck to your hand
            // The card is chosen through the Random object
            // The card is then removed from the deck

            // Since when a card is chosen it is removed from the list, the random index is in the range of the
            // size of the deck.
            int  temp   = rnd.Next(DeckCards.Cards.Count);
            Card result = DeckCards.Cards[temp];

            DeckCards.Cards.RemoveAt(temp);
            HandCards.Add(result);

            // If the Rank of the resulting card is 0, then it is an Ace. Which can equal to both 1 or 11
            if (result.Rank == 0)
            {
                Score     += 1;
                AcesScore += 11;
            }
            // If the card is not an ace, update both scores equally
            else
            {
                Score     += result.Values[result.Rank];
                AcesScore += result.Values[result.Rank];
            }

            return(result);
        }
예제 #3
0
파일: Oppo.cs 프로젝트: xAdamQ/Basra
    public async UniTask Distribute(int cardsCount)
    {
        for (var i = 0; i < cardsCount; i++)
        {
            var card = await Card.CreateOppoCard(BackSprite, transform);

            HandCards.Add(card);
            card.Player = this;
        }

        DistributeAnim();
    }
예제 #4
0
    public async UniTask Distribute(List <int> cardIds)
    {
        AudioManager.I.Play(distributeClip);

        foreach (var cardId in cardIds)
        {
            var card = await Card.CreateMyPlayerCard(cardId, BackSprite, transform);

            card.Player = this;
            HandCards.Add(card);
        }

        DistributeAnim();
    }
예제 #5
0
 public void SecondRoundStarted(PokerCard card)
 {
     if (!IsInGame())
     {
         return;
     }
     BetedCoins = 0;
     HandCards.Add(card);
     Combination.SetCards(HandCards);
     if (Status != SeatStatus.Drop && Status != SeatStatus.AllIn)
     {
         Status = SeatStatus.None;
     }
 }
예제 #6
0
        public override bool IsPresent()
        {
            var ordered = Cards.Select(x => x.Rank.Score).ToList();

            if (ordered.Contains(Rank.Ace.Score))
            {
                ordered.Add(1);
            }
            ordered = ordered.OrderBy(x => x).ToList();
            var countInOrder  = 1;
            var previousScore = ordered[0];

            HandCards.Add(GetCard(previousScore));
            for (int i = 1; i < ordered.Count; i++)
            {
                var score = ordered[i];
                if (score == previousScore + 1)
                {
                    countInOrder += 1;
                    HandCards.Add(GetCard(score));
                    if (countInOrder > 5)
                    {
                        HandCards.RemoveAt(0);
                    }
                }
                else if (score == previousScore)
                {
                    continue;
                }
                else
                {
                    if (countInOrder >= 5)
                    {
                        return(true);
                    }
                    HandCards.Clear();
                    HandCards.Add(GetCard(score));
                    countInOrder = 1;
                }
                previousScore = score;
            }
            return(countInOrder >= 5);
        }
예제 #7
0
 /// <summary>
 /// カード追加
 /// </summary>
 /// <param name="card"></param>
 public void AddCard(Card card)
 {
     HandCards.Add(card);
 }
예제 #8
0
 public override bool IsPresent()
 {
     HandCards.Add(Cards.OrderByDescending(x => x.Rank).First());
     return(true);
 }