Class AchievementIconLookup
Answers "what does this achievement look like" by id, from the icons the project authored on its achievement assets.
Inherited Members
Namespace: Serenity.Achievements.Infrastructure.Views
Assembly: Serenity.UnityAchievements.Infrastructure.dll
Syntax
public sealed class AchievementIconLookup
Remarks
The icon is a Unity UnityEngine.Sprite, so it never reached the engine-free AchievementDefinition the registry is built from — which is why the listing has to come back to the assets for it rather than reading it off the runtime definition it already holds.
A project that replaced the shipped definition source with one of its own (a build-time list, a live-ops endpoint) has no assets to read, so this resolves to nothing and the listing draws rows without icons. That is a configuration, not a failure.
Properties
Count
How many achievements this lookup can answer for.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
Empty()
A lookup that answers nothing, for a project whose achievements come from elsewhere.
Declaration
public static AchievementIconLookup Empty()
Returns
| Type | Description |
|---|---|
| AchievementIconLookup | The empty lookup. |
From(IAchievementDefinitionSource)
Builds the lookup from the authored assets a definition source read, when it read any.
Declaration
public static AchievementIconLookup From(IAchievementDefinitionSource definitionSource)
Parameters
| Type | Name | Description |
|---|---|---|
| IAchievementDefinitionSource | definitionSource | The source the achievements module was installed with. May be |
Returns
| Type | Description |
|---|---|
| AchievementIconLookup | The lookup. Never null; answers nothing when there are no assets to read. |
From(IReadOnlyList<UnityAchievementDefinition>)
Builds the lookup from authored achievement assets directly.
Declaration
public static AchievementIconLookup From(IReadOnlyList<UnityAchievementDefinition> assets)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<UnityAchievementDefinition> | assets | The authored assets. May be |
Returns
| Type | Description |
|---|---|
| AchievementIconLookup | The lookup. Never null. |
Resolve(string)
The icon authored for an achievement, or null when it has none.
Declaration
public Sprite Resolve(string achievementId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | achievementId | The achievement whose icon is wanted. |
Returns
| Type | Description |
|---|---|
| Sprite | The icon, or |