public bool AddCard(EntityDef cardEntityDef, CardFlair cardFlair, DeckTrayDeckTileVisual deckTileToRemove, bool playSound, Actor animateFromActor = null)
    {
        if (!base.IsModeActive())
        {
            return(false);
        }
        if (cardEntityDef == null)
        {
            UnityEngine.Debug.LogError("Trying to add card EntityDef that is null.");
            return(false);
        }
        string         cardId     = cardEntityDef.GetCardId();
        CollectionDeck taggedDeck = CollectionManager.Get().GetTaggedDeck(this.m_deckType);

        if (taggedDeck == null)
        {
            return(false);
        }
        if (playSound)
        {
            SoundManager.Get().LoadAndPlay("collection_manager_place_card_in_deck", base.gameObject);
        }
        if (taggedDeck.GetTotalCardCount() == 30)
        {
            if (deckTileToRemove == null)
            {
                UnityEngine.Debug.LogWarning(string.Format("CollectionDeckTray.AddCard(): Cannot add card {0} (flair {1}) without removing one first.", cardEntityDef.GetCardId(), cardFlair));
                return(false);
            }
            string    cardID = deckTileToRemove.GetCardID();
            CardFlair flair  = deckTileToRemove.GetCardFlair();
            if (!taggedDeck.RemoveCard(cardID, flair.Premium, deckTileToRemove.IsOwnedSlot()))
            {
                object[] args = new object[] { cardId, cardFlair, cardID, flair };
                UnityEngine.Debug.LogWarning(string.Format("CollectionDeckTray.AddCard({0},{1}): Tried to remove card {2} with flair {3}, but it failed!", args));
                return(false);
            }
        }
        if (!taggedDeck.AddCard(cardEntityDef, cardFlair.Premium))
        {
            UnityEngine.Debug.LogWarning(string.Format("CollectionDeckTray.AddCard({0},{1}): deck.AddCard failed!", cardId, cardFlair));
            return(false);
        }
        if (taggedDeck.GetTotalOwnedCardCount() == 30)
        {
            DeckHelper.Get().Hide();
        }
        this.UpdateCardList(cardEntityDef, true, animateFromActor);
        CollectionManagerDisplay.Get().UpdateCurrentPageCardLocks(true);
        if ((!Options.Get().GetBool(Option.HAS_ADDED_CARDS_TO_DECK, false) && (taggedDeck.GetTotalCardCount() >= 2)) && (!DeckHelper.Get().IsActive() && (taggedDeck.GetTotalCardCount() < 15)))
        {
            NotificationManager.Get().CreateInnkeeperQuote(GameStrings.Get("VO_INNKEEPER_CM_PAGEFLIP_28"), "VO_INNKEEPER_CM_PAGEFLIP_28", 0f, null);
            Options.Get().SetBool(Option.HAS_ADDED_CARDS_TO_DECK, true);
        }
        return(true);
    }
コード例 #2
0
 private void Update()
 {
     this.m_deckTileToRemove = null;
     if (this.m_activeActor == this.m_deckTile)
     {
         RaycastHit     hit;
         CollectionDeck taggedDeck = CollectionManager.Get().GetTaggedDeck(CollectionManager.DeckTag.Editing);
         if (((taggedDeck != null) && (taggedDeck.GetTotalCardCount() == 30)) && UniversalInputManager.Get().GetInputHitInfo(DeckTrayDeckTileVisual.LAYER.LayerBit(), out hit))
         {
             DeckTrayDeckTileVisual component = hit.collider.gameObject.GetComponent <DeckTrayDeckTileVisual>();
             if ((component != null) && (component != this.m_deckTileToRemove))
             {
                 this.m_deckTileToRemove = component;
             }
         }
     }
 }
コード例 #3
0
    public bool GrabCard(DeckTrayDeckTileVisual deckTileVisual)
    {
        Actor actor = deckTileVisual.GetActor();

        if (!this.CanGrabItem(actor))
        {
            return(false);
        }
        if (!this.m_heldCardVisual.ChangeActor(actor, CollectionManagerDisplay.ViewMode.CARDS))
        {
            return(false);
        }
        this.m_scrollBar.Pause(true);
        PegCursor.Get().SetMode(PegCursor.Mode.DRAG);
        this.m_heldCardVisual.SetSlot(deckTileVisual.GetSlot());
        this.m_heldCardVisual.transform.position = actor.transform.position;
        this.m_heldCardVisual.Show(this.m_mouseIsOverDeck);
        SoundManager.Get().LoadAndPlay("collection_manager_pick_up_card", this.m_heldCardVisual.gameObject);
        CollectionDeckTray.Get().RemoveCard(this.m_heldCardVisual.GetCardID(), this.m_heldCardVisual.GetCardFlair(), deckTileVisual.IsOwnedSlot());
        return(true);
    }
コード例 #4
0
    private void DropCard(bool dragCanceled, DeckTrayDeckTileVisual deckTileToRemove)
    {
        PegCursor.Get().SetMode(PegCursor.Mode.STOPDRAG);
        if (!dragCanceled)
        {
            if (!this.m_mouseIsOverDeck)
            {
                SoundManager.Get().LoadAndPlay("collection_manager_drop_card", this.m_heldCardVisual.gameObject);
            }
            else
            {
                switch (this.m_heldCardVisual.GetVisualType())
                {
                case CollectionManagerDisplay.ViewMode.CARDS:
                    CollectionDeckTray.Get().AddCard(this.m_heldCardVisual.GetEntityDef(), this.m_heldCardVisual.GetCardFlair(), deckTileToRemove, true, null);
                    break;

                case CollectionManagerDisplay.ViewMode.HERO_SKINS:
                    CollectionDeckTray.Get().GetHeroSkinContent().UpdateHeroSkin(this.m_heldCardVisual.GetEntityDef(), this.m_heldCardVisual.GetCardFlair(), true);
                    break;

                case CollectionManagerDisplay.ViewMode.CARD_BACKS:
                {
                    object cardBackId = this.m_heldCardVisual.GetCardBackId();
                    if (cardBackId != null)
                    {
                        CollectionDeckTray.Get().GetCardBackContent().UpdateCardBack((int)cardBackId, true, null);
                        break;
                    }
                    Debug.LogWarning("Cardback ID not set for dragging card back.");
                    break;
                }
                }
            }
        }
        this.m_heldCardVisual.Hide();
        this.m_scrollBar.Pause(false);
    }
コード例 #5
0
 public bool AddCard(EntityDef cardEntityDef, CardFlair cardFlair, DeckTrayDeckTileVisual deckTileToRemove, bool playSound, Actor animateActor = null)
 {
     return(this.GetCardsContent().AddCard(cardEntityDef, cardFlair, deckTileToRemove, playSound, animateActor));
 }
コード例 #6
0
 public void DropCard(DeckTrayDeckTileVisual deckTileToRemove)
 {
     this.DropCard(false, deckTileToRemove);
 }