Ejemplo n.º 1
0
    private void CleanCache()
    {
        int num = this.m_cardCache.Count - 60;

        if (num > 0)
        {
            CollectionDeck currentlyOpenDeck = null;
            if (CollectionManager.Get() != null)
            {
                currentlyOpenDeck = CollectionManager.Get().GetTaggedDeck(CollectionManager.DeckTag.Editing);
            }
            List <string> deckHelperCardChoices = (DeckHelper.Get() != null) ? DeckHelper.Get().GetCardIDChoices() : null;
            List <string> names = new List <string>();
            int           index = 0;
            while (index < this.m_cardCache.Count)
            {
                CardCacheItem item = this.m_cardCache[index];
                if (!this.CanClearItem(item, currentlyOpenDeck, deckHelperCardChoices))
                {
                    index++;
                }
                else
                {
                    names.Add(item.m_cardId);
                    this.m_cardCache.RemoveAt(index);
                    DefLoader.Get().ClearCardDef(item.m_cardId);
                    if (names.Count == num)
                    {
                        break;
                    }
                }
            }
            AssetCache.ClearCardPrefabs(names);
        }
    }
Ejemplo n.º 2
0
    public void Unload()
    {
        this.m_cardCacheRequests.Clear();
        List <string> names = new List <string>();

        foreach (CardCacheItem item in this.m_cardCache)
        {
            names.Add(item.m_cardId);
        }
        this.m_cardCache.Clear();
        AssetCache.ClearCardPrefabs(names);
    }