Skip to main content

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โ€‹

PropertyTypeDescription
PhaseProjectVScreenPhaseThe current phase of the screen's data.
MessagestringText to show the player; never empty.
HasUsableDataboolTrue when the screen has data it can still show, even if the last update failed.
CanRetryboolTrue when a Retry button makes sense for the failed action.
CanSyncboolTrue when a Sync or Refresh button makes sense.
RetryAfterSecondsint?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

NameTypeDescription
messagestringText to show the player; not empty.

Returns

ProjectVScreenRecoveryState: An ProjectVScreenPhase.Idle state.

Exceptions

ExceptionWhen
ArgumentExceptionmessage 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

NameTypeDescription
messagestringText to show the player; not empty.
hasUsableDataboolTrue when older data can stay on screen while loading.

Returns

ProjectVScreenRecoveryState: A ProjectVScreenPhase.Loading state.

Exceptions

ExceptionWhen
ArgumentExceptionmessage 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

NameTypeDescription
messagestringText to show the player; not empty.
isEmptyboolTrue when the data has nothing to show.
isCacheHitboolTrue when the data came from the device instead of the server.
isStaleboolTrue when the data is known to be out of date.

Returns

ProjectVScreenRecoveryState: A ready state with usable data.

Exceptions

ExceptionWhen
ArgumentExceptionmessage 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

NameTypeDescription
messagestringText to show the player; not empty.
canRetryboolTrue to offer Retry.

Returns

ProjectVScreenRecoveryState: A ProjectVScreenPhase.Partial state.

Exceptions

ExceptionWhen
ArgumentExceptionmessage 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

NameTypeDescription
messagestringText to show the player; not empty.
hasUsableDataboolTrue when older data can stay on screen.
retryAfterSecondsint?Seconds to wait before retrying, or null when unknown.

Returns

ProjectVScreenRecoveryState: An offline state.

Exceptions

ExceptionWhen
ArgumentExceptionmessage 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

NameTypeDescription
messagestringText to show the player; not empty.
hasUsableDataboolTrue when older data can stay on screen.
canRetryboolTrue to offer Retry.

Returns

ProjectVScreenRecoveryState: An error state.

Exceptions

ExceptionWhen
ArgumentExceptionmessage 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

NameTypeDescription
errorSdkErrorThe error to show.
hasUsableDataboolTrue when older data can stay on screen.

Returns

ProjectVScreenRecoveryState: A failure state.

Exceptions

ExceptionWhen
ArgumentNullExceptionerror is null.