Class AchievementPointsMirror
Mirrors achievement points into a Score metric so HUDs, leaderboards and save summaries can read them through the machinery they already use.
Inherited Members
Namespace: Serenity.Achievements.Application.Services
Assembly: Serenity.Achievements.Application.dll
Syntax
public class AchievementPointsMirror
Remarks
The mirror is a projection, never the source of truth — unlock records are. It is therefore fed by FRESH unlocks only: replaying it on hydrate or on a platform reconcile would add the same points again on every launch, and the drift would be invisible because the records still sum correctly.
Constructors
AchievementPointsMirror(IScoreService, IAchievementSettings)
Initializes a new instance of the AchievementPointsMirror class.
Declaration
public AchievementPointsMirror(IScoreService scoreService, IAchievementSettings settings)
Parameters
| Type | Name | Description |
|---|---|---|
| IScoreService | scoreService | Score service the mirror writes to. May be |
| IAchievementSettings | settings | Achievement configuration, read for the metric key. |
Properties
IsEnabled
Whether a Score metric is configured and reachable.
Declaration
public bool IsEnabled { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
AddPoints(int)
Adds a freshly unlocked achievement's points to the mirrored metric.
Declaration
public void AddPoints(int points)
Parameters
| Type | Name | Description |
|---|---|---|
| int | points | The points the unlock awarded. Zero or less is not written. |
Reset()
Returns the mirrored metric to zero, so a reset does not leave stale points behind.
Declaration
public void Reset()