Class AchievementSyncPlanFilter
Narrows an AchievementSyncPlan's items to what the Review step's chip bar and search box ask for, and counts how many items belong to each chip.
Inherited Members
Namespace: Serenity.Achievements.Infrastructure.Editor.Sync
Assembly: Serenity.UnityAchievements.Infrastructure.Editor.dll
Syntax
public static class AchievementSyncPlanFilter
Remarks
Pure and separate from the review window, in the same spirit as AchievementsStudioFilter: a
plan item is judged once per pass, and "how many are Conflicts" is the length of one filtered list
rather than a second traversal the window would otherwise have to keep in sync with the first.
Fields
FilterLabels
The labels the filter chip bar shows, in Serenity.Achievements.Infrastructure.Editor.Sync.AchievementSyncPlanFilter.Chips order.
Declaration
public static readonly string[] FilterLabels
Field Value
| Type | Description |
|---|---|
| string[] |
Methods
Apply(IReadOnlyList<AchievementSyncPlanItem>, string, AchievementSyncPlanFilterKind)
Narrows a plan's items to what the Review step's chip bar and search box ask for.
Declaration
public static IReadOnlyList<AchievementSyncPlanItem> Apply(IReadOnlyList<AchievementSyncPlanItem> items, string search, AchievementSyncPlanFilterKind filter)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<AchievementSyncPlanItem> | items | Every item in the plan. May be null and may contain null. |
| string | search | What was typed into the search field. |
| AchievementSyncPlanFilterKind | filter | The chip currently active. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<AchievementSyncPlanItem> | The surviving items, in the order given. |
CountsByFilter(IReadOnlyList<AchievementSyncPlanItem>)
How many of items belong to each chip, in FilterLabels order.
Declaration
public static int[] CountsByFilter(IReadOnlyList<AchievementSyncPlanItem> items)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<AchievementSyncPlanItem> | items | Every item in the plan. May be null and may contain null. |
Returns
| Type | Description |
|---|---|
| int[] | One count per chip in Serenity.Achievements.Infrastructure.Editor.Sync.AchievementSyncPlanFilter.Chips order. |
FilterKindAt(int)
The chip kind at index into FilterLabels / CountsByFilter(IReadOnlyList<AchievementSyncPlanItem>)'s result — the caller-facing half of the Serenity.Achievements.Infrastructure.Editor.Sync.AchievementSyncPlanFilter.Chips authority, so a chip bar never has to cast a loop index to the enum itself.
Declaration
public static AchievementSyncPlanFilterKind FilterKindAt(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The chip index, as drawn from FilterLabels. |
Returns
| Type | Description |
|---|---|
| AchievementSyncPlanFilterKind | The kind that chip filters by. |
Matches(AchievementSyncPlanItem, string, AchievementSyncPlanFilterKind)
Whether one item survives the search text and the chosen chip.
Declaration
public static bool Matches(AchievementSyncPlanItem item, string search, AchievementSyncPlanFilterKind filter)
Parameters
| Type | Name | Description |
|---|---|---|
| AchievementSyncPlanItem | item | The item to judge. Null never matches. |
| string | search | What was typed into the search field. Blank matches everything. |
| AchievementSyncPlanFilterKind | filter | The chip currently active. |
Returns
| Type | Description |
|---|---|
| bool | True when the item should stay in the list. |