Chuyển tới nội dung chính

IProjectVStartupPresenter interface

The startup contract for the Login scene: start it once the game content is loaded, observe the state, and show the screen that matches each ProjectVStartupStatus.

Namespace: SilverTiger.ProjectV.Unity.Presentation.Startup

public interface IProjectVStartupPresenter

Properties​

PropertyTypeDescription
CurrentProjectVStartupSnapshotThe startup state right now; never null. Starts as WaitingForContent.

Methods​

SubscribeAsync(Action<ProjectVStartupSnapshot> listener)​

Calls listener with the current state right away, then again on every change.

Task<IDisposable> SubscribeAsync(Action<ProjectVStartupSnapshot> listener);

Parameters

NameTypeDescription
listenerAction<ProjectVStartupSnapshot>Redraws the startup UI; must not be null. An exception it throws on a later change is ignored.

Returns

Task<IDisposable>: The subscription; dispose it when the scene closes.

Exceptions

ExceptionWhen
ArgumentNullExceptionlistener is null.
ObjectDisposedExceptionThe presenter was already shut down.

StartAsync(bool contentReady, CancellationToken cancellationToken)​

Runs startup: checks the server, signs the player back in if possible, then loads the game data. Calling it again while startup runs joins the same run. Call it again after a blocking status to retry.

Task<ProjectVStartupCommandResult> StartAsync(bool contentReady, CancellationToken cancellationToken);

Parameters

NameTypeDescription
contentReadyboolTrue once the game content has loaded. When false and startup is not running, nothing starts and the state stays WaitingForContent.
cancellationTokenCancellationTokenStops waiting for the result. Startup itself keeps running, and the state keeps updating.

Returns

Task<ProjectVStartupCommandResult>: The state where startup stopped. ProjectVStartupSnapshot.IsReady means open the game; ProjectVStartupSnapshot.RequiresLogin means show the sign-in options; ProjectVStartupSnapshot.IsBlocking means show the matching message. When cancellationToken fires first, the status is Failed with the Cancelled category.

Exceptions

ExceptionWhen
ObjectDisposedExceptionThe presenter was already shut down.