Beispiel #1
0
        public static UpdateDiscardCountEventArgs Create(int count)
        {
            UpdateDiscardCountEventArgs result = ReferencePool.Acquire <UpdateDiscardCountEventArgs>();

            result.discardCount = count;
            return(result);
        }
Beispiel #2
0
        private void DrawCardsFromDeck(int drawCount)
        {
            while (true)
            {
                var deckSize = deckPile.Count;
                if (deckSize >= drawCount)
                {
                    var prevDeckSize = deckSize;
                    var drawnCards   = new List <int>(drawCount);
                    for (int i = 0; i < drawCount; i++)
                    {
                        var cardId = deckPile[0];
                        deckPile.RemoveAt(0);
                        handPile.Add(cardId);
                        drawnCards.Add(cardId);
                    }

                    // handPresentatation.CreateCardInHand(drawnCards, prevDeckSize);
                    GameEntry.Event.FireNow(this, DeckDrawingEventArgs.Create(drawnCards));
                    GameEntry.Event.FireNow(this, UpdateDeckCountEventArgs.Create(prevDeckSize));
                }
                else
                {
                    deckPile.AddRange(discardPile);
                    discardPile.Clear();
                    GameEntry.Event.FireNow(this, UpdateDiscardCountEventArgs.Create(discardPile.Count));
                    // handPresentatation.UpdateDiscardPileSize(discardPile.Count);
                    if (drawCount > deckPile.Count + discardPile.Count)
                    {
                        drawCount = deckPile.Count + discardPile.Count;
                    }

                    deckPile.Shuffle();
                    continue;
                }

                break;
            }
        }
Beispiel #3
0
        private void UpdateDiscardCount(object sender, GameEventArgs e)
        {
            UpdateDiscardCountEventArgs ne = (UpdateDiscardCountEventArgs)e;

            gameUI.SetAmount(ne.discardCount, GameForm.DeckOrDiscard.discard);
        }