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

IProjectVShopScreen interface

The Shop screen contract: observe the view, call commands, redraw on change. Loading, retries and double-tap protection are handled for you.

Namespace: SilverTiger.ProjectV.Unity.Presentation.Shop

public interface IProjectVShopScreen

Properties​

PropertyTypeDescription
CurrentProjectVShopViewThe view right now, built from the last confirmed offers; never null.

Methods​

Observe(Action<ProjectVShopView> render)​

Calls render with the current view, then again whenever the offers change. Loads the offers if they are not loaded yet.

IDisposable Observe(Action<ProjectVShopView> render);

Parameters

NameTypeDescription
renderAction<ProjectVShopView>Draws the page; always called on the Unity main thread, never while a request is in flight.

Returns

IDisposable: The observation; dispose it when the page closes.

PurchaseAsync(string offerId, int quantity)​

Buys units of an offer paid with in-game currency. The offers and the wallet update through Observe; the result only says whether it worked.

Task<ProjectVResult> PurchaseAsync(string offerId, int quantity);

Parameters

NameTypeDescription
offerIdstringThe ID of an offer in the current view, as in OfferId.Value.
quantityintHow many units to buy, from ProjectVShopOfferView.QuantityMin to ProjectVShopOfferView.QuantityMax.

Returns

Task<ProjectVResult>: ProjectVResult.IsSuccess is true when the server confirmed the purchase. Otherwise ProjectVResult.Message is the reason to show, for example "This offer is no longer available." A second tap while a purchase runs returns the same result.