ProjectVScreenRecoveryState class
Tells a screen what to show while its data loads or fails: the Phase, a player-facing Message, and whether to offer Retry or Sync buttons.
Namespace: SilverTiger.ProjectV.Unity.Presentation.Recovery
public sealed class ProjectVScreenRecoveryState
Properties
| Property | Type | Description |
|---|---|---|
Phase | ProjectVScreenPhase | The current phase of the screen's data. |
Message | string | Text to show the player; never empty. |
HasUsableData | bool | True when the screen has data it can still show, even if the last update failed. |
CanRetry | bool | True when a Retry button makes sense for the failed action. |
CanSync | bool | True when a Sync or Refresh button makes sense. |
RetryAfterSeconds | int? | Seconds to wait before retrying, when the server sent a hint; otherwise null. |
Methods
Idle(string message)
A state for a screen that has not loaded yet. Sync is offered; Retry is not.
public static ProjectVScreenRecoveryState Idle(string message);
Parameters
| Name | Type | Description |
|---|---|---|
message | string | Text to show the player; not empty. |
Returns
ProjectVScreenRecoveryState: An ProjectVScreenPhase.Idle state.
Exceptions
| Exception | When |
|---|---|
ArgumentException | message is null, empty or whitespace. |
Loading(string message, bool hasUsableData)
A state for a screen that is loading. Neither Retry nor Sync is offered.
public static ProjectVScreenRecoveryState Loading(string message, bool hasUsableData);
Parameters
| Name | Type | Description |
|---|---|---|
message | string | Text to show the player; not empty. |
hasUsableData | bool | True when older data can stay on screen while loading. |
Returns
ProjectVScreenRecoveryState: A ProjectVScreenPhase.Loading state.
Exceptions
| Exception | When |
|---|---|
ArgumentException | message is null, empty or whitespace. |
Ready(string message, bool isEmpty, bool isCacheHit, bool isStale)
A state for a screen whose data loaded. The phase is ProjectVScreenPhase.Stale, else ProjectVScreenPhase.Cached, else ProjectVScreenPhase.Empty, else ProjectVScreenPhase.Live, checked in that order. Sync is offered.
public static ProjectVScreenRecoveryState Ready(string message, bool isEmpty, bool isCacheHit, bool isStale);
Parameters
| Name | Type | Description |
|---|---|---|
message | string | Text to show the player; not empty. |
isEmpty | bool | True when the data has nothing to show. |
isCacheHit | bool | True when the data came from the device instead of the server. |
isStale | bool | True when the data is known to be out of date. |
Returns
ProjectVScreenRecoveryState: A ready state with usable data.
Exceptions
| Exception | When |
|---|---|
ArgumentException | message is null, empty or whitespace. |
Partial(string message, bool canRetry)
A state for a screen that shows some data but whose last update failed. Sync is offered.
public static ProjectVScreenRecoveryState Partial(string message, bool canRetry = true);
Parameters
| Name | Type | Description |
|---|---|---|
message | string | Text to show the player; not empty. |
canRetry | bool | True to offer Retry. |
Returns
ProjectVScreenRecoveryState: A ProjectVScreenPhase.Partial state.
Exceptions
| Exception | When |
|---|---|
ArgumentException | message is null, empty or whitespace. |
Offline(string message, bool hasUsableData, int? retryAfterSeconds)
A state for a screen that could not reach the server. Retry and Sync are offered. With usable data the phase is ProjectVScreenPhase.Partial; without it, ProjectVScreenPhase.Offline.
public static ProjectVScreenRecoveryState Offline(string message, bool hasUsableData, int? retryAfterSeconds = null);
Parameters
| Name | Type | Description |
|---|---|---|
message | string | Text to show the player; not empty. |
hasUsableData | bool | True when older data can stay on screen. |
retryAfterSeconds | int? | Seconds to wait before retrying, or null when unknown. |
Returns
ProjectVScreenRecoveryState: An offline state.
Exceptions
| Exception | When |
|---|---|
ArgumentException | message is null, empty or whitespace. |
Error(string message, bool hasUsableData, bool canRetry)
A state for a screen whose load failed. Sync is offered. With usable data the phase is ProjectVScreenPhase.Partial; without it, ProjectVScreenPhase.Error.
public static ProjectVScreenRecoveryState Error(string message, bool hasUsableData, bool canRetry = true);
Parameters
| Name | Type | Description |
|---|---|---|
message | string | Text to show the player; not empty. |
hasUsableData | bool | True when older data can stay on screen. |
canRetry | bool | True to offer Retry. |
Returns
ProjectVScreenRecoveryState: An error state.
Exceptions
| Exception | When |
|---|---|
ArgumentException | message is null, empty or whitespace. |
Failure(SdkError error, bool hasUsableData)
A state built from an SDK error, using the error's player-facing message and retry hint. Network, timeout and unavailable errors become ProjectVScreenPhase.Offline; other errors become ProjectVScreenPhase.Error; with usable data both become ProjectVScreenPhase.Partial. Sync is always offered.
public static ProjectVScreenRecoveryState Failure(SdkError error, bool hasUsableData);
Parameters
| Name | Type | Description |
|---|---|---|
error | SdkError | The error to show. |
hasUsableData | bool | True when older data can stay on screen. |
Returns
ProjectVScreenRecoveryState: A failure state.
Exceptions
| Exception | When |
|---|---|
ArgumentNullException | error is null. |