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
| Property | Type | Description |
|---|---|---|
Current | ProjectVShopSnapshot | The 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
| Name | Type | Description |
|---|---|---|
listener | Action<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
| Name | Type | Description |
|---|---|---|
cancellationToken | CancellationToken | Stops 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
| Name | Type | Description |
|---|---|---|
offer | ProjectVShopOfferView | An offer from the latest snapshot's ProjectVShopSnapshot.Offers. |
quantity | int | How many units to buy, from ProjectVShopOfferView.QuantityMin to ProjectVShopOfferView.QuantityMax. |
cancellationToken | CancellationToken | Stops 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
| Exception | When |
|---|---|
ArgumentNullException | offer is null. |