public int[] GetSelectedIndices() { return(ColorsSelected.Select((item, index) => new { Item = item, Index = index }) .Where(pair => pair.Item && !ColorDisabled[pair.Index]) //can't hurt to check ColorDisabled here too, probably .Select(result => result.Index) .ToArray()); }
private bool CheckColor(CardCollectionInputGraphicViewModel vm) { if (ColorsSelected.Count == 0) { return(true); } ShardColor color = vm.GetColor(); bool wantedColorless = ColorsSelected.Contains(ShardColor.Colorless); ShardColor wantedColor = ColorsSelected.Aggregate(ShardColor.Colorless, (current, newColor) => current | newColor); return(Matcher <ShardColor> .HasValue(color, wantedColor) || (wantedColorless && color == ShardColor.Colorless)); }
private bool CheckColor(ICardAllDbInfo cai) { if (ColorsSelected.Count == 0) { return(true); } ShardColor color = MultiPartCardManager.Instance.GetColor(cai); bool wantedColorless = ColorsSelected.Contains(ShardColor.Colorless); ShardColor wantedColor = ColorsSelected.Aggregate(ShardColor.Colorless, (current, newColor) => current | newColor); if (ColorAggregation == MultiSelectedAggregation.And) { return(Matcher <ShardColor> .IncludeValue(color, wantedColor)); } //ColorAggregation == MultiSelectedAggregation.Or return(Matcher <ShardColor> .HasValue(color, wantedColor) || (wantedColorless && color == ShardColor.Colorless)); }
private void ReInit() { //Default values Name = null; ExcludeFunEditions = true; ExcludeOnlineOnlyEditions = true; ExcludeSpecialCards = true; CountIncludeFoil = false; CountIsNameBased = false; CountComparatorSelected = CountComparator[(int)ComparisonType.GreaterOrEquals]; CountSelected = 1; AllLanguages = false; PerimeterScope = PerimeterScope.All; ColorAggregation = MultiSelectedAggregation.Or; TypeAggregation = MultiSelectedAggregation.Or; SubTypeAggregation = MultiSelectedAggregation.Or; EditionsSelected.Clear(); CollectionsSelected.Clear(); ColorsSelected.Clear(); TypesSelected.Clear(); SubTypesSelected.Clear(); }