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

IProjectVAlliancePresenter interface

The Alliance presenter: the player's allies, ally selection, leveling with EXP items, weapon skill upgrades and level resets. Pages should use IProjectVAllianceScreen instead; use the presenter only for what the screen contract does not cover.

Namespace: SilverTiger.ProjectV.Unity.Presentation.Alliance

public interface IProjectVAlliancePresenter

Properties​

PropertyTypeDescription
CurrentProjectVAllianceSnapshotThe latest snapshot; never null.
PendingProgressionCharacter.ProjectVCharacterProgressionPending?An ally or character upgrade that was started but not confirmed, or null. While it is set, no other ally can change level; finish it with RetryPendingProgressionAsync.

Methods​

GetUpgradeState(ProjectVCharacterId allyId)​

Tells whether an ally can be upgraded now and what the upgrade costs.

ProjectVCharacterUpgradeState GetUpgradeState(ProjectVCharacterId allyId);

Parameters

NameTypeDescription
allyIdProjectVCharacterIdThe ID of an owned ally.

Returns

ProjectVCharacterUpgradeState: The upgrade state; when CanUpgrade is false, Message says why.

GetXpUpgradePreview(ProjectVCharacterId allyId, IReadOnlyList<ProjectVCharacterXpItemSelection> items)​

Shows what leveling an ally with these EXP items would do, without changing anything.

ProjectVCharacterXpUpgradePreview GetXpUpgradePreview(ProjectVCharacterId allyId, IReadOnlyList<ProjectVCharacterXpItemSelection> items);

Parameters

NameTypeDescription
allyIdProjectVCharacterIdThe ID of an owned ally.
itemsIReadOnlyList<ProjectVCharacterXpItemSelection>The EXP items and quantities to use; may be empty.

Returns

ProjectVCharacterXpUpgradePreview: The preview with the EXP gained and the resulting EXP. CanSubmit is false, with a Message to show, when the ally is not owned or the selection cannot be used.

Exceptions

ExceptionWhen
ArgumentNullExceptionitems is null.

GetLevelResetPreview(ProjectVCharacterId allyId)​

Shows what resetting an ally to level 1 would refund, without changing anything.

ProjectVCharacterLevelResetPreview GetLevelResetPreview(ProjectVCharacterId allyId);

Parameters

NameTypeDescription
allyIdProjectVCharacterIdThe ID of an owned ally.

Returns

ProjectVCharacterLevelResetPreview: The preview with the items to refund. CanReset is false, with a Message to show, when the reset is not possible or the data must be synchronised first.

SelectXpItemsForNextLevel(ProjectVCharacterId allyId)​

Picks the fewest owned EXP items that take an ally to its next level.

IReadOnlyList<ProjectVCharacterXpItemSelection> SelectXpItemsForNextLevel(ProjectVCharacterId allyId);

Parameters

NameTypeDescription
allyIdProjectVCharacterIdThe ID of an owned ally.

Returns

IReadOnlyList<ProjectVCharacterXpItemSelection>: The items to use; empty when the ally is not owned, an upgrade is pending, or the data is not ready or must be synchronised first.

SelectMaximumXpItems(ProjectVCharacterId allyId)​

Picks the owned EXP items that take an ally to the highest level the player can afford.

IReadOnlyList<ProjectVCharacterXpItemSelection> SelectMaximumXpItems(ProjectVCharacterId allyId);

Parameters

NameTypeDescription
allyIdProjectVCharacterIdThe ID of an owned ally.

Returns

IReadOnlyList<ProjectVCharacterXpItemSelection>: The items to use; empty when the ally is not owned, an upgrade is pending, or the data is not ready or must be synchronised first.

SubscribeAsync(Action<ProjectVAllianceSnapshot> listener)​

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

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

Parameters

NameTypeDescription
listenerAction<ProjectVAllianceSnapshot>Called with each snapshot.

Returns

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

Exceptions

ExceptionWhen
ArgumentNullExceptionlistener is null.

RefreshAsync(CancellationToken cancellationToken)​

Loads the Alliance data. Returns at once when it is already loaded.

Task<ProjectVAllianceCommandResult> RefreshAsync(CancellationToken cancellationToken);

Parameters

NameTypeDescription
cancellationTokenCancellationTokenStops waiting; tie it to the page.

