示例#1
0
    // Connects player variables, draws first hand, shows hand panel
    public void ActivatePanel()
    {
        // Show hand panel to set up card panel positions
        handPanel.SetPosition(ShowKey, false);
        hidden = false;
        MatchScreen();

        // Lock panels beyond handsize, and properly display deck and graveyard panels
        for (int i = handSize; i < cardPanels.Count; i++)
        {
            cardPanels[i].IsLocked = true;
        }
        DiscardPanel.Display(0);
        DeckPanel.Display(0);

        // Hide hand until activation
        handPanel.SetPosition(HideKey, false);

        SetDrawCooldown();

        // Set up (connect) deck, and hand variables with player
        if (owner.playerUnit.hand == null)
        {
            owner.playerUnit.hand = new List <Card>(MaxHandSize);
        }
        hand        = owner.playerUnit.hand;
        discards    = owner.playerUnit.discards;
        deck        = owner.playerUnit.deck;
        handSize    = owner.playerUnit.handSize;
        curHandSize = handSize;

        // Draw hand
        for (int i = hand.Count - 1; i < MaxHandSize; ++i)
        {
            if (i >= curHandSize)
            {
                if (!cardPanels[i].IsLocked)
                {
                    cardPanels[i].IsLocked = true;
                }
                cardPanels[i].card = EmptyCard();
            }
            else
            {
                deck.Shuffle();
                hand.Add(deck.Draw());
            }

            RefreshEntry(i);
        }

        DeckPanel.Display(deck.Count);
        SetSelection(0);
        SetDrawCooldown();

        handPanel.SetPosition(ShowKey, true);
        hidden = false;
    }
    public virtual void SetupAbilityDeck(List <AbilityCardData> abilityDeckConfig)
    {
        foreach (AbilityCardData abilityData in abilityDeckConfig)
        {
            AbilityCard newAbilityCard = new AbilityCard(abilityData);
            AbilityDeck.Add(newAbilityCard);
        }

        AbilityDeck.Shuffle();
        RaiseMain(AbilityDeck);
    }
示例#3
0
    // Shuffle Discards back into deck
    IEnumerator ReshuffleDiscards()
    {
        reshuffling = true;
        yield return(StartCoroutine(MoveDeckPanel(DiscardPanel, DeckKey)));

        deck.Add(discards);
        deck.Shuffle();
        DeckPanel.Display(deck.Count);
        discards = new AbilityDeck(new List <Card>());
        DiscardPanel.Display(discards.Count);
        yield return(StartCoroutine(MoveDeckPanel(DiscardPanel, DiscardKey)));

        reshuffling = false;
    }
 public virtual void ReshuffleDiscard()
 {
     // add event for reshuffling discard feedback?
     if (AbilityDiscard.Count > 0)
     {
         int _discardCount = AbilityDiscard.Count;
         for (int i = 0; i < _discardCount; i++)
         {
             // TODO might do something more here with the Add(List<T> function)
             AbilityDeck.Add(AbilityDiscard.Draw());
         }
         RaiseMain(AbilityDeck);
         RaiseDiscard(AbilityDiscard);
     }
     // shuffle ability deck only if it contains more than 1 item
     if (AbilityDeck.Count > 1)
     {
         AbilityDeck.Shuffle();
     }
 }