Skip to main content

IProjectVShopPresenter interface

The Shop presenter. Pages should use IProjectVShopScreen instead; use the presenter only for what the screen contract does not cover.

Namespace: SilverTiger.ProjectV.Unity.Presentation.Shop

public interface IProjectVShopPresenter

Properties​

PropertyTypeDescription
CurrentProjectVShopSnapshotThe latest snapshot; never null.

Methods​

SubscribeAsync(Action<ProjectVShopSnapshot> listener)​

Calls listener with the current snapshot, then with every change. Changes may arrive off the Unity main thread; IProjectVShopScreen.Observe draws on it for you.

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

Parameters

NameTypeDescription
listenerAction<ProjectVShopSnapshot>Called with each snapshot.

Returns

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

RefreshAsync(CancellationToken cancellationToken)​

Loads the offers. Returns at once when they are already loaded.

Task<ProjectVShopCommandResult> RefreshAsync(CancellationToken cancellationToken);

Parameters

NameTypeDescription
cancellationTokenCancellationTokenStops waiting; tie it to the page.

Returns

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

PurchaseAsync(ProjectVShopOfferView offer, int quantity, CancellationToken cancellationToken)​

Buys units of an offer paid with in-game currency.

Task<ProjectVShopCommandResult> PurchaseAsync(ProjectVShopOfferView offer, int quantity, CancellationToken cancellationToken);

Parameters

NameTypeDescription
offerProjectVShopOfferViewAn offer from the latest snapshot's ProjectVShopSnapshot.Offers.
quantityintHow many units to buy, from ProjectVShopOfferView.QuantityMin to ProjectVShopOfferView.QuantityMax.
cancellationTokenCancellationTokenStops waiting; it does not undo a purchase the server already applied.

Returns

Task<ProjectVShopCommandResult>: The resulting snapshot and whether the server confirmed the purchase.

Exceptions

ExceptionWhen
ArgumentNullExceptionoffer is null.