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)); }