Skip to main content

IProjectVCampaignPresenter interface

The Campaign presenter: the missions, starting a mission run, and releasing it when its scene cannot load. Pages should use IProjectVCampaignScreen instead; use the presenter only for what the screen contract does not cover.

Namespace: SilverTiger.ProjectV.Unity.Presentation.Campaign

public interface IProjectVCampaignPresenter

Properties​

PropertyTypeDescription
CurrentProjectVCampaignSnapshotThe latest snapshot; never null.

Methods​

SubscribeAsync(Action<ProjectVCampaignSnapshot> listener)​

Calls listener with the current snapshot at once, then with every change.

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

Parameters

NameTypeDescription
listenerAction<ProjectVCampaignSnapshot>Called with each snapshot.

Returns

Task<IDisposable>: A subscription; dispose it when the page closes.

Exceptions

ExceptionWhen
ArgumentNullExceptionlistener is null.
ObjectDisposedExceptionThe presenter was disposed.

RefreshAsync(CancellationToken cancellationToken)​

Loads the missions and the player's progress. Returns at once when they are already loaded.

Task<ProjectVCampaignCommandResult> RefreshAsync(CancellationToken cancellationToken);

Parameters

NameTypeDescription
cancellationTokenCancellationTokenStops waiting; tie it to the page.

Returns

Task<ProjectVCampaignCommandResult>: The resulting snapshot and whether it succeeded.

BeginAsync(ProjectVCampaignMissionId missionId, CancellationToken cancellationToken)​

Starts a run of a mission on the server. Entry stamina is checked now and charged when the run ends. On success, load the mission's gameplay scene.

Task<ProjectVCampaignCommandResult> BeginAsync(ProjectVCampaignMissionId missionId, CancellationToken cancellationToken);

Parameters

NameTypeDescription
missionIdProjectVCampaignMissionIdThe ID of a mission in the current data that is not locked.
cancellationTokenCancellationTokenStops waiting; it does not undo a start the server already applied.

Returns

Task<ProjectVCampaignCommandResult>: The resulting snapshot and whether the server started the run. On failure, Snapshot.Error says why, for example MISSION_RUN_LOCKED.

CancelSceneLoadAdmissionAsync(CancellationToken cancellationToken)​

Releases the run started by BeginAsync when its gameplay scene cannot load. A released run costs no stamina.

Task<ProjectVCampaignCommandResult> CancelSceneLoadAdmissionAsync(CancellationToken cancellationToken);

Parameters

NameTypeDescription
cancellationTokenCancellationTokenStops waiting; tie it to the page.

Returns

Task<ProjectVCampaignCommandResult>: The resulting snapshot and whether the server released the run.