Returns

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

SelectAllyAsync(ProjectVCharacterId allyId, CancellationToken cancellationToken)​

Makes an ally the one the player takes into battle. Returns at once when it is already selected. While a selection runs, further calls return that same selection's result.

Task<ProjectVAllianceCommandResult> SelectAllyAsync(ProjectVCharacterId allyId, CancellationToken cancellationToken);

Parameters

NameTypeDescription
allyIdProjectVCharacterIdThe ID of an owned ally.
cancellationTokenCancellationTokenStops waiting; it does not undo a selection the server already applied.

Returns

Task<ProjectVAllianceCommandResult>: The resulting snapshot and whether the server confirmed the selection.

SynchronizeAsync(CancellationToken cancellationToken)​

Reloads the Alliance data from the server and confirms earlier upgrades. Call it when ProjectVAllianceSnapshot.RequiresUpgradeSync is true or the data is out of date.

Task<ProjectVAllianceCommandResult> SynchronizeAsync(CancellationToken cancellationToken);

Parameters

NameTypeDescription
cancellationTokenCancellationTokenStops waiting; tie it to the page.

Returns

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

UpgradeAllyWithXpItemsAsync(ProjectVCharacterId allyId, IReadOnlyList<ProjectVCharacterXpItemSelection> items, CancellationToken cancellationToken)​

Levels an ally by spending EXP items. Check GetXpUpgradePreview first.

Task<ProjectVAllianceCommandResult> UpgradeAllyWithXpItemsAsync(ProjectVCharacterId allyId, IReadOnlyList<ProjectVCharacterXpItemSelection> items, CancellationToken cancellationToken);

Parameters

NameTypeDescription
allyIdProjectVCharacterIdThe ID of an owned ally.
itemsIReadOnlyList<ProjectVCharacterXpItemSelection>The EXP items and quantities to spend.
cancellationTokenCancellationTokenStops waiting; it does not undo an upgrade the server already applied.

Returns

Task<ProjectVAllianceCommandResult>: The resulting snapshot and whether the server confirmed the upgrade. When it could not be confirmed, PendingProgression is set; finish it with RetryPendingProgressionAsync.

Exceptions

ExceptionWhen
ArgumentExceptionallyId is not an owned ally.

UpgradeWeaponSkillAsync(ProjectVCharacterId allyId, CancellationToken cancellationToken)​

Upgrades an ally's weapon skill. Check ProjectVAllianceData.GetCastSkillUpgradeDetails with ProjectVCharacterCastSkillSlot.Weapon first.

Task<ProjectVAllianceCommandResult> UpgradeWeaponSkillAsync(ProjectVCharacterId allyId, CancellationToken cancellationToken);

Parameters

NameTypeDescription
allyIdProjectVCharacterIdThe ID of an owned ally.
cancellationTokenCancellationTokenStops waiting; it does not undo an upgrade the server already applied.

Returns

Task<ProjectVAllianceCommandResult>: The resulting snapshot and whether the server confirmed the upgrade.

Exceptions

ExceptionWhen
ArgumentExceptionallyId is not an owned ally.
InvalidOperationExceptionThe data is not ready, must be synchronised first, or an upgrade is pending.

RetryPendingProgressionAsync(CancellationToken cancellationToken)​

Finishes the ally upgrade in PendingProgression, using the same EXP items.

Task<ProjectVAllianceCommandResult> RetryPendingProgressionAsync(CancellationToken cancellationToken);

Parameters

NameTypeDescription
cancellationTokenCancellationTokenStops waiting; tie it to the page.

Returns

Task<ProjectVAllianceCommandResult>: The resulting snapshot and whether the server confirmed the upgrade.

ResetAllyLevelAsync(ProjectVCharacterId allyId, CancellationToken cancellationToken)​

Resets an ally to level 1 and refunds EXP items. Check GetLevelResetPreview first.

Task<ProjectVAllianceCommandResult> ResetAllyLevelAsync(ProjectVCharacterId allyId, CancellationToken cancellationToken);

Parameters

NameTypeDescription
allyIdProjectVCharacterIdThe ID of an owned ally.
cancellationTokenCancellationTokenStops waiting; it does not undo a reset the server already applied.

Returns

Task<ProjectVAllianceCommandResult>: The resulting snapshot and whether the server confirmed the reset.