Ejemplo n.º 1
0
 public List<Card> DoubleDown(Card card, int amount)
 {
     CurrentBet = CurrentBet + amount;
     Bank -= amount;
     CurrentHand.Add(card);
     playerNotify(card, i);
     return CurrentHand; 
 }
Ejemplo n.º 2
0
 //Adds card to hand, returns new total
 public List<Card> Hit(Card card)
 {
     CurrentHand.Add(card);
     if(Hand4 != null)
     {
         Hand4.Add(card);
     }
     playerNotify(card, i);
     return CurrentHand;
 }
Ejemplo n.º 3
0
        public void newHand()
        {
            numOfHands = (numOfHands + 1) % Players.Count;
            piles.Clear();
            piles.Add(0);
            lastRasePlayer = 0;
            currentRaise   = 0;
            deck           = shuffle();
            cardsOnTable.Clear();

            CurrentHand.Clear();

            Hand = new Business.DomainModel.Hand();

            foreach (KeyValuePair <int, Player> player in Players)
            {
                if (player.Value.currentMoney < this.table.BuyInMin)
                {
                    UserRepository rep  = new UserRepository();
                    User           user = rep.ReadByUsername(player.Value.username);

                    if (user.money >= table.BuyInMax)
                    {
                        player.Value.currentMoney += table.BuyInMax;
                        user.money -= table.BuyInMax;
                        rep.UpdateMoney(user.username, user.money);
                    }
                    else if (user.money > table.BuyInMin)
                    {
                        player.Value.currentMoney += table.BuyInMin;
                        user.money -= table.BuyInMin;
                        rep.UpdateMoney(user.username, user.money);
                    }
                    else
                    {
                        continue;
                    }
                }

                player.Value.stakesMoney = 0;
                CurrentHand.Add(player.Key);

                Hand.username.Add(player.Key.ToString(), player.Value.username);
            }

            //for (int j = 0; j < numOfHands; j++)
            //{
            //    int tmp = CurrentHand[0];
            //    for (int i = 0; i < CurrentHand.Count - 1; i++)
            //        CurrentHand[i] = CurrentHand[i + 1];
            //    CurrentHand[CurrentHand.Count - 1] = tmp;
            //}
        }
Ejemplo n.º 4
0
        // 카드를 뽑는다
        public bool DrawCard()
        {
            if (CurrentStageDeck.Count == 0 || CurrentHand.Count > 4)
            {
                return(false);
            }

            int randCardNum = UnityEngine.Random.Range(0, CurrentStageDeck.Count);

            // 카드 데이터를 기반으로 실제 카드로 바꿈
            CurrentHand.Add(CreateCard(CurrentStageDeck[randCardNum]));
            CurrentStageDeck.RemoveAt(randCardNum);

            return(true);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Adds the card to the player's hand and triggers the OnCardAddedToHand event
 /// </summary>
 /// <param name="cardData"></param>
 public void AddCardToHand(Card card)
 {
     CurrentHand.Add(card);
     card.HandAnimationModule.Show();
     OnCardAddedToHand?.Invoke(card);
 }