Class UnityAchievementRowView
Script on one achievement row — the theme's row template, or the procedural fallback built by CreateProcedural(Transform). Holds the slots a row draws into (icon, name, description, progress bar and text, unlock date, points, screenshot thumbnail) and fills them from an AchievementRowContent.
Namespace: Serenity.Achievements.Infrastructure.Views
Assembly: Serenity.UnityAchievements.Infrastructure.dll
Syntax
public sealed class UnityAchievementRowView : MonoBehaviour
Remarks
A component with wired slots rather than a by-name child lookup, so a theme author can lay a row out
however they like and only has to say which object is which — the same contract
UnityLeaderboardPanel uses for its own three slots.
Rows are pooled by UnityAchievementsPanel: one instance is reused across refreshes, so every slot is reset on every Apply(AchievementRowContent, Sprite, bool) rather than assumed to still hold the previous row's state.
Constructors
UnityAchievementRowView()
Declaration
public UnityAchievementRowView()
Properties
AchievementId
The id of the achievement this row currently shows, or null when it has never been filled.
Declaration
public string AchievementId { get; }
Property Value
| Type | Description |
|---|---|
| string |
IsUnlocked
Whether the achievement this row currently shows is unlocked.
Declaration
public bool IsUnlocked { get; }
Property Value
| Type | Description |
|---|---|
| bool |
ScreenshotKey
The screenshot key this row is waiting on, or null when it shows no thumbnail.
Declaration
public string ScreenshotKey { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
Apply(AchievementRowContent, Sprite, bool)
Fills every slot from a row, resetting the ones the row has nothing for.
Declaration
public void Apply(AchievementRowContent row, Sprite icon, bool showThumbnail)
Parameters
| Type | Name | Description |
|---|---|---|
| AchievementRowContent | row | The already-formatted row. |
| Sprite | icon | The achievement's authored icon, or |
| bool | showThumbnail | Whether this view is configured to show unlock screenshots at all. |
CreateProcedural(Transform)
Builds an unthemed row under parent for when the theme supplies no row template.
Declaration
public static UnityAchievementRowView CreateProcedural(Transform parent)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | parent | The transform the row is parented under. |
Returns
| Type | Description |
|---|---|
| UnityAchievementRowView | The configured (still empty) row. |
SetThumbnail(Sprite)
Shows the loaded unlock screenshot, or hides the thumbnail slot when there is nothing to show.
Declaration
public void SetThumbnail(Sprite screenshot)
Parameters
| Type | Name | Description |
|---|---|---|
| Sprite | screenshot | The decoded screenshot, or |
Remarks
Separate from Apply(AchievementRowContent, Sprite, bool) because the bytes are read asynchronously: the row is drawn immediately, and the thumbnail arrives afterwards for the rows that have one.