Class AchievementsStudioRowModel
One row of the Achievements Studio list: everything the row draws, already answered, so drawing it is arithmetic and string concatenation rather than a walk over an asset and its findings.
Inherited Members
Namespace: Serenity.Achievements.Infrastructure.Editor.Studio
Assembly: Serenity.UnityAchievements.Infrastructure.Editor.dll
Syntax
public sealed class AchievementsStudioRowModel
Remarks
Separated from the drawing so filtering, searching and keyboard navigation are testable without an
EditorWindow — the same reason ListRowLayout exists for the
geometry. A row is built once per reload and per validation pass, never per repaint: describing a
condition tree walks it, and a list of several hundred achievements would otherwise walk several hundred
trees sixty times a second.
Constructors
AchievementsStudioRowModel(string, string, string, string, string, AchievementsStudioRowTraits, AuthoringSeverity?, IReadOnlyList<AchievementsStudioPlatformCoverage>, string)
Creates a row from values a caller already holds.
Declaration
public AchievementsStudioRowModel(string assetGuid, string assetPath, string achievementId, string nameKey, string conditionSummary, AchievementsStudioRowTraits traits, AuthoringSeverity? severity, IReadOnlyList<AchievementsStudioPlatformCoverage> platformCoverage, string judgementFailure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | assetGuid | GUID of the achievement asset, which is what selection survives a reload by. |
| string | assetPath | Project path of the achievement asset. |
| string | achievementId | The achievement's authored id. |
| string | nameKey | Its display name, or the localization key standing for it. |
| string | conditionSummary | What its unlock condition demands, in one line. |
| AchievementsStudioRowTraits | traits | What it awards and how it behaves. |
| AuthoringSeverity? | severity | The worst finding about it, or null when there is none. |
| IReadOnlyList<AchievementsStudioPlatformCoverage> | platformCoverage | How each storefront is covered. May be null. |
| string | judgementFailure | Why nothing about this achievement could be judged, or null when it could. |
Fields
MissingIdTitle
What a row with no id shows instead of one.
Declaration
public const string MissingIdTitle = "(no id)"
Field Value
| Type | Description |
|---|---|
| string |
TitleSeparator
Separates the id from the name key in a row title.
Declaration
public const string TitleSeparator = " — "
Field Value
| Type | Description |
|---|---|
| string |
Properties
AchievementId
Declaration
public string AchievementId { get; }
Property Value
| Type | Description |
|---|---|
| string | The achievement's authored id. |
AssetGuid
Declaration
public string AssetGuid { get; }
Property Value
| Type | Description |
|---|---|
| string | GUID of the achievement asset. |
AssetPath
Declaration
public string AssetPath { get; }
Property Value
| Type | Description |
|---|---|
| string | Project path of the achievement asset. |
ConditionSummary
Declaration
public string ConditionSummary { get; }
Property Value
| Type | Description |
|---|---|
| string | What its unlock condition demands, in one line. |
CouldNotBeJudged
Declaration
public bool CouldNotBeJudged { get; }
Property Value
| Type | Description |
|---|---|
| bool | Whether this achievement defeated the authoring rules. Such a row claims nothing about what the achievement awards or where it is mirrored, because none of it could be read. |
HasFindings
Declaration
public bool HasFindings { get; }
Property Value
| Type | Description |
|---|---|
| bool | Whether anything at all was found about this achievement. |
JudgementFailure
Declaration
public string JudgementFailure { get; }
Property Value
| Type | Description |
|---|---|
| string | Why nothing about this achievement could be judged, or null when it could. |
NameKey
Declaration
public string NameKey { get; }
Property Value
| Type | Description |
|---|---|
| string | Its display name, or the localization key standing for it. |
PlatformCoverage
Declaration
public IReadOnlyList<AchievementsStudioPlatformCoverage> PlatformCoverage { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<AchievementsStudioPlatformCoverage> | How each storefront worth showing is covered, in reading order. |
Severity
Declaration
public AuthoringSeverity? Severity { get; }
Property Value
| Type | Description |
|---|---|
| AuthoringSeverity? | The worst finding about it, or null when there is none. |
Title
Declaration
public string Title { get; }
Property Value
| Type | Description |
|---|---|
| string | The row's title: the id, and the name key when it says something the id does not. |
Traits
Declaration
public AchievementsStudioRowTraits Traits { get; }
Property Value
| Type | Description |
|---|---|
| AchievementsStudioRowTraits | What it awards and how it behaves. |
Methods
BuildAll(IReadOnlyList<UnityAchievementDefinition>, IReadOnlyCollection<AchievementPlatformKind>)
Builds a row for every achievement in the project.
Declaration
public static IReadOnlyList<AchievementsStudioRowModel> BuildAll(IReadOnlyList<UnityAchievementDefinition> definitions, IReadOnlyCollection<AchievementPlatformKind> enabledPlatforms)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<UnityAchievementDefinition> | definitions | Every achievement asset in the project. May be null and may contain null. |
| IReadOnlyCollection<AchievementPlatformKind> | enabledPlatforms | The storefronts the project ships on. May be null. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<AchievementsStudioRowModel> | One row per non-null achievement, in the order given. |
Remarks
The judging — one pass over the project, and what happens when that pass throws — belongs to AchievementAuthoringJudge. What is here is turning each answer into a row, and reporting the ones that have no answer: this is the only level holding both the failure and the asset path it belongs to, so this is where a reader of the Console is told which file to open.
The consequence to know about: the duplicate-id rule reports the SECOND achievement to claim an id,
so of two colliding rows only the later one carries the dot. The detail pane re-checks the selected
achievement with itself last (see AchievementDefinitionAuthoringReview), so opening either row
still explains the collision.
ContainsLowercase(string)
Whether this row contains the text typed into the search field.
Declaration
public bool ContainsLowercase(string lowercaseSearch)
Parameters
| Type | Name | Description |
|---|---|---|
| string | lowercaseSearch | The search text, already lowercased by the caller. |
Returns
| Type | Description |
|---|---|
| bool | True when the row matches. |
From(UnityAchievementDefinition, string, string, AchievementAuthoringJudgement, IReadOnlyCollection<AchievementPlatformKind>, Func<AchievementCondition, string>)
Builds a row for one achievement.
Declaration
public static AchievementsStudioRowModel From(UnityAchievementDefinition definition, string assetGuid, string assetPath, AchievementAuthoringJudgement judgement, IReadOnlyCollection<AchievementPlatformKind> enabledPlatforms, Func<AchievementCondition, string> describeCondition = null)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityAchievementDefinition | definition | The achievement. Null produces null. |
| string | assetGuid | GUID of its asset. |
| string | assetPath | Project path of its asset. |
| AchievementAuthoringJudgement | judgement | What the rules said, or why they could not say anything. May be null. |
| IReadOnlyCollection<AchievementPlatformKind> | enabledPlatforms | The storefronts the project ships on. May be null. |
| Func<AchievementCondition, string> | describeCondition | What turns a condition tree into one line. Defaults to the shared Describe(AchievementCondition); a test hands in one that throws, which is the only way to prove a hostile tree costs its own row without writing a corrupted asset to disk. |
Returns
| Type | Description |
|---|---|
| AchievementsStudioRowModel | The row, or null when there was no achievement. |
Remarks
The asset's GUID and path are parameters rather than read here, so a test can build a row without writing an asset to disk and so BuildAll(IReadOnlyList<UnityAchievementDefinition>, IReadOnlyCollection<AchievementPlatformKind>) pays for the lookup once per achievement.
Nothing this reads is trusted. Describing a condition walks an authored
[SerializeReference] graph and reading the storefront identifiers snapshots the achievement,
so one corrupted asset can throw here — and a list that refuses to draw is a worse answer than a
list with one row that says what is wrong with it.