public static List <FilteredArtStack> GenerateUnion(List <CollectionFilterSet.CollectionArtFilterSet> artFilterSets)
        {
            if ((artFilterSets == null) || (artFilterSets.Count == 0))
            {
                return(new List <FilteredArtStack>());
            }
            Map <NetCache.CardDefinition, FilteredArtStack> map = new Map <NetCache.CardDefinition, FilteredArtStack>();

            foreach (CollectionFilterSet.CollectionArtFilterSet set in artFilterSets)
            {
                foreach (KeyValuePair <NetCache.CardDefinition, FilteredArtStack> pair in set.GenerateMap())
                {
                    NetCache.CardDefinition key   = pair.Key;
                    FilteredArtStack        stack = pair.Value;
                    if (!map.ContainsKey(key))
                    {
                        map.Add(key, stack);
                    }
                    else
                    {
                        FilteredArtStack stack2 = map[key];
                        if (!stack2.MergeWithArtStack(stack))
                        {
                            Debug.LogWarning(string.Format("CollectionArtFilterSet.GenerateUnion(): could not merge filtered art stack {0} with filtered art stack {1}", stack2, stack));
                        }
                    }
                }
            }
            return(new List <FilteredArtStack>(map.Values));
        }
Example #2
0
    public int CompareTo(object obj)
    {
        if (!(obj is FilteredArtStack))
        {
            throw new ArgumentException("CollectionFilteredArtStack.CompareTo(): obj is not a CollectionFilteredArtStack");
        }
        FilteredArtStack stack = obj as FilteredArtStack;

        return(this.m_artStack.CompareTo(stack.m_artStack));
    }
        private Map <NetCache.CardDefinition, FilteredArtStack> GenerateMap()
        {
            Map <NetCache.CardDefinition, FilteredArtStack> map = new Map <NetCache.CardDefinition, FilteredArtStack>();

            foreach (CollectionCardStack stack in CollectionManager.Get().GetCollectibleStacks().Values)
            {
                CollectionCardStack.ArtStack artStack = stack.GetArtStack(this.m_flairRestriction);
                FilteredArtStack             stack3   = !this.m_mustPassAllFilters ? this.RunFilters_CanPassAny(artStack) : this.RunFilters_MustPassAll(artStack);
                if (stack3 != null)
                {
                    map.Add(stack3.GetCardDefinition(), stack3);
                }
            }
            return(map);
        }
Example #4
0
 public bool MergeWithArtStack(FilteredArtStack other)
 {
     return(this.m_artStack.MergeWithArtStack(other.m_artStack));
 }