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​
| Property | Type | Description |
|---|---|---|
Current | ProjectVCampaignSnapshot | The 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
| Name | Type | Description |
|---|---|---|
listener | Action<ProjectVCampaignSnapshot> | Called with each snapshot. |
Returns
Task<IDisposable>: A subscription; dispose it when the page closes.
Exceptions
| Exception | When |
|---|---|
ArgumentNullException | listener is null. |
ObjectDisposedException | The 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
| Name | Type | Description |
|---|---|---|
cancellationToken | CancellationToken | Stops 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
| Name | Type | Description |
|---|---|---|
missionId | ProjectVCampaignMissionId | The ID of a mission in the current data that is not locked. |
cancellationToken | CancellationToken | Stops 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
| Name | Type | Description |
|---|---|---|
cancellationToken | CancellationToken | Stops waiting; tie it to the page. |
Returns
Task<ProjectVCampaignCommandResult>: The resulting snapshot and whether the server released the run.