Class SerenityAchievementValidator
Checks every authored achievement in the project, plus the configuration around them: whether anything says where unlocks are stored, whether the storefronts it claims are ones its achievements actually reach, whether a boot profile installs the module, and whether an achievements screen's Cancel target still resolves to a view.
Inherited Members
Namespace: Serenity.Achievements.Infrastructure.Editor.Validation
Assembly: Serenity.UnityAchievements.Infrastructure.Editor.dll
Syntax
public static class SerenityAchievementValidator
Remarks
Nothing here is a rule. The per-achievement questions are AchievementAuthoringRules's and reach this class through the same AchievementAuthoringJudge the Studio uses; the project-wide ones are AchievementProjectRules's. What this class supplies is what only a project scan knows — which assets exist, where they live, and what the initialization pipeline is set to run — so an achievement can never be judged one way in the Studio and another way here.
It goes through the judge rather than calling the rules directly for the reason the judge exists: the
rules walk an authored [SerializeReference] graph, and one corrupted asset that ends the pass
would otherwise leave this validator reporting a project on which nothing is wrong. That is the one
failure a validator must not have.
Fields
AuthoringSection
The group a finding about a whole achievement — rather than one of its fields — belongs to.
Declaration
public const string AuthoringSection = "Authoring"
Field Value
| Type | Description |
|---|---|
| string |
NavigationSection
The group a finding about where a screen goes belongs to.
Declaration
public const string NavigationSection = "Navigation"
Field Value
| Type | Description |
|---|---|
| string |
ValidatorName
Validator tag used on issues and in the report's validators-run list.
Declaration
public const string ValidatorName = "achievements"
Field Value
| Type | Description |
|---|---|
| string |
Methods
AppendAchievementFindings(SerenityValidationReport, IReadOnlyList<UnityAchievementDefinition>, IReadOnlyCollection<AchievementPlatformKind>, Func<IReadOnlyList<AchievementAuthoringSnapshot>, IReadOnlyList<AuthoringIssue>>)
Reports what the shared authoring rules said about each achievement, and names the ones they could not be run over at all.
Declaration
public static void AppendAchievementFindings(SerenityValidationReport report, IReadOnlyList<UnityAchievementDefinition> achievements, IReadOnlyCollection<AchievementPlatformKind> enabledPlatforms, Func<IReadOnlyList<AchievementAuthoringSnapshot>, IReadOnlyList<AuthoringIssue>> checkRules = null)
Parameters
| Type | Name | Description |
|---|---|---|
| SerenityValidationReport | report | The report to append to. |
| IReadOnlyList<UnityAchievementDefinition> | achievements | The achievements to judge, in list order. |
| IReadOnlyCollection<AchievementPlatformKind> | enabledPlatforms | The storefronts the project ships on. May be null. |
| Func<IReadOnlyList<AchievementAuthoringSnapshot>, IReadOnlyList<AuthoringIssue>> | checkRules | What answers "what is wrong with these achievements". Defaults to the shared authoring rules. |
Remarks
Public, and taking its achievements rather than finding them, for the same reason
SerenityHudBindingValidator.AppendMissingInstallTaskIssue is: what a validator does with a
refused judgement is a decision, and it should be asserted against a rules delegate that refuses on
demand rather than against whatever the project happens to ship. The corrupted asset that refuses
for real cannot be written into the repository to be tested with.
AppendProjectFindings(SerenityValidationReport, AchievementProjectSnapshot, string, string)
Reports the facts about the project rather than about any one asset, each anchored to the asset its author would have to open: the boot task for an installation finding, the settings asset for the rest.
Declaration
public static void AppendProjectFindings(SerenityValidationReport report, AchievementProjectSnapshot project, string settingsAssetPath, string installTaskPath)
Parameters
| Type | Name | Description |
|---|---|---|
| SerenityValidationReport | report | The report to append to. |
| AchievementProjectSnapshot | project | What the project's achievement configuration looks like. |
| string | settingsAssetPath | Where a configuration finding lands. Empty when nothing owns it. |
| string | installTaskPath | Where an installation finding lands. Empty when the task does not exist. |
Remarks
Anchoring by section rather than putting every project finding on the same asset is what makes the report's Ping button useful: "no profile installs the module" is fixed in the pipeline profile the task asset belongs to, and pointing it at the settings asset would send the author to the one file that is not the problem. A project with no settings asset at all anchors to nothing, which is the honest answer.
Public, and taking a described project rather than scanning for one, for the same reason
SerenityHudBindingValidator.AppendMissingInstallTaskIssue is: which findings a project
shape produces, how serious they are and which asset each lands on is a decision, and it should be
asserted against every combination rather than against whatever the repository happens to contain
on the day the test runs.
AppendSettingsAssetFindings(SerenityValidationReport, string, IReadOnlyList<AchievementPlatformKind?>)
Reports the storefront slots one achievement settings asset leaves empty or repeats.
Declaration
public static void AppendSettingsAssetFindings(SerenityValidationReport report, string settingsAssetPath, IReadOnlyList<AchievementPlatformKind?> platformSlots)
Parameters
| Type | Name | Description |
|---|---|---|
| SerenityValidationReport | report | The report to append to. |
| string | settingsAssetPath | Project path of the asset the slots came from. |
| IReadOnlyList<AchievementPlatformKind?> | platformSlots | Its storefront slots, in declaration order, a null entry per empty slot. |
Remarks
Takes the slots rather than the asset, so what a finding says and where it lands can be asserted against slots a test wrote instead of against whatever settings asset the project happens to ship.
Run(SerenityValidationReport)
Runs the achievements scan and appends findings to the report.
Declaration
public static void Run(SerenityValidationReport report)
Parameters
| Type | Name | Description |
|---|---|---|
| SerenityValidationReport | report | The report to append to. |