Interface IGameProgressStore
Application port for persisting and loading the single, global game-progress record.
Namespace: Serenity.GameProgress.Application.Interfaces.Stores
Assembly: Serenity.GameProgress.Application.dll
Syntax
public interface IGameProgressStore
Remarks
Implementations decide how and where progress is stored (in-memory, PlayerPrefs, a remote backend, etc.). The business layer depends on this abstraction, never on a concrete backend.
Methods
HealthCheckAsync(CancellationToken)
Checks whether the backing store is reachable and healthy.
Declaration
Task<bool> HealthCheckAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Token used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<bool> |
LoadAsync(CancellationToken)
Loads the current game progress.
Declaration
Task<GameProgressData> LoadAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Token used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<GameProgressData> | The stored progress, or Empty when nothing has been saved yet. |
SaveAsync(GameProgressData, CancellationToken)
Persists data as the current game progress. Implementations must only
replace the stored value when data's
UpdatedAtUtcTicks is strictly greater than whatever is
already stored, so a stale write can never clobber a newer one; callers are responsible
for stamping strictly increasing ticks on every mutation.
Declaration
Task SaveAsync(GameProgressData data, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| GameProgressData | data | The progress to persist. |
| CancellationToken | cancellationToken | Token used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task |