IProjectVAllianceScreen interface
The Alliance screen contract: observe the view, call commands, redraw on change. Loading, synchronisation, retries and double-tap protection are handled for you.
Namespace: SilverTiger.ProjectV.Unity.Presentation.Alliance
public interface IProjectVAllianceScreen
Properties
| Property | Type | Description |
|---|---|---|
Current | ProjectVAllianceView | The view right now, built from the last confirmed data; never null. |
Methods
Observe(Action<ProjectVAllianceView> render)
Calls render with the current view, then again only when the data changes. Loads the data if it is not loaded yet.
IDisposable Observe(Action<ProjectVAllianceView> render);
Parameters
| Name | Type | Description |
|---|---|---|
render | Action<ProjectVAllianceView> | Draws the page; always called on the Unity main thread. |
Returns
IDisposable: The observation; dispose it when the page closes.
Exceptions
| Exception | When |
|---|---|
ArgumentNullException | render is null. |
SelectAllyAsync(string allyId)
Makes an ally the one the player takes into battle. Does nothing when it is already selected.
Task<ProjectVResult> SelectAllyAsync(string allyId);
Parameters
| Name | Type | Description |
|---|---|---|
allyId | string | The ID of an ally in the current view, as in ProjectVAllyView.Id. |
Returns
Task<ProjectVResult>: ProjectVResult.IsSuccess is true when the server confirmed the selection. Otherwise ProjectVResult.Message is the reason to show.
LevelUpAsync(string allyId, IReadOnlyList<ProjectVCharacterXpItemSelection> items)
Levels the ally with these EXP items, or finishes its pending upgrade (see ProjectVAllyView.HasPendingUpgrade). The view updates through Observe.
Task<ProjectVResult> LevelUpAsync(string allyId, IReadOnlyList<ProjectVCharacterXpItemSelection> items);
Parameters
| Name | Type | Description |
|---|---|---|
allyId | string | The ID of an ally in the current view, as in ProjectVAllyView.Id. |
items | IReadOnlyList<ProjectVCharacterXpItemSelection> | The EXP items and quantities to spend, for example from ProjectVAllyView.XpForNextLevel. Ignored when the ally has a pending upgrade. |
Returns
Task<ProjectVResult>: ProjectVResult.IsSuccess is true when the server confirmed the upgrade. Otherwise ProjectVResult.Message is the reason to show, such as another ally having an upgrade pending. A second tap while the upgrade runs returns the same result.
Exceptions
| Exception | When |
|---|---|
ArgumentException | allyId is null or blank, or items contains a null or invalid entry. |
ArgumentNullException | items is null. |
UpgradeWeaponSkillAsync(string allyId)
Upgrades the ally's weapon skill. Check ProjectVAllyView.WeaponSkill to show the cost and whether it can be upgraded.
Task<ProjectVResult> UpgradeWeaponSkillAsync(string allyId);
Parameters
| Name | Type | Description |
|---|---|---|
allyId | string | The ID of an ally in the current view, as in ProjectVAllyView.Id. |
Returns
Task<ProjectVResult>: ProjectVResult.IsSuccess is true when the server confirmed the upgrade. Otherwise ProjectVResult.Message is the reason to show. A second tap while the upgrade runs returns the same result.
Exceptions
| Exception | When |
|---|---|
ArgumentException | allyId is null or blank. |
ResetLevelAsync(string allyId)
Resets the ally to level 1 and refunds EXP items. Check ProjectVAllyView.LevelReset to show the refund and whether the reset is possible.
Task<ProjectVResult> ResetLevelAsync(string allyId);
Parameters
| Name | Type | Description |
|---|---|---|
allyId | string | The ID of an ally in the current view, as in ProjectVAllyView.Id. |
Returns
Task<ProjectVResult>: ProjectVResult.IsSuccess is true when the server confirmed the reset. Otherwise ProjectVResult.Message is the reason to show. A second tap while the reset runs returns the same result.
Exceptions
| Exception | When |
|---|---|
ArgumentException | allyId is null or blank. |