Class AchievementAuthoringRules
The single set of rules for whether an authored achievement will actually work: an id that can key a row, a condition that can be evaluated, a presentation the player can read, and platform identifiers for the storefronts the project ships on.
Inherited Members
Namespace: Serenity.Achievements.Application.Authoring
Assembly: Serenity.Achievements.Application.dll
Syntax
public static class AchievementAuthoringRules
Remarks
Written once here, in engine-free Application code, because the same questions are asked in three places that must not be allowed to disagree — the Studio's inline hints, the project validator, and the headless CI run. Every finding names the achievement it came from and the group of fields at fault, which is what lets a tool turn a message into a link.
Methods
Check(IReadOnlyList<AchievementAuthoringSnapshot>, IAchievementCustomConditionResolver)
Checks every authored achievement in a project.
Declaration
public static IReadOnlyList<AuthoringIssue> Check(IReadOnlyList<AchievementAuthoringSnapshot> achievements, IAchievementCustomConditionResolver customConditionResolver = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<AchievementAuthoringSnapshot> | achievements | The achievements to check, in the order they are listed. |
| IAchievementCustomConditionResolver | customConditionResolver | Resolves the rules a node names, checked through ValidateCustomRule(IAchievementCustomConditionResolver). Pass one to have unresolvable custom types reported; omit it when no resolver is running, and that check is skipped. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<AuthoringIssue> | Every finding, one achievement at a time in list order. |
DescribeInvalidStorefrontIdentifier(AchievementPlatformKind, string)
The sentence that says why identifier is refused for platform.
Declaration
public static string DescribeInvalidStorefrontIdentifier(AchievementPlatformKind platform, string identifier)
Parameters
| Type | Name | Description |
|---|---|---|
| AchievementPlatformKind | platform | The storefront the identifier is for. |
| string | identifier | The refused identifier. |
Returns
| Type | Description |
|---|---|
| string |
IsValidIdSlug(string)
Whether id satisfies the same slug rule Check(IReadOnlyList<AchievementAuthoringSnapshot>, IAchievementCustomConditionResolver) holds every
achievement's id to — exposed so a live editor field (a platform-only sync row's id proposal, for
one) can validate as the author types, without waiting for a full Check(IReadOnlyList<AchievementAuthoringSnapshot>, IAchievementCustomConditionResolver) pass over
the whole project.
Declaration
public static bool IsValidIdSlug(string id)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | The id to check. |
Returns
| Type | Description |
|---|---|
| bool | True when |
IsValidStorefrontIdentifier(string)
Whether identifier is a name a storefront can key an achievement by — the same rule
Check(IReadOnlyList<AchievementAuthoringSnapshot>, IAchievementCustomConditionResolver) holds every platform identifier to, exposed so a sync can refuse to send a name the
storefront would accept and the game could not use.
Declaration
public static bool IsValidStorefrontIdentifier(string identifier)
Parameters
| Type | Name | Description |
|---|---|---|
| string | identifier | The Steam API name, Xbox or Epic achievement id, or PlayStation trophy id. |
Returns
| Type | Description |
|---|---|
| bool | True when |