Class AchievementAuthoringSnapshot
What an authored achievement looks like to the rules that check it: identity, presentation, scoring, its unlock condition, and the platform identifiers it declares.
Inherited Members
Namespace: Serenity.Achievements.Application.Authoring
Assembly: Serenity.Achievements.Application.dll
Syntax
public sealed class AchievementAuthoringSnapshot
Remarks
A plain, engine-free copy rather than the asset itself, so the same rules run against a
ScriptableObject in the Studio, against a wizard's in-progress form before any asset exists,
and against a fixture in a headless test. HasIcon is a bool for exactly that reason:
whether a sprite is assigned is knowable everywhere, the sprite itself is not.
Constructors
AchievementAuthoringSnapshot(string, string, string, bool, bool, int, AchievementCondition, AchievementPlatformMapping, IReadOnlyCollection<AchievementPlatformKind>)
Creates a snapshot of one authored achievement.
Declaration
public AchievementAuthoringSnapshot(string id, string displayName, string description, bool hasIcon, bool isHidden, int points, AchievementCondition condition, AchievementPlatformMapping platformMapping, IReadOnlyCollection<AchievementPlatformKind> enabledPlatforms = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | The achievement's identifier. |
| string | displayName | The display name, or the localization key standing for it. |
| string | description | The description, or the localization key standing for it. |
| bool | hasIcon | Whether an icon is assigned. |
| bool | isHidden | Whether the achievement stays concealed until unlocked. |
| int | points | The points the unlock awards. |
| AchievementCondition | condition | The authored unlock condition, or null when only code unlocks it. |
| AchievementPlatformMapping | platformMapping | The per-platform identifiers the achievement declares. |
| IReadOnlyCollection<AchievementPlatformKind> | enabledPlatforms | The platforms this project actually ships on. Null means none. |
Properties
Condition
The authored unlock condition, or null when only code unlocks it.
Declaration
public AchievementCondition Condition { get; }
Property Value
| Type | Description |
|---|---|
| AchievementCondition |
Description
The description, or the localization key standing for it.
Declaration
public string Description { get; }
Property Value
| Type | Description |
|---|---|
| string |
DisplayName
The display name, or the localization key standing for it.
Declaration
public string DisplayName { get; }
Property Value
| Type | Description |
|---|---|
| string |
EnabledPlatforms
The platforms this project ships on, which is what makes a missing id a finding.
Declaration
public IReadOnlyCollection<AchievementPlatformKind> EnabledPlatforms { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyCollection<AchievementPlatformKind> |
HasIcon
Whether an icon is assigned.
Declaration
public bool HasIcon { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Id
The achievement's identifier.
Declaration
public string Id { get; }
Property Value
| Type | Description |
|---|---|
| string |
IsHidden
Whether the achievement stays concealed until unlocked.
Declaration
public bool IsHidden { get; }
Property Value
| Type | Description |
|---|---|
| bool |
PlatformMapping
The per-platform identifiers the achievement declares.
Declaration
public AchievementPlatformMapping PlatformMapping { get; }
Property Value
| Type | Description |
|---|---|
| AchievementPlatformMapping |
Points
The points the unlock awards.
Declaration
public int Points { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
PlatformIdentifierFor(AchievementPlatformKind)
The identifier this achievement declares for a platform, or null when it declares none.
Declaration
public string PlatformIdentifierFor(AchievementPlatformKind platform)
Parameters
| Type | Name | Description |
|---|---|---|
| AchievementPlatformKind | platform | The platform to read. |
Returns
| Type | Description |
|---|---|
| string